build method

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

Builds the IconTab widget, rendering an IconButton that responds to the current selection state propagated via Pylon.

This method queries the widget tree for the _IsSelectedBottomIndex state using PylonOr to determine if the tab is selected. It then constructs an IconButton with the appropriate icon (selected or default) and applies primary color from ArcaneTheme for visual feedback. The onPressed callback is wired to handle user interactions, facilitating seamless navigation within the Arcane UI ecosystem.

Returns a fully interactive IconButton widget ready for embedding in a ButtonBar.

Implementation

@override
Widget build(BuildContext context) {
  bool selected =
      context.pylonOr<_IsSelectedBottomIndex>()?.selected ?? false;

  return IconButton(
    onPressed: onPressed,
    icon: Icon(selected ? (selectedIcon ?? icon) : icon,
        color: selected ? Theme.of(context).colorScheme.primary : null),
  );
}