How do I adapt the Cupertino TabBar to work in the same way as the BottomNavigationBar?
BottomNavigationBar
return Scaffold(
bottomNavigationBar: _bottomNavigationBar(_selectedIndex),
body: PageStorage(
child: pages[_selectedIndex],
bucket: bucket,
Cupertino TabBar
final PageStorageBucket bucket = PageStorageBucket();
int _selectedIndex = 1;
Widget _tabBar(int selectedIndex) => CupertinoTabBar(
onTap: (int index) => setState(() => _selectedIndex = index),
currentIndex: selectedIndex,
backgroundColor: Color(0xffffffff),
iconSize: 20,
items: ...
@override
Widget build(BuildContext context) {
return CupertinoTabScaffold(
tabBuilder: _tabBar(_selectedIndex),
child: PageStorage(
child: pages[_selectedIndex],
bucket: bucket,
User contributions licensed under CC BY-SA 3.0