toNavigationDestination method

Column toNavigationDestination(
  1. BuildContext context,
  2. OudsNavigationBarControlState controlState, {
  3. required bool isSelected,
})

Creates the destination widget tree for this OudsNavigationBarItem.

This is intended to be used by OudsNavigationBar on Android with Material. Internally, OudsNavigationBar is backed by the Material 3 NavigationBar and NavigationDestination widgets.

  • context is used to access theme tokens and layout values.
  • controlState drives icon/top-indicator colors according to the current OUDS navigation control state.
  • isSelected indicates whether this destination is currently selected.

Implementation

Column toNavigationDestination(
  BuildContext context,
  OudsNavigationBarControlState controlState, {
  required bool isSelected,
}) {
  final modifier = OudsNavigationBarStatusModifier(context);
  final bar = OudsTheme.of(context).componentsTokens(context).bar;

  return Column(
    mainAxisSize: MainAxisSize.min,
    children: [
      // Top active indicator bar (optional visual indicator for selection)
      _buildTopIndicatorBar(context, bar, isSelected, controlState),
      Flexible(
        child: NavigationDestination(
          label: label,
          icon: _buildBadgeIconNavigationDestination(context, icon, modifier, controlState, badge, isSelected: isSelected),
          selectedIcon: _buildBadgeIconNavigationDestination(context, icon, modifier, controlState, badge, isSelected: isSelected),
        ),
      )
    ],
  );
}