Для первой вкладки: у меня есть кнопка выхода из системы на экране DispayMoreScreen. А для действия кнопки «Выход» приложение правильно перемещается в корневой каталог приложения.
Navigator.of(context).pushReplacementNamed('/')
Tabbar с работающей навигацией:
@override
Widget build(BuildContext context) {
return new Scaffold(
bottomNavigationBar: new Material(
color: Colors.white,
child: new TabBar(controller: controller, labelColor: Colors.blue[900], tabs: <Tab>[
new Tab(icon: new Icon(Icons.local_shipping, color: Colors.blue[900], size: 30.0), text: 'A'),
new Tab(icon: new Icon(Icons.insert_drive_file, color: Colors.blue[900], size: 30.0), text: 'B'),
new Tab(icon: new Icon(Icons.more_horiz, color: Colors.blue[900], size: 30.0), text: 'C'),
])),
body: new TabBarView(controller: controller, children: <Widget>[
new ShipmentScreen.ShipmentTab(),
new InvoiceScreen.InvoiceTab(),
new DisplayMoreScreen.MoreTab(),
])
);
}
Но когда я реализую CupertinoTabBar, приложение после выхода из системы остается на том же экране.
@override
Widget build(BuildContext context) {
return new CupertinoTabScaffold(
tabBar: new CupertinoTabBar(
backgroundColor: Colors.white,
activeColor: Colors.blue[900],
items: [
new BottomNavigationBarItem(
icon: new Icon(Icons.local_shipping),
title: new Text("A")
),
new BottomNavigationBarItem(
icon: new Icon(Icons.insert_drive_file),
title: new Text("B")
),
new BottomNavigationBarItem(
icon: new Icon(Icons.more_horiz),
title: new Text("C")
)
]
),
tabBuilder: (BuildContext context, int index) {
return new CupertinoTabView(
builder: (BuildContext context) {
switch(index) {
case 0:
return new ShipmentScreen.ShipmentTab();
case 1:
return new InvoiceScreen.InvoiceTab();
case 2:
return new DisplayMoreScreen.MoreTab();
}
},
);
}