buildByMaterial method

  1. @override
Widget buildByMaterial(
  1. BuildContext context
)

build on material mode

Implementation

@override
Widget buildByMaterial(BuildContext context) {
  final useMaterial3 = valueOf('useMaterial3Navigation', useMaterial3Navigation);

  if (useMaterial3) {
    // Use Material 3 NavigationBar for modern design
    Widget navigationBar = NavigationBar(
      destinations: _convertToNavigationDestinations(),
      onDestinationSelected: _handleTap,
      selectedIndex: valueOf('currentIndex', currentIndex),
      backgroundColor: valueOf('backgroundColor', backgroundColor),
      elevation: valueOf('elevation', elevation),
      height: valueOf('height', height),
      labelBehavior: _getLabelBehavior(),
    );

    if (valueOf('enableLiquidGlass', enableLiquidGlass)) {
      return _wrapWithLiquidGlass(context, navigationBar);
    }

    return navigationBar;
  } else {
    // Use legacy BottomNavigationBar for backward compatibility
    Widget bottomNavBar = BottomNavigationBar(
      items: valueOf('items', items),
      onTap: _handleTap,
      currentIndex: valueOf('currentIndex', currentIndex),
      type: valueOf('type', type),
      backgroundColor: valueOf('backgroundColor', backgroundColor),
      selectedItemColor: valueOf('selectedItemColor', selectedItemColor),
      unselectedItemColor: valueOf('unselectedItemColor', unselectedItemColor),
      selectedFontSize: valueOf('selectedFontSize', selectedFontSize),
      unselectedFontSize: valueOf('unselectedFontSize', unselectedFontSize),
      iconSize: valueOf('iconSize', iconSize),
      elevation: valueOf('elevation', elevation),
      showSelectedLabels: valueOf('showSelectedLabels', showSelectedLabels),
      showUnselectedLabels: valueOf('showUnselectedLabels', showUnselectedLabels),
      mouseCursor: valueOf('mouseCursor', mouseCursor),
      enableFeedback: valueOf('enableFeedback', enableFeedback),
      landscapeLayout: valueOf('landscapeLayout', landscapeLayout),
      useLegacyColorScheme: valueOf('useLegacyColorScheme', useLegacyColorScheme),
    );

    if (valueOf('enableLiquidGlass', enableLiquidGlass)) {
      return _wrapWithLiquidGlass(context, bottomNavBar);
    }

    return bottomNavBar;
  }
}