-1
Hello, I’m learning how to develop Dart/Flutter apps.
What happens is that I pressed a Navigator.push, where it loads the previous route, in case I want to return, however, in my appbar instead of pressing the back button, it initializes the button that opens the Navigator Drawer.
Below the code and image of what occurs:
Nav.Dart
import 'package:flutter/material.dart';
    Future push(BuildContext context, Widget page, {bool replace = false}) {
    if(replace) {
      return Navigator.pushReplacement(
     context, MaterialPageRoute(builder: (BuildContext context) {
    return page;
    }));
   }
   return Navigator.push(context, MaterialPageRoute(builder: (BuildContext context) {
    return page;
   }));
  }
List_view.Dart
  _body(context){
return Observer(
    //stream: _carMobx.stream,
    builder: (context){
      List<Carro> carros = _carMobx.carros;
        if(_carMobx.error != null){
          return TextError("Não foi possível retornar os dados\n\nClique Aqui para recarregar", onPressed: _fetch());
        }
        else{
          if(carros == null){
            return Center(child: CircularProgressIndicator(),);
          }else {
            return _listView(context, carros);
          }
        }
  }
  );
  }
  Container _listView(context, List<Carro> carros) {
   return Container(
  padding: EdgeInsets.all(16),
  child: ListView.builder(
      itemCount: carros.length,
      itemBuilder: (context, index){
        Carro c = carros[index];
        return Card(
          child: Container(
            padding: EdgeInsets.all(10),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Center(
                    child: Image.network(c.urlFoto ?? 
        "https://i.pinimg.com/originals/63/dc/de/63dcde7857ba4c976db71314fc79cf19.jpg",
                      width: 250,)
                ),
                Text(c.nome ?? "Sem nome",
                  maxLines: 2,
                  overflow: TextOverflow.ellipsis,
                  style: TextStyle(fontSize: 18,),
                ),
                Text(c.descricao ?? "Sem Descrição",
                  maxLines: 1,
                  overflow: TextOverflow.ellipsis,
                  style: TextStyle(fontSize: 14,),
                ),
                ButtonBarTheme(
                  data: ButtonBarThemeData(),
                  child: ButtonBar(
                    children: <Widget>[
                      FlatButton(
                        child: const Text('DETALHES'),
                        onPressed: () => _onClickDetalhes(context, c),
                      ),
                      FlatButton(
                        child: const Text('COMPARTILHAR'),
                        onPressed: () { /* ... */ },
                      ),
                    ],
                  ),
                ),
              ],
            ),
          ),
        );
      }),
      );
      }
      _onClickDetalhes(context, Carro c) {
        push(context, CarroPage(c));
      }