Skip to main content
The Stac TabBar allows you to build a Flutter TabBar widget using JSON. To know more about the TabBar widget in Flutter, refer to the official documentation.

Properties

PropertyTypeDescription
tabsList<StacWidget>The tabs to display in the tab bar.
initialIndexintThe initial index of the selected tab. Defaults to 0.
isScrollableboolWhether the tab bar is scrollable. Defaults to false.
paddingStacEdgeInsetsThe padding for the tab bar.
indicatorColorStacColorThe color of the tab indicator.
automaticIndicatorColorAdjustmentboolWhether to automatically adjust the indicator color. Defaults to true.
indicatorWeightdoubleThe thickness of the tab indicator. Defaults to 2.0.
indicatorPaddingStacEdgeInsetsThe padding for the tab indicator.
indicatorStacBoxDecorationThe decoration for the tab indicator.
indicatorSizeStacTabBarIndicatorSizeThe size of the tab indicator.
labelColorStacColorThe color of the selected tab label.
labelStyleStacTextStyleThe text style of the selected tab label.
labelPaddingStacEdgeInsetsThe padding for the selected tab label.
unselectedLabelColorStacColorThe color of the unselected tab labels.
unselectedLabelStyleStacTextStyleThe text style of the unselected tab labels.
dragStartBehaviorStacDragStartBehaviorThe drag start behavior. Defaults to DragStartBehavior.start.
enableFeedbackboolWhether to enable feedback for taps.
physicsStacScrollPhysicsThe scroll physics for the tab bar.
tabAlignmentStacTabAlignmentThe alignment of the tabs.

DefaultTabController

The Stac DefaultTabController allows you to build a Flutter DefaultTabController widget using JSON. To know more about the DefaultTabController widget in Flutter, refer to the official documentation.

Properties

PropertyTypeDescription
lengthintThe number of tabs.
initialIndexintThe initial index of the selected tab. Defaults to 0.
childStacWidgetThe widget below this widget in the tree.

Tab

The Stac Tab allows you to build a Flutter Tab widget using JSON. To know more about the Tab widget in Flutter, refer to the official documentation.

Properties

PropertyTypeDescription
textStringThe text to display in the tab.
iconStacWidgetThe icon to display in the tab.
iconMarginStacEdgeInsetsThe margin around the icon.
heightdoubleThe height of the tab.
childStacWidgetThe widget below this widget in the tree.

TabBarView

The Stac TabBarView allows you to build a Flutter TabBarView widget using JSON. To know more about the TabBarView widget in Flutter, refer to the official documentation.

Properties

PropertyTypeDescription
childrenList<StacWidget>The widgets to display in each tab.
initialIndexintThe initial index of the selected tab. Defaults to 0.
dragStartBehaviorStacDragStartBehaviorThe drag start behavior. Defaults to DragStartBehavior.start.
physicsStacScrollPhysicsThe scroll physics for the tab bar view.
viewportFractiondoubleThe fraction of the viewport that each page should occupy. Defaults to 1.0.
clipBehaviorStacClipThe clip behavior. Defaults to Clip.hardEdge.

Example

StacDefaultTabController(
  length: 3,
  child: StacScaffold(
    appBar: StacAppBar(
      title: StacText(data: 'Tabbar'),
      bottom: StacTabBar(
        tabs: [
          StacTab(text: 'Red'),
          StacTab(text: 'Red'),
          StacTab(text: 'Red'),
        ],
      ),
    ),
    body: StacTabBarView(
      children: [
        StacContainer(color: StacColors.grey),
        StacContainer(color: StacColors.orange),
        StacContainer(color: StacColors.grey),
      ],
    ),
  ),
)