persistent_bottom_nav_bar 0.0.2
persistent_bottom_nav_bar: ^0.0.2 copied to clipboard
A feature rich persistent bottom navigation bar for flutter
persistent_bottom_nav_bar #
A persistent bottom navigation bar for Flutter.
Features #
- Persistent Bottom Navigation Bar.
- Ability to push new screens with or without bottom navigation bar.
- 8 styles for the bottom navigation bar (includes BottomNavyBar style).
- Includes functions for pushing screen with or without the bottom navigation bar i.e. pushNewScreen() and pushNewScreenWithRouteSettings().
- Includes platform specific behavior as an option (specify it in the two navigator functions).
- Based on flutter's Cupertino(iOS) bottom navigation bar.
Example #
Persistent bottom navigation bar uses PersistentTabController
as its controller. Here is how to declare it:
PersistentTabController _controller;
_controller = PersistentTabController(initialIndex: 0);
The main widget then to be declared is PersistenTabView
. NOTE: This widget includes SCAFFOLD (based on CupertinoTabScaffold
), so no need to declare it. Following is an example for demonstration purposes:
class MyApp extends StatelessWidget {
const MyApp({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return PersistentTabView(
controller: _controller,
items: _navBarsItems(),
screens: _buildScreens(),
showElevation: true,
isCurved: false,
iconSize: 26.0,
navBarStyle: NavBarStyle.style1, // Choose the nav bar style with this property
onItemSelected: (index) {
print(index);
},
);
}
}
List<Widget> _buildScreens() {
return [
HomeScreen(),
SettingsScreen()
];
}
List<PersistentBottomNavBarItem> _navBarsItems() {
return [
PersistentBottomNavBarItem(
icon: Icon(CupertinoIcons.home),
title: ("Home"),
activeColor: CupertinoColors.activeBlue,
inactiveColor: CupertinoColors.grey,
),
PersistentBottomNavBarItem(
icon: Icon(CupertinoIcons.settings),
title: ("Settings"),
activeColor: CupertinoColors.activeBlue,
inactiveColor: CupertinoColors.grey,
),
];
}