Skip to content

Instantly share code, notes, and snippets.

@pradeeprjth
Created August 5, 2021 10:16
Show Gist options
  • Save pradeeprjth/2327bdb26e8af5170e208d141e6e2f9e to your computer and use it in GitHub Desktop.
Save pradeeprjth/2327bdb26e8af5170e208d141e6e2f9e to your computer and use it in GitHub Desktop.
class MyBottomNavigationButton extends StatefulWidget {
@override
_MyBottomNavigationButtonState createState() =>
_MyBottomNavigationButtonState();
}
class _MyBottomNavigationButtonState extends State<MyBottomNavigationButton> {
int _currentIndex = 0;
final List<Widget> _children = [
MyHomePage(),
Account(),
Profile()
];
@override
Widget build(BuildContext context) {
return Scaffold(
body: _children[_currentIndex],
bottomNavigationBar: BottomNavigationBar(
// type: BottomNavigationBarType.fixed,
onTap: onTapBar,
currentIndex: _currentIndex,
items: [
BottomNavigationBarItem(
icon: Icon(Icons.home),
// ignore: deprecated_member_use
title: Text('MyHomePage'),
),
BottomNavigationBarItem(
icon: Icon(Icons.library_books_rounded),
// ignore: deprecated_member_use
title: Text('Account'),
),
BottomNavigationBarItem(
icon: Icon(Icons.account_circle),
// ignore: deprecated_member_use
title: Text('Profile'),
)
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment