CustomBottomNavBar class
A customizable bottom navigation bar that manages navigation between different pages.
The CustomBottomNavBar widget provides a styled bottom navigation bar that allows users to switch between various pages in the app. It integrates seamlessly with a PageView to handle page transitions and maintains the selected index state.
Example usage:
List<NavigationItem> navItems = [
NavigationItem(
page: HomePage(),
icon: Icon(Icons.home),
label: 'Home',
),
NavigationItem(
page: SearchPage(),
icon: Icon(Icons.search),
label: 'Search',
),
NavigationItem(
page: ProfilePage(),
icon: Icon(Icons.person),
label: 'Profile',
),
];
CustomBottomNavBar(
items: navItems,
backgroundColor: Colors.white,
selectedItemColor: Colors.blue,
unselectedItemColor: Colors.grey,
elevation: 10.0,
type: BottomNavigationBarType.fixed,
);
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- CustomBottomNavBar
Constructors
-
Creates a CustomBottomNavBar with the specified properties.
const
Properties
- backgroundColor → Color?
-
The background color of the bottom navigation bar.
final
- elevation → double?
-
The elevation (shadow depth) of the bottom navigation bar.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- itemPadding → EdgeInsetsGeometry?
-
The padding to apply around each navigation item's icon.
final
-
items
→ List<
NavigationItem> -
A list of NavigationItems to display in the bottom navigation bar.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- margin → EdgeInsetsGeometry?
-
The external margin around the bottom navigation bar.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectedFontSize → double?
-
The font size of the selected item's label.
final
- selectedIconTheme → IconThemeData?
-
The icon theme for the selected navigation item.
final
- selectedItemColor → Color?
-
The color of the selected navigation item.
final
- showSelectedLabels → bool?
-
Whether to show labels for the selected items.
final
- showUnselectedLabels → bool?
-
Whether to show labels for the unselected items.
final
- type → BottomNavigationBarType?
-
The type of the bottom navigation bar.
final
- unselectedFontSize → double?
-
The font size of the unselected items' labels.
final
- unselectedIconTheme → IconThemeData?
-
The icon theme for the unselected navigation items.
final
- unselectedItemColor → Color?
-
The color of the unselected navigation items.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< CustomBottomNavBar> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited