multiSelect<T, V, K> static method

TFormField<List<V>> multiSelect<T, V, K>(
  1. TFieldProp<List<V>> prop,
  2. String? label, {
  3. String? tag,
  4. String? placeholder,
  5. String? helperText,
  6. String? info,
  7. bool isRequired = false,
  8. bool disabled = false,
  9. bool autoFocus = false,
  10. bool readOnly = false,
  11. bool clearable = false,
  12. TTagsFieldTheme? theme,
  13. FocusNode? focusNode,
  14. VoidCallback? onTap,
  15. TTagsController? textController,
  16. List<String? Function(List<V>?)>? rules,
  17. List<T>? items,
  18. ItemKeyAccessor<T, K>? itemKey,
  19. ItemValueAccessor<T, V>? itemValue,
  20. ItemTextAccessor<T>? itemText,
  21. ItemTextAccessor<T>? itemSubText,
  22. ItemTextAccessor<T>? itemImageUrl,
  23. ItemChildrenAccessor<T>? itemChildren,
  24. int itemsPerPage = 10,
  25. TLoadListener<T>? onLoad,
  26. TRefLoadListener<T>? onRefLoad,
  27. int? searchDelay,
  28. TControllerReadyListener<T, K>? onControllerReady,
  29. TRefControllerReadyListener<T, K>? onRefControllerReady,
})

Implementation

static TFormField<List<V>> multiSelect<T, V, K>(
  TFieldProp<List<V>> prop,
  String? label, {
  String? tag,
  String? placeholder,
  String? helperText,
  String? info,
  bool isRequired = false,
  bool disabled = false,
  bool autoFocus = false,
  bool readOnly = false,
  bool clearable = false,
  TTagsFieldTheme? theme,
  FocusNode? focusNode,
  VoidCallback? onTap,
  TTagsController? textController,
  List<String? Function(List<V>?)>? rules,
  List<T>? items,
  ItemKeyAccessor<T, K>? itemKey,
  ItemValueAccessor<T, V>? itemValue,
  ItemTextAccessor<T>? itemText,
  ItemTextAccessor<T>? itemSubText,
  ItemTextAccessor<T>? itemImageUrl,
  ItemChildrenAccessor<T>? itemChildren,
  int itemsPerPage = 10,
  TLoadListener<T>? onLoad,
  TRefLoadListener<T>? onRefLoad,
  int? searchDelay,
  TControllerReadyListener<T, K>? onControllerReady,
  TRefControllerReadyListener<T, K>? onRefControllerReady,
}) {
  return TFormField<List<V>>(
    prop: prop,
    builder: (onValueChanged) {
      Widget buildMultiSelect([WidgetRef? ref]) {
        final effectiveOnLoad = (onRefLoad != null && ref != null)
            ? (TLoadOptions<T> options) => onRefLoad(ref, options)
            : onLoad;

        final effectiveOnControllerReady = (onRefControllerReady != null && ref != null)
            ? (TListController<T, K> controller) => onRefControllerReady(ref, controller)
            : onControllerReady;

        return TMultiSelect<T, V, K>(
          label: label,
          tag: tag,
          placeholder: placeholder,
          helperText: helperText,
          info: info,
          isRequired: isRequired,
          disabled: disabled,
          autoFocus: autoFocus,
          readOnly: readOnly,
          clearable: clearable,
          theme: theme,
          focusNode: focusNode,
          onTap: onTap,
          textController: textController,
          rules: rules,
          items: items,
          itemText: itemText,
          itemSubText: itemSubText,
          itemImageUrl: itemImageUrl,
          itemChildren: itemChildren,
          itemValue: itemValue,
          itemKey: itemKey,
          itemsPerPage: itemsPerPage,
          onLoad: effectiveOnLoad,
          searchDelay: searchDelay,
          value: prop.value,
          valueNotifier: prop.valueNotifier,
          onValueChanged: onValueChanged,
          onControllerReady: effectiveOnControllerReady,
        );
      }

      if (onRefControllerReady != null || onRefLoad != null) {
        return Consumer(
          builder: (context, ref, child) => buildMultiSelect(ref),
        );
      }

      return buildMultiSelect();
    },
  );
}