My class is not showing the back button in the AppBar,
Already try put 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);
}
}
I used this solution, it works for me, add leading inside AppBar:
appBar: AppBar(
backgroundColor: Colors.white,
elevation: 0.0,
titleSpacing: 10.0,
centerTitle: true,
leading: InkWell(
onTap: () {
Navigator.pop(context);
},
child: Icon(
Icons.arrow_back_ios,
color: Colors.black54,
),
),
)
According to the document, if you use Material design and push a screen, the back button should be there.
https://api.flutter.dev/flutter/material/AppBar-class.html
But sometimes the back button and app bar background color are the same, so it is invisible. Let try to click on the leading button zone or set to a contrary color
appBar: AppBar(
iconTheme: IconThemeData(
color: Colors.black, //change your color here
),
title: Text("Sample"),
centerTitle: true,
),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With