Closed rezam92 closed 4 years ago
Are you using the CustomNavigator or the CustomScaffold?
I use CustomNavigator ,like a example
I use CustomNavigator ,like a example
I used CustomScaffold too, it is the same as CustomNavigator, app exit with press back button in any tab
This is weird can i see your implementation ??
Yes, I just implemented your example.
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
// Custom navigator takes a global key if you want to access the
// navigator from outside it's widget tree subtree
GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
@override
Widget build(BuildContext context) {
// Here's the custom scaffold widget
// It takes a normal scaffold with mandatory bottom navigation bar
// and children who are your pages
return CustomScaffold(
scaffold: Scaffold(
bottomNavigationBar: BottomNavigationBar(
items: _items,
),
),
// Children are the pages that will be shown by every click
// They should placed in order such as
// `page 0` will be presented when `item 0` in the [BottomNavigationBar] clicked.
children: <Widget>[
Page('0'),
Page('1'),
Page('2'),
],
// Called when one of the [items] is tapped.
onItemTap: (index) {},
);
}
final _items = [
BottomNavigationBarItem(icon: Icon(Icons.home), title: Text('home')),
BottomNavigationBarItem(icon: Icon(Icons.event), title: Text('events')),
BottomNavigationBarItem(
icon: Icon(Icons.save_alt), title: Text('downloads')),
];
}
in each page if I press back in android, app will be closed.
i wasn't able to reproduce the problem even on Android. It works fine on Android and IOS are you sure you're on the latest version?
thank you @ayham95 . It's ok on the latest version.
it is still giving the same issue im using the custom navigator
Same issue
is it possible to handle back press button in android? now, in each tab when i press back button, it results in exiting app. i need to exit app just in one tab, for example home