我的类(class)没有在AppBar中显示后退按钮,
已经尝试将this.automaticallyImplyLeading = true,
import 'package:carros/pages/carro/carro.dart';
import 'package:flutter/material.dart';
class CarroPage extends StatelessWidget {
Carro carro;
CarroPage(this.carro);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(carro.nome),
),
body: _body(),
);
}
_body() {
return Image.network(carro.urlFoto);
}
}
最佳答案
尝试制作自己的后退按钮:
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
iconSize: 20.0,
onPressed: () {
_goBack(context);
},
),
centerTitle: true,
title: Text('carro.nome')),
_goBack(BuildContext context) {
Navigator.pop(context);
}