CustomSinglePickerWithInput<T> constructor
const
CustomSinglePickerWithInput<T> ({
- required BuildContext context,
- required TextEditingController inputController,
- Key? key,
- Widget? leading,
- Widget? subtitle,
- String? subtitleText,
- Widget? trailing,
- bool? isRequired,
- ValueNotifier<
List< ? notifierOptions,PickerItem< >T> > - List<
PickerItem< ? options,T> > - Widget? title,
- String? titleText,
- BoxConstraints? constraints,
- double? height,
- EdgeInsets? margin,
- EdgeInsets? padding,
- bool filterable = false,
- Future<
void> ? onRequest()?, - void onSelected()?,
- bool isScrollControlled = true,
- void onBeforeOpen()?,
- BeforeOpenValidate? onBeforeOpenValidate,
- void onConfirm()?,
- TextEditingController? controller,
- String? initialValue,
- FocusNode? focusNode,
- TextInputType? keyboardType,
- TextCapitalization textCapitalization = TextCapitalization.none,
- TextInputAction? textInputAction,
- TextStyle? style,
- StrutStyle? strutStyle,
- TextDirection? textDirection,
- TextAlign textAlign = TextAlign.start,
- TextAlignVertical? textAlignVertical,
- bool autofocus = false,
- bool readOnly = false,
- bool? showCursor,
- String obscuringCharacter = '*',
- bool obscureText = false,
- bool autocorrect = true,
- SmartDashesType? smartDashesType,
- SmartQuotesType? smartQuotesType,
- bool enableSuggestions = true,
- MaxLengthEnforcement? maxLengthEnforcement,
- int? maxLines = 1,
- int? minLines,
- bool expands = false,
- int? maxLength,
- ValueChanged<
String> ? onChanged, - GestureTapCallback? onTap,
- TapRegionCallback? onTapOutside,
- ValueChanged<
String> ? onFieldSubmitted, - FormFieldSetter<
String> ? onSaved, - FormFieldValidator<
String> ? validator, - List<
TextInputFormatter> ? inputFormatters, - bool? enabled,
- double cursorWidth = 2.0,
- double? cursorHeight,
- Radius? cursorRadius,
- Color? cursorColor,
- Brightness? keyboardAppearance,
- EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
- bool? enableInteractiveSelection,
- TextSelectionControls? selectionControls,
- InputCounterWidgetBuilder? buildCounter,
- ScrollPhysics? scrollPhysics,
- Iterable<
String> ? autofillHints, - ScrollController? scrollController,
- String? restorationId,
- bool enableIMEPersonalizedLearning = true,
- MouseCursor? mouseCursor,
- SpellCheckConfiguration? spellCheckConfiguration,
- TextMagnifierConfiguration? magnifierConfiguration,
- UndoHistoryController? undoController,
- AppPrivateCommandCallback? onAppPrivateCommand,
- bool? cursorOpacityAnimates,
- BoxHeightStyle selectionHeightStyle = BoxHeightStyle.tight,
- BoxWidthStyle selectionWidthStyle = BoxWidthStyle.tight,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
- ContentInsertionConfiguration? contentInsertionConfiguration,
- Clip clipBehavior = Clip.hardEdge,
- bool stylusHandwritingEnabled = true,
- bool canRequestFocus = true,
- AutovalidateMode? autovalidateMode = AutovalidateMode.onUserInteraction,
- InputDecoration? decoration,
- bool useCameraScanner = false,
- bool showBorder = false,
- bool? clearable,
- double? width,
- CustomInputSize? size,
SinglePicker 单选选择器组件
Implementation
const CustomSinglePickerWithInput({
required this.context,
required this.inputController,
super.key,
this.leading,
this.subtitle,
this.subtitleText,
this.trailing,
this.isRequired,
this.notifierOptions,
this.options,
this.title,
this.titleText,
this.constraints,
this.height,
this.margin,
this.padding,
this.filterable = false,
this.onRequest,
this.onSelected,
this.isScrollControlled = true,
this.onBeforeOpen,
this.onBeforeOpenValidate,
this.onConfirm,
// -------------------------------------------------------------------- > TextFormField
this.controller,
this.initialValue,
this.focusNode,
this.keyboardType,
this.textCapitalization = TextCapitalization.none,
this.textInputAction,
this.style,
this.strutStyle,
this.textDirection,
this.textAlign = TextAlign.start,
this.textAlignVertical,
this.autofocus = false,
this.readOnly = false,
this.showCursor,
this.obscuringCharacter = '*',
this.obscureText = false,
this.autocorrect = true,
this.smartDashesType,
this.smartQuotesType,
this.enableSuggestions = true,
this.maxLengthEnforcement,
this.maxLines = 1,
this.minLines,
this.expands = false,
this.maxLength,
this.onChanged,
this.onTap,
this.onTapOutside,
this.onFieldSubmitted,
this.onSaved,
this.validator,
this.inputFormatters,
this.enabled,
this.cursorWidth = 2.0,
this.cursorHeight,
this.cursorRadius,
this.cursorColor,
this.keyboardAppearance,
this.scrollPadding = const EdgeInsets.all(20.0),
this.enableInteractiveSelection,
this.selectionControls,
this.buildCounter,
this.scrollPhysics,
this.autofillHints,
this.scrollController,
this.restorationId,
this.enableIMEPersonalizedLearning = true,
this.mouseCursor,
this.spellCheckConfiguration,
this.magnifierConfiguration,
this.undoController,
this.onAppPrivateCommand,
this.cursorOpacityAnimates,
this.selectionHeightStyle = BoxHeightStyle.tight,
this.selectionWidthStyle = BoxWidthStyle.tight,
this.dragStartBehavior = DragStartBehavior.start,
this.contentInsertionConfiguration,
this.clipBehavior = Clip.hardEdge,
this.stylusHandwritingEnabled = true,
this.canRequestFocus = true,
this.autovalidateMode = AutovalidateMode.onUserInteraction,
this.decoration,
this.useCameraScanner = false,
this.showBorder = false,
this.clearable,
this.width,
this.size,
}) : assert((title != null) != (titleText != null), '必须设置 title 或 titleText 其中一个参数'),
assert(options != null || notifierOptions != null, '必须设置 options 或 notifierOptions 其中一个参数'),
assert(!(subtitle != null && subtitleText != null), '不能同时设置 subtitle 和 subtitleText'),
assert(!(options != null && onRequest != null), '不能同时设置 options 和 onRequest');