TxArrayFormField<T>.builder constructor

TxArrayFormField<T>.builder({
  1. required ArrayFormFieldItemBuilder<T> itemBuilder,
  2. ValueMapper<int, T>? defaultValue,
  3. ButtonStyle? addButtonStyle,
  4. ButtonStyle? actionsButtonStyle,
  5. int? limit,
  6. bool? sortable,
  7. bool? insertable,
  8. ArrayAddCallback<T>? onAddTap,
  9. FocusNode? focusNode,
  10. String? hintText,
  11. TextAlign? textAlign,
  12. Key? key,
  13. FormFieldSetter<List<T>>? onSaved,
  14. FormFieldValidator<List<T>>? validator,
  15. List<T>? initialValue,
  16. bool? enabled,
  17. AutovalidateMode? autovalidateMode = AutovalidateMode.onUserInteraction,
  18. String? restorationId,
  19. InputDecoration? decoration,
  20. ValueChanged<List<T>?>? onChanged,
  21. bool? required,
  22. Widget? label,
  23. String? labelText,
  24. TextAlign? labelTextAlign,
  25. TextOverflow? labelOverflow,
  26. EdgeInsetsGeometry? padding,
  27. FieldActionsBuilder<List<T>>? actionsBuilder,
  28. TextStyle? labelStyle,
  29. double? horizontalGap,
  30. Color? tileColor,
  31. Axis? layoutDirection,
  32. TxFormFieldBuilder<List<T>>? trailingBuilder,
  33. Widget? leading,
  34. VisualDensity? visualDensity,
  35. ShapeBorder? shape,
  36. Color? iconColor,
  37. Color? textColor,
  38. TextStyle? leadingAndTrailingTextStyle,
  39. GestureTapCallback? onTap,
  40. double? minLeadingWidth,
  41. bool? dense,
  42. bool? colon,
  43. double? minLabelWidth,
  44. Color? focusColor,
  45. double? minVerticalPadding,
})

通过自增子项构造一个自增 Form 组件

Implementation

TxArrayFormField.builder({
  required ArrayFormFieldItemBuilder<T> itemBuilder,
  ValueMapper<int, T>? defaultValue,
  ButtonStyle? addButtonStyle,
  ButtonStyle? actionsButtonStyle,
  int? limit,
  bool? sortable,
  bool? insertable,
  ArrayAddCallback<T>? onAddTap,
  FocusNode? focusNode,
  String? hintText,
  TextAlign? textAlign,
  super.key,
  super.onSaved,
  FormFieldValidator<List<T>>? validator,
  super.initialValue,
  super.enabled,
  super.autovalidateMode,
  super.restorationId,
  super.decoration,
  super.onChanged,
  super.required,
  super.label,
  super.labelText,
  super.labelTextAlign,
  super.labelOverflow,
  super.padding,
  super.actionsBuilder,
  super.labelStyle,
  super.horizontalGap,
  super.tileColor,
  super.layoutDirection,
  super.trailingBuilder,
  super.leading,
  super.visualDensity,
  super.shape,
  super.iconColor,
  super.textColor,
  super.leadingAndTrailingTextStyle,
  super.onTap,
  super.minLeadingWidth,
  super.dense,
  super.colon,
  super.minLabelWidth,
  super.focusColor,
  super.minVerticalPadding,
})  : assert(onAddTap != null || defaultValue != null),
      super(
        builder: (field) => _buildFormFieldByItem(
          field,
          itemBuilder,
          defaultValue,
          addButtonStyle,
          actionsButtonStyle,
          limit,
          sortable,
          insertable,
          onAddTap,
        ),
        validator: (val) => _validator(val, required, limit, validator),
      );