Issue
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);
}
}
Solution
Try to make your own back button :
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
iconSize: 20.0,
onPressed: () {
_goBack(context);
},
),
centerTitle: true,
title: Text('back')),
And the _goBack method :
_goBack(BuildContext context) {
Navigator.pop(context);
}
Answered By - Sameh Khemira
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.