xTabBar method

Widget xTabBar (
  1. {TabController controller,
  2. bool isScrollable = false,
  3. Color indicatorColor,
  4. double indicatorWeight = 2.0,
  5. EdgeInsetsGeometry indicatorPadding = EdgeInsets.zero,
  6. Decoration indicator,
  7. TabBarIndicatorSize indicatorSize,
  8. Color labelColor,
  9. Color unselectedLabelColor,
  10. TextStyle labelStyle,
  11. EdgeInsetsGeometry labelPadding,
  12. TextStyle unselectedLabelStyle,
  13. DragStartBehavior dragStartBehavior,
  14. ValueChanged<int> onTap,
  15. Key key}
)

Implementation

Widget xTabBar(
    {TabController controller,

    /// Whether this tab bar can be scrolled horizontally.
    ///
    /// If [isScrollable] is true, then each tab is as wide as needed for its label
    /// and the entire [TabBar] is scrollable. Otherwise each tab gets an equal
    /// share of the available space.
    bool isScrollable = false,

    /// The color of the line that appears below the selected tab.
    ///
    /// If this parameter is null, then the value of the Theme's indicatorColor
    /// property is used.
    ///
    /// If [indicator] is specified, this property is ignored.
    Color indicatorColor,

    /// The thickness of the line that appears below the selected tab.
    ///
    /// The value of this parameter must be greater than zero and its default
    /// value is 2.0.
    ///
    /// If [indicator] is specified, this property is ignored.
    double indicatorWeight = 2.0,

    /// The horizontal padding for the line that appears below the selected tab.
    ///
    /// For [isScrollable] tab bars, specifying [kTabLabelPadding] will align
    /// the indicator with the tab's text for [Tab] widgets and all but the
    /// shortest [Tab.text] values.
    ///
    /// The [EdgeInsets.top] and [EdgeInsets.bottom] values of the
    /// [indicatorPadding] are ignored.
    ///
    /// The default value of [indicatorPadding] is [EdgeInsets.zero].
    ///
    /// If [indicator] is specified, this property is ignored.
    EdgeInsetsGeometry indicatorPadding = EdgeInsets.zero,

    /// Defines the appearance of the selected tab indicator.
    ///
    /// If [indicator] is specified, the [indicatorColor], [indicatorWeight],
    /// and [indicatorPadding] properties are ignored.
    ///
    /// The default, underline-style, selected tab indicator can be defined with
    /// [UnderlineTabIndicator].
    ///
    /// The indicator's size is based on the tab's bounds. If [indicatorSize]
    /// is [TabBarIndicatorSize.tab] the tab's bounds are as wide as the space
    /// occupied by the tab in the tab bar. If [indicatorSize] is
    /// [TabBarIndicatorSize.label], then the tab's bounds are only as wide as
    /// the tab widget itself.
    Decoration indicator,

    /// Defines how the selected tab indicator's size is computed.
    ///
    /// The size of the selected tab indicator is defined relative to the
    /// tab's overall bounds if [indicatorSize] is [TabBarIndicatorSize.tab]
    /// (the default) or relative to the bounds of the tab's widget if
    /// [indicatorSize] is [TabBarIndicatorSize.label].
    ///
    /// The selected tab's location appearance can be refined further with
    /// the [indicatorColor], [indicatorWeight], [indicatorPadding], and
    /// [indicator] properties.
    TabBarIndicatorSize indicatorSize,

    /// The color of selected tab labels.
    ///
    /// Unselected tab labels are rendered with the same color rendered at 70%
    /// opacity unless [unselectedLabelColor] is non-null.
    ///
    /// If this parameter is null, then the color of the [ThemeData.primaryTextTheme]'s
    /// body2 text color is used.
    Color labelColor,

    /// The color of unselected tab labels.
    ///
    /// If this property is null, unselected tab labels are rendered with the
    /// [labelColor] with 70% opacity.
    Color unselectedLabelColor,

    /// The text style of the selected tab labels.
    ///
    /// If [unselectedLabelStyle] is null, then this text style will be used for
    /// both selected and unselected label styles.
    ///
    /// If this property is null, then the text style of the
    /// [ThemeData.primaryTextTheme]'s body2 definition is used.
    TextStyle labelStyle,

    /// The padding added to each of the tab labels.
    ///
    /// If this property is null, then kTabLabelPadding is used.
    EdgeInsetsGeometry labelPadding,

    /// The text style of the unselected tab labels
    ///
    /// If this property is null, then the [labelStyle] value is used. If [labelStyle]
    /// is null, then the text style of the [ThemeData.primaryTextTheme]'s
    /// body2 definition is used.
    TextStyle unselectedLabelStyle,

    /// {@macro flutter.widgets.scrollable.dragStartBehavior}
    DragStartBehavior dragStartBehavior,

    /// An optional callback that's called when the [TabBar] is tapped.
    ///
    /// The callback is applied to the index of the tab where the tap occurred.
    ///
    /// This callback has no effect on the default handling of taps. It's for
    /// applications that want to do a little extra work when a tab is tapped,
    /// even if the tap doesn't change the TabController's index. TabBar [onTap]
    /// callbacks should not make changes to the TabController since that would
    /// interfere with the default tap handler.
    ValueChanged<int> onTap,
    Key key}) {
  return TabBar(
    tabs: this,
    controller: controller,
    dragStartBehavior: dragStartBehavior,
    indicator: indicator,
    indicatorColor: indicatorColor,
    indicatorPadding: indicatorPadding,
    indicatorSize: indicatorSize,
    indicatorWeight: indicatorWeight,
    isScrollable: isScrollable,
    key: key,
    labelColor: labelColor,
    labelPadding: labelPadding,
    labelStyle: labelStyle,
    onTap: onTap,
    unselectedLabelColor: unselectedLabelColor,
    unselectedLabelStyle: unselectedLabelStyle,
  );
}