ButtonBar constructor
Creates a ButtonBar widget.
The buttons parameter is required and defines the collection of IconTab
instances to render, each handling its own icon and callback logic. The
selectedIndex specifies the active tab (defaults to 0), triggering visual
updates across all tabs via Pylon. This constructor initializes the widget
as const, promoting efficient rebuilding in Flutter's hot reload and runtime
environments. It ensures the bar integrates seamlessly with Arcane's navigation
patterns, such as switching between Section or Tabbed content areas.
Example:
ButtonBar(
selectedIndex: _currentIndex,
buttons: [
IconTab(
icon: Icons.home,
label: "Home",
onPressed: () => setState(() => _currentIndex = 0),
),
IconTab(
icon: Icons.search,
label: "Search",
onPressed: () => setState(() => _currentIndex = 1),
),
],
)
This setup allows for dynamic navigation, where tapping a tab updates the app's state and potentially routes to new Screen implementations.
Implementation
const ButtonBar({super.key, this.selectedIndex = 0, required this.buttons});