TabPane<T> constructor

const TabPane<T>({
  1. Key? key,
  2. required List<TabPaneData<T>> items,
  3. required TabPaneItemBuilder<T> itemBuilder,
  4. int focused = 0,
  5. required ValueChanged<int> onFocused,
  6. List<Widget> leading = const [],
  7. List<Widget> trailing = const [],
  8. BorderRadiusGeometry? borderRadius,
  9. Color? backgroundColor,
  10. BorderSide? border,
  11. ValueChanged<List<TabPaneData<T>>>? onSort,
  12. required Widget child,
  13. double? barHeight,
})

Creates a TabPane with sortable tabs and integrated content display.

Configures a comprehensive tab interface that combines sortable tab management with a content display area, providing a complete tabbed user interface.

Parameters:

  • key (Key?): Widget identifier for the widget tree
  • items (List<TabPaneData
  • itemBuilder (TabPaneItemBuilder
  • focused (int, default: 0): Index of the currently focused tab
  • onFocused (ValueChanged
  • child (Widget, required): Content widget for the main display area
  • onSort (ValueChanged<List<TabPaneData
  • leading (List
  • trailing (List
  • borderRadius (BorderRadiusGeometry?, optional): Border radius override
  • backgroundColor (Color?, optional): Background color override
  • border (BorderSide?, optional): Border styling override
  • barHeight (double?, optional): Tab bar height override

Example:

TabPane<DocumentTab>(
  items: documentTabs.map(TabPaneData.new).toList(),
  focused: activeDocumentIndex,
  onFocused: switchToDocument,
  onSort: reorderDocuments,
  leading: [IconButton(icon: Icon(Icons.add), onPressed: newDocument)],
  trailing: [IconButton(icon: Icon(Icons.settings), onPressed: showSettings)],
  itemBuilder: (context, item, index) => TabChild(
    child: Row(
      children: [
        Text(item.data.title),
        IconButton(icon: Icon(Icons.close), onPressed: () => closeTab(index)),
      ],
    ),
  ),
  child: DocumentEditor(document: documents[activeDocumentIndex]),
)

Implementation

const TabPane({
  super.key,
  // required this.children,
  required this.items,
  required this.itemBuilder,
  this.focused = 0,
  required this.onFocused,
  this.leading = const [],
  this.trailing = const [],
  this.borderRadius,
  this.backgroundColor,
  this.border,
  this.onSort,
  required this.child,
  this.barHeight,
});