GlassBottomBar constructor

const GlassBottomBar({
  1. required List<GlassBottomBarTab> tabs,
  2. required int selectedIndex,
  3. required ValueChanged<int> onTabSelected,
  4. Key? key,
  5. GlassTabBarExtraButton? extraButton,
  6. GlassBottomBarCollapseConfig? collapseConfig,
  7. double spacing = 8,
  8. double horizontalPadding = 20,
  9. double verticalPadding = 20,
  10. double barHeight = 64,
  11. double barBorderRadius = _defaultBarBorderRadius,
  12. EdgeInsetsGeometry tabPadding = const EdgeInsets.symmetric(horizontal: 4),
  13. double iconLabelSpacing = 4,
  14. bool enableBlend = true,
  15. double blendAmount = 10,
  16. LiquidGlassSettings? settings,
  17. bool showIndicator = true,
  18. Color? indicatorColor,
  19. LiquidGlassSettings? indicatorSettings,
  20. double indicatorPinchStrength = 0.4,
  21. Color? selectedIconColor,
  22. Color? unselectedIconColor,
  23. Color? selectedLabelColor,
  24. Color? unselectedLabelColor,
  25. TextStyle? selectedLabelStyle,
  26. TextStyle? unselectedLabelStyle,
  27. double iconSize = 24,
  28. double labelFontSize = 11,
  29. TextStyle? textStyle,
  30. Duration glowDuration = const Duration(milliseconds: 300),
  31. double glowBlurRadius = 32,
  32. double glowSpreadRadius = 8,
  33. double glowOpacity = 0.6,
  34. GlassQuality? quality,
  35. double magnification = 1.15,
  36. double innerBlur = 0.0,
  37. MaskingQuality maskingQuality = MaskingQuality.high,
  38. GlobalKey<State<StatefulWidget>>? backgroundKey,
  39. double? tabWidth,
  40. double? indicatorBorderRadius,
  41. EdgeInsetsGeometry indicatorExpansion = const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
  42. Color? interactionGlowColor,
  43. double interactionGlowRadius = 1.5,
  44. GlassInteractionBehavior interactionBehavior = GlassInteractionBehavior.full,
  45. double pressScale = 1.04,
  46. bool platformViewBackdrop = false,
  47. bool adaptiveBrightness = false,
  48. ValueChanged<Brightness>? onBrightnessChanged,
  49. ValueListenable<Brightness>? brightnessOverride,
  50. ScrollController? scrollController,
})

Creates a glass bottom navigation bar.

Implementation

const GlassBottomBar({
  required this.tabs,
  required this.selectedIndex,
  required this.onTabSelected,
  super.key,
  this.extraButton,
  this.collapseConfig,
  this.spacing = 8,
  this.horizontalPadding = 20,
  this.verticalPadding = 20,
  this.barHeight = 64,
  this.barBorderRadius = _defaultBarBorderRadius,
  this.tabPadding = const EdgeInsets.symmetric(horizontal: 4),
  this.iconLabelSpacing = 4,
  this.enableBlend = true,
  this.blendAmount = 10,
  this.settings,
  this.showIndicator = true,
  this.indicatorColor,
  this.indicatorSettings,
  this.indicatorPinchStrength = 0.4,
  this.selectedIconColor,
  this.unselectedIconColor,
  this.selectedLabelColor,
  this.unselectedLabelColor,
  this.selectedLabelStyle,
  this.unselectedLabelStyle,
  this.iconSize = 24,
  this.labelFontSize = 11,
  this.textStyle,
  this.glowDuration = const Duration(milliseconds: 300),
  this.glowBlurRadius = 32,
  this.glowSpreadRadius = 8,
  this.glowOpacity = 0.6,
  this.quality,
  this.magnification = 1.15,
  this.innerBlur = 0.0,
  this.maskingQuality = MaskingQuality.high,
  this.backgroundKey,
  this.tabWidth,
  this.indicatorBorderRadius,
  this.indicatorExpansion =
      const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
  this.interactionGlowColor,
  this.interactionGlowRadius = 1.5,
  this.interactionBehavior = GlassInteractionBehavior.full,
  this.pressScale = 1.04,
  this.platformViewBackdrop = false,
  this.adaptiveBrightness = false,
  this.onBrightnessChanged,
  this.brightnessOverride,
  this.scrollController,
})  : assert(tabs.length > 0, 'GlassBottomBar requires at least one tab'),
      assert(
        selectedIndex >= 0 && selectedIndex < tabs.length,
        'selectedIndex must be between 0 and tabs.length - 1',
      ),
      assert(
        collapseConfig == null || extraButton != null,
        'GlassBottomBar.collapseConfig requires extraButton.',
      ),
      assert(
        tabWidth == null || tabWidth > 0,
        'tabWidth must be positive, or null to use expand (full-width) mode.',
      );