Tabbed constructor

const Tabbed({
  1. Key? key,
  2. required Map<dynamic, Widget> tabs,
  3. bool indexedStack = true,
  4. int initialIndex = 0,
  5. CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.start,
  6. MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start,
  7. MainAxisSize mainAxisSize = MainAxisSize.min,
  8. VerticalDirection tabPlacement = VerticalDirection.up,
  9. double gap = 8,
  10. Stream<int>? indexController,
})

Creates a Tabbed widget with the specified tabs and configuration.

The tabs parameter is a map where keys represent tab labels (accepting TabChild, String, or Widget, which are converted to TabItem if needed) and values are the corresponding content widgets displayed when the tab is selected. indexedStack determines whether to use IndexedStack (true, default) to maintain state across tab switches or show only the active child (false) for performance in simple cases. initialIndex sets the starting tab (default 0). indexController is an optional stream for external control of the active index, enabling reactive updates from parent widgets or services. Layout properties like crossAxisAlignment, mainAxisAlignment, mainAxisSize, tabPlacement (up for tabs above content, down for below), and gap (spacing between tabs and content, default 8) allow precise arrangement within the Column structure. If tabs is empty, renders an empty Container; if single tab, shows only the content directly.

Implementation

const Tabbed(
    {super.key,
    required this.tabs,
    this.indexedStack = true,
    this.initialIndex = 0,
    this.crossAxisAlignment = CrossAxisAlignment.start,
    this.mainAxisAlignment = MainAxisAlignment.start,
    this.mainAxisSize = MainAxisSize.min,
    this.tabPlacement = VerticalDirection.up,
    this.gap = 8,
    this.indexController});