AdaptiveBottomNavigation class

A widget that displays an adaptive bottom navigation bar depending on the platform.

The icons, pages, and labels parameters must not be null. The iconSize, backgroundColor, selectedColor, unselectedColor, animationDuration, animationIndicatorCurve, animationIconCurve, indicatorDecoration, itemDecoration, bottomNavigationDecoration, height, indicatorHeight, and indicatorSpaceBottom parameters control the appearance and behavior of the bottom navigation bar.

Example usage:

AdaptiveBottomNavigation(
  icons: [Icons.home, Icons.search, Icons.person],
  labels: ['Home', 'Search', 'Profile'],
  pages: [HomePage(), SearchPage(), ProfilePage()],
  selectedColor: Colors.blue,
  unselectedColor: Colors.grey,
  backgroundColor: Colors.white,
  iconSize: 30.0,
  animationDuration: Duration(milliseconds: 300),
  animationIndicatorCurve: Curves.easeIn,
  animationIconCurve: Curves.easeOut,
  indicatorDecoration: BoxDecoration(
    color: Colors.blue,
    borderRadius: BorderRadius.circular(10),
  ),
  itemDecoration: BoxDecoration(
    border: Border(
      top: BorderSide(color: Colors.grey, width: 0.5),
    ),
  ),
  bottomNavigationDecoration: BoxDecoration(
    boxShadow: [BoxShadow(color: Colors.black12, blurRadius: 10)],
  ),
  height: 60.0,
  indicatorHeight: 4.0,
  indicatorSpaceBottom: 2.0,
);
Inheritance

Constructors

AdaptiveBottomNavigation({Key? key, double iconSize = 24.0, required List<IconData> icons, required List<String> labels, required List<Widget> pages, Color selectedColor = Colors.black, Color unselectedColor = Colors.black38, Color backgroundColor = Colors.white, Duration animationDuration = const Duration(milliseconds: 300), Curve animationIndicatorCurve = Curves.easeIn, Curve animationIconCurve = Curves.easeOut, BoxDecoration? indicatorDecoration, BoxDecoration? itemDecoration, BoxDecoration? bottomNavigationDecoration, double height = 60.0, double indicatorHeight = 4.0, double indicatorSpaceBottom = 2.0})
Creates an AdaptiveBottomNavigation.
const

Properties

animationDuration Duration
The duration of the animation when switching tabs.
final
animationIconCurve Curve
The curve for the icon animation.
final
animationIndicatorCurve Curve
The curve for the indicator animation.
final
backgroundColor Color
The background color of the navigation bar.
final
bottomNavigationDecoration BoxDecoration?
The decoration for the entire bottom navigation bar.
final
controller AdaptiveBottomNavigationController
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
height double
The height of the navigation bar.
final
icons List<IconData>
The list of icons to display in the navigation bar.
final
iconSize double
The size of the icons in the navigation bar.
final
indicatorDecoration BoxDecoration?
The decoration for the indicator.
final
indicatorHeight double
The height of the indicator.
final
indicatorSpaceBottom double
The space between the indicator and the bottom of the navigation bar.
final
itemDecoration BoxDecoration?
The decoration for each item in the navigation bar.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
labels List<String>
The list of labels corresponding to each icon.
final
pages List<Widget>
The list of pages corresponding to each navigation item.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedColor Color
The color of the selected icon.
final
tag String?
finalinherited
unselectedColor Color
The color of the unselected icons.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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