πŸš€ DevOps Certified Professional
πŸ“… Starting: 1st of Every Month 🀝 +91 8409492687 | 🀝 +1 (469) 756-6329 πŸ” Contact@DevOpsSchool.com

Flutter Bottom Navigation Bar

DevOpsFlutter

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Flutter Bottom Navigation View - AndroidCoding.in

In your main.dart First return a MaterialApp in your build method

@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Professnow',
home: MyBottomNavigationButton(),
routes: <String, WidgetBuilder>{
'/home': (BuildContext context) => Homepage(),
'/profile': (BuildContext context) => Profile(),
'/account': (BuildContext context) => Account(),
'/details': (BuildContext context) => CurrentBookingDetails(),
},
);
}
view raw bottomNavigation.dart hosted with ❀ by GitHub

In the next page or on the same page initialize a new stateful widget with the same name you assigned in your body of the MaterialApp

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'),
)
],
),
);
}
}
view raw bottomNavigation.dart hosted with ❀ by GitHub