// jika Anda ingin menyembunyikan tombol kembali gunakan kode di bawah ini
class SecondScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Remove Back Button'),
//hide back button
automaticallyImplyLeading: false,
),
body: Center(
child: Container(),
),
);
}
}
// jika Anda ingin menyembunyikan tombol kembali dan menghentikan pop action gunakan kode di bawah ini
class SecondScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new WillPopScope(
onWillPop: () async => false,
child: Scaffold(
appBar: AppBar(
title: Text("Second Screen"),
//For hide back button
automaticallyImplyLeading: false,
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
RaisedButton(
child: Text('Back'),
onPressed: () {
Navigator.pop(context);
},
),
],
)
),
),
);
}