TabBar constructor

const TabBar({
  1. Key? key,
  2. required List<Widget> tabs,
  3. TabController? controller,
  4. bool isScrollable = false,
  5. EdgeInsetsGeometry? padding,
  6. Color? indicatorColor,
  7. bool automaticIndicatorColorAdjustment = true,
  8. double indicatorWeight = 2.0,
  9. EdgeInsetsGeometry indicatorPadding = EdgeInsets.zero,
  10. Decoration? indicator,
  11. TabBarIndicatorSize? indicatorSize,
  12. Color? dividerColor,
  13. Color? labelColor,
  14. TextStyle? labelStyle,
  15. EdgeInsetsGeometry? labelPadding,
  16. Color? unselectedLabelColor,
  17. TextStyle? unselectedLabelStyle,
  18. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  19. MaterialStateProperty<Color?>? overlayColor,
  20. MouseCursor? mouseCursor,
  21. bool? enableFeedback,
  22. ValueChanged<int>? onTap,
  23. ScrollPhysics? physics,
  24. InteractiveInkFeatureFactory? splashFactory,
  25. BorderRadius? splashBorderRadius,
})

Creates a Material Design tab bar.

The tabs argument must not be null and its length must match the controller's TabController.length.

If a TabController is not provided, then there must be a DefaultTabController ancestor.

The indicatorWeight parameter defaults to 2, and must not be null.

The indicatorPadding parameter defaults to EdgeInsets.zero, and must not be null.

If indicator is not null or provided from TabBarTheme, then indicatorWeight, indicatorPadding, and indicatorColor are ignored.

Implementation

const TabBar({
  super.key,
  required this.tabs,
  this.controller,
  this.isScrollable = false,
  this.padding,
  this.indicatorColor,
  this.automaticIndicatorColorAdjustment = true,
  this.indicatorWeight = 2.0,
  this.indicatorPadding = EdgeInsets.zero,
  this.indicator,
  this.indicatorSize,
  this.dividerColor,
  this.labelColor,
  this.labelStyle,
  this.labelPadding,
  this.unselectedLabelColor,
  this.unselectedLabelStyle,
  this.dragStartBehavior = DragStartBehavior.start,
  this.overlayColor,
  this.mouseCursor,
  this.enableFeedback,
  this.onTap,
  this.physics,
  this.splashFactory,
  this.splashBorderRadius,
})  : assert(tabs != null),
      assert(isScrollable != null),
      assert(dragStartBehavior != null),
      assert(indicator != null ||
          (indicatorWeight != null && indicatorWeight > 0.0)),
      assert(indicator != null || (indicatorPadding != null));