Last active
June 22, 2019 10:17
-
-
Save DaniyarGilimov/a90165b888d612d1e828cd73889ccf0f to your computer and use it in GitHub Desktop.
RootPage where located bottomNavigationBar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RootPage extends StatefulWidget { | |
@override | |
State<StatefulWidget> createState() { | |
return _RootPage(); | |
} | |
} | |
class _RootPage extends State<RootPage> { | |
int _currentIndex = 0; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: SafeArea( | |
child: _tabs[context ,_currentIndex], | |
), | |
bottomNavigationBar: BottomNavigationBar( | |
type: BottomNavigationBarType.fixed, | |
onTap: (index) => setState(() => _currentIndex = index), | |
currentIndex: _currentIndex, | |
items: <BottomNavigationBarItem>[ | |
//all BottomNavigationBarItem | |
], | |
), | |
); | |
} | |
} | |
Widget _tabs(BuildContext rootContext, int _tabIndex){ | |
switch (_tabIndex) { | |
case 0: | |
return MainTabOrDetailPage(rootContext); | |
break; | |
case 1: | |
return OtherTab(); | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment