tabs static method

TFormField tabs({
  1. required List<TFormTab> tabs,
  2. Axis axis = Axis.horizontal,
  3. TFormType? formType,
  4. String? label,
  5. String? description,
  6. IconData? icon,
  7. bool initiallyExpanded = false,
  8. TTabController? controller,
  9. dynamic initialValue,
  10. ValueChanged? onTabChanged,
  11. double? tabWidth,
  12. bool scrollable = false,
  13. bool showNavigationButtons = true,
  14. bool inline = false,
  15. bool wrap = false,
  16. EdgeInsets? tabPadding,
  17. double tabSpacing = 2,
  18. double? indicatorWidth,
  19. Color? selectedColor,
  20. Color? unselectedColor,
  21. Color? indicatorColor,
  22. Color? borderColor,
  23. Widget tabBuilder(
    1. BuildContext,
    2. TTab,
    3. bool,
    4. VoidCallback? ,
    )?,
  24. double gapX = 16.0,
  25. double gapY = 26.0,
  26. Widget? footer,
})

Creates a sub-form field rendered with tabs using TTabs.

Supports both Axis.horizontal and Axis.vertical tab layouts.

Example:

TFormField.tabs(
  tabs: [
    TFormTab(
      title: 'General',
      icon: Icons.info,
      input: GeneralForm(),
    ),
    TFormTab(
      title: 'Security',
      icon: Icons.security,
      fields: [
        TFormField.text(password, 'Password'),
      ],
    ),
  ],
  axis: Axis.horizontal,
)

Implementation

static TFormField<dynamic> tabs({
  required List<TFormTab> tabs,
  Axis axis = Axis.horizontal,
  TFormType? formType,
  String? label,
  String? description,
  IconData? icon,
  bool initiallyExpanded = false,
  TTabController<dynamic>? controller,
  dynamic initialValue,
  ValueChanged<dynamic>? onTabChanged,
  double? tabWidth,
  bool scrollable = false,
  bool showNavigationButtons = true,
  bool inline = false,
  bool wrap = false,
  EdgeInsets? tabPadding,
  double tabSpacing = 2,
  double? indicatorWidth,
  Color? selectedColor,
  Color? unselectedColor,
  Color? indicatorColor,
  Color? borderColor,
  Widget Function(BuildContext, TTab<dynamic>, bool, VoidCallback?)? tabBuilder,
  double gapX = 16.0,
  double gapY = 26.0,
  Widget? footer,
}) {
  return TFormField<dynamic>(
    isSubForm: true,
    builder: (onValueChanged) => TFormBuilder(
      tabs: tabs,
      tabAxis: axis,
      formType: formType,
      label: label,
      description: description,
      icon: icon,
      initiallyExpanded: initiallyExpanded,
      tabController: controller,
      initialTabValue: initialValue,
      onTabChanged: onTabChanged,
      tabWidth: tabWidth,
      scrollableTabs: scrollable,
      showTabNavigationButtons: showNavigationButtons,
      tabInline: inline,
      tabWrap: wrap,
      tabPadding: tabPadding,
      tabSpacing: tabSpacing,
      tabIndicatorWidth: indicatorWidth,
      tabSelectedColor: selectedColor,
      tabUnselectedColor: unselectedColor,
      tabIndicatorColor: indicatorColor,
      tabBorderColor: borderColor,
      tabBuilder: tabBuilder,
      gapX: gapX,
      gapY: gapY,
      footer: footer,
      onValueChanged: () {
        onValueChanged(null);
      },
    ),
  );
}