withSFSymbol static method

BottomNavigationBarItem withSFSymbol({
  1. required Widget icon,
  2. required String sfSymbolName,
  3. String? label,
  4. Widget? activeIcon,
  5. String? tooltip,
  6. Color? backgroundColor,
})

Create a BottomNavigationBarItem with SF Symbol metadata for native iOS tab bars

Implementation

static BottomNavigationBarItem withSFSymbol({
  required Widget icon,
  required String sfSymbolName,
  String? label,
  Widget? activeIcon,
  String? tooltip,
  Color? backgroundColor,
}) {
  // Wrap the icon with a key containing the SF Symbol name
  final Widget keyedIcon = KeyedSubtree(
    key: BaseNativeTabBarItemKey(sfSymbolName),
    child: icon,
  );

  return BottomNavigationBarItem(
    icon: keyedIcon,
    activeIcon: activeIcon,
    label: label,
    tooltip: tooltip,
    backgroundColor: backgroundColor,
  );
}