UITabBar<T> constructor

UITabBar<T>(
  1. TabContext tab, {
  2. Key? key,
  3. Widget? builder(
    1. BuildContext context,
    2. T item
    )?,
  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. TabBarIndicatorSize? indicatorSize,
  11. Color? labelColor,
  12. TextStyle? labelStyle,
  13. EdgeInsetsGeometry labelPadding = const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
  14. Color? unselectedLabelColor,
  15. TextStyle? unselectedLabelStyle,
  16. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  17. MaterialStateProperty<Color?>? overlayColor,
  18. MouseCursor? mouseCursor,
  19. bool? enableFeedback,
  20. void onTap(
    1. T item
    )?,
  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

UITabBar(
  TabContext tab, {
  Key? key,
  Widget? Function(BuildContext context, T item)? builder,
  bool isScrollable = false,
  Color? indicatorColor,
  bool automaticIndicatorColorAdjustment = true,
  double indicatorWeight = 2.0,
  EdgeInsetsGeometry indicatorPadding = EdgeInsets.zero,
  Decoration? indicator,
  TabBarIndicatorSize? indicatorSize,
  Color? labelColor,
  TextStyle? labelStyle,
  EdgeInsetsGeometry labelPadding =
      const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
  Color? unselectedLabelColor,
  TextStyle? unselectedLabelStyle,
  DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  MaterialStateProperty<Color?>? overlayColor,
  MouseCursor? mouseCursor,
  bool? enableFeedback,
  void Function(T item)? onTap,
  ScrollPhysics? physics,
}) : super(
        tabs: tab.source.mapAndRemoveEmpty((item) {
          if (builder != null) {
            return builder.call(tab._context, item);
          }
          return Text(item.toString());
        }),
        controller: tab.controller,
        key: key,
        isScrollable: isScrollable,
        indicatorColor: indicatorColor,
        automaticIndicatorColorAdjustment: automaticIndicatorColorAdjustment,
        indicatorWeight: indicatorWeight,
        indicatorPadding: indicatorPadding,
        indicator: indicator,
        indicatorSize: indicatorSize,
        labelColor: labelColor,
        labelStyle: labelStyle,
        labelPadding: labelPadding,
        unselectedLabelColor: unselectedLabelColor,
        unselectedLabelStyle: unselectedLabelStyle,
        dragStartBehavior: dragStartBehavior,
        overlayColor: overlayColor,
        mouseCursor: mouseCursor,
        enableFeedback: enableFeedback,
        onTap: onTap != null ? (i) => onTap.call(tab.source[i]) : null,
        physics: physics,
      );