TxChipFormField<T, V> constructor

TxChipFormField<T, V>({
  1. required List<T> source,
  2. required ValueMapper<T, String?> labelMapper,
  3. ValueMapper<T, V?>? valueMapper,
  4. ValueMapper<T, bool>? disabledWhen,
  5. List<T>? initialData,
  6. List<V>? initialValue,
  7. int? minCount,
  8. int? maxCount,
  9. double? spacing,
  10. double? runSpacing,
  11. WrapAlignment? alignment,
  12. WrapAlignment? runAlignment,
  13. WrapCrossAlignment? crossAxisAlignment,
  14. FocusNode? focusNode,
  15. Key? key,
  16. FormFieldSetter<List<T>>? onSaved,
  17. FormFieldValidator<List<T>>? validator,
  18. bool? enabled,
  19. AutovalidateMode? autovalidateMode = AutovalidateMode.onUserInteraction,
  20. String? restorationId,
  21. InputDecoration? decoration,
  22. ValueChanged<List<T>?>? onChanged,
  23. bool? required,
  24. bool? bordered = false,
  25. IndexedValueMapper<T, Widget>? avatarBuilder,
  26. IndexedValueMapper<T, String>? tooltipMapper,
  27. Widget? label,
  28. String? labelText,
  29. TextAlign? labelTextAlign,
  30. TextOverflow? labelOverflow,
  31. EdgeInsetsGeometry? padding,
  32. FieldActionsBuilder<List<T>>? actionsBuilder,
  33. TextStyle? labelStyle,
  34. double? horizontalGap,
  35. Color? tileColor,
  36. Axis? layoutDirection,
  37. TxFormFieldBuilder<List<T>>? trailingBuilder,
  38. Widget? leading,
  39. VisualDensity? visualDensity,
  40. ShapeBorder? shape,
  41. Color? iconColor,
  42. Color? textColor,
  43. TextStyle? leadingAndTrailingTextStyle,
  44. GestureTapCallback? onTap,
  45. double? minLeadingWidth,
  46. double? minLabelWidth,
  47. double? minVerticalPadding,
  48. bool? dense,
  49. bool? colon,
  50. Color? focusColor,
})

Implementation

TxChipFormField({
  required List<T> source,
  required ValueMapper<T, String?> labelMapper,
  ValueMapper<T, V?>? valueMapper,
  ValueMapper<T, bool>? disabledWhen,
  List<T>? initialData,
  List<V>? initialValue,
  int? minCount,
  int? maxCount,
  double? spacing,
  double? runSpacing,
  WrapAlignment? alignment,
  WrapAlignment? runAlignment,
  WrapCrossAlignment? crossAxisAlignment,
  super.focusNode,
  super.key,
  super.onSaved,
  FormFieldValidator<List<T>>? validator,
  super.enabled,
  super.autovalidateMode,
  super.restorationId,
  super.decoration,
  super.onChanged,
  super.required,
  super.bordered = false,
  IndexedValueMapper<T, Widget>? avatarBuilder,
  IndexedValueMapper<T, String>? tooltipMapper,
  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.minLabelWidth,
  super.minVerticalPadding,
  super.dense,
  super.colon,
  super.focusColor,
}) : super(
        runSpacing: runSpacing ?? 8.0,
        spacing: spacing ?? 8.0,
        alignment: alignment,
        runAlignment: runAlignment,
        crossAxisAlignment: crossAxisAlignment,
        itemBuilder: (field, index, data, onChanged) => _ChipItem(
          index: index,
          item: source[index],
          data: data,
          labelMapper: labelMapper,
          enabled: field.isEnabled,
          onChanged: field.didChange,
          disabledWhen: disabledWhen,
          avatarBuilder: avatarBuilder,
          minCount: minCount,
          maxCount: maxCount,
          tooltipMapper: tooltipMapper,
        ),
        itemCount: source.length,
        initialValue: TxMultiPickerFormField.initData<T, V>(
          source,
          initialData,
          initialValue,
          valueMapper,
        ),
        validator: (value) => TxMultiPickerFormField.generateValidator<T>(
          value,
          validator,
          required,
          minCount,
          maxCount,
        ),
      );