TabBar constructor

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

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({
  Key? key,
  required this.tabs,
  this.controller,
  this.isScrollable = false,
  this.indicatorColor,
  this.automaticIndicatorColorAdjustment = true,
  this.indicatorWeight = 2.0,
  this.indicatorPadding = EdgeInsets.zero,
  this.indicator,
  required this.indicatorSize,
  this.labelColor,
  this.labelStyle,
  this.labelPadding,
  this.unselectedLabelColor,
  this.unselectedLabelStyle,
  this.dragStartBehavior = DragStartBehavior.start,
  this.overlayColor,
  this.mouseCursor,
  this.enableFeedback,
  this.onTap,
  this.physics,
  // ignore: unnecessary_null_comparison
})  : assert(dragStartBehavior != null),
      assert(indicator != null || (indicatorWeight > 0.0)),
      // ignore: unnecessary_null_comparison
      assert(indicator != null || (indicatorPadding != null)),
      super(key: key);