toBottomNavigationBarItem method
Creates a BottomNavigationBarItem for this OudsNavigationBarItem.
This is intended to be used by OudsTabBar, which is backed by Cupertino's CupertinoTabBar (iOS-style tab bar) and therefore expects a list of BottomNavigationBarItem.
Semantics for VoiceOver are intentionally not set here.
They are managed at the OudsTabBar level via a Stack overlay of
transparent Semantics widgets positioned over each tab item, so that
VoiceOver sees exactly one node per tab announcing:
"Label, badge, Tab X of Y".
context: BuildContext to access theme and layout.controlStateto drive icon/top-indicator colors.isSelectedfor the destination selection state.indexzero-based position of this item in the tab bar.externalControlleroptional AnimationController managed by the parent OudsTabBar to survive tab rebuilds on iOS.
Implementation
BottomNavigationBarItem toBottomNavigationBarItem(
BuildContext context,
OudsNavigationBarControlState controlState, {
required bool isSelected,
required int index,
AnimationController? externalController,
}) {
final modifier = OudsNavigationBarStatusModifier(context);
// Build the raw icon widget.
// All semantics are suppressed here — VoiceOver nodes are managed by
// the OudsTabBar Stack overlay to guarantee a single node per tab.
final iconWidget = ExcludeSemantics(
child: _buildBadgeIconBottomNavigationBarItem(
context,
icon,
modifier,
controlState,
badge,
isSelected: isSelected,
index: index,
externalController: externalController,
),
);
return BottomNavigationBarItem(
// Keep the real label for visual display under the icon.
label: label,
// All semantics suppressed — managed by OudsTabBar Stack overlay.
icon: iconWidget,
activeIcon: iconWidget,
);
}