IconTab constructor

const IconTab({
  1. Key? key,
  2. required IconData icon,
  3. IconData? selectedIcon,
  4. String? label,
  5. VoidCallback? onPressed,
})

Creates an IconTab for use in a ButtonBar.

The icon parameter is required and specifies the base icon for the tab, which displays in the unselected state and falls back for selected if selectedIcon is not provided. The selectedIcon allows customization of the highlighted appearance. The label provides semantic information for screen readers, enhancing accessibility in compliance with Arcane's inclusive design principles. The onPressed callback enables navigation or state updates, typically integrating with a parent ButtonBar's selection logic to switch between app sections.

Example usage within a ButtonBar:

IconTab(
  icon: Icons.home,
  selectedIcon: Icons.home_outlined,
  label: 'Home',
  onPressed: () => _navigateToHome(),
)

This constructor initializes the widget as const for performance optimization in Flutter's widget tree.

Implementation

const IconTab(
    {super.key,
    required this.icon,
    this.selectedIcon,
    this.label,
    this.onPressed});