CustomSinglePickerWithInput<T> constructor

const CustomSinglePickerWithInput<T>({
  1. required BuildContext context,
  2. required TextEditingController inputController,
  3. Key? key,
  4. Widget? leading,
  5. Widget? subtitle,
  6. String? subtitleText,
  7. Widget? trailing,
  8. bool? isRequired,
  9. ValueNotifier<List<PickerItem<T>>>? notifierOptions,
  10. List<PickerItem<T>>? options,
  11. Widget? title,
  12. String? titleText,
  13. BoxConstraints? constraints,
  14. double? height,
  15. EdgeInsets? margin,
  16. EdgeInsets? padding,
  17. bool filterable = false,
  18. Future<void>? onRequest()?,
  19. void onSelected()?,
  20. bool isScrollControlled = true,
  21. void onBeforeOpen()?,
  22. BeforeOpenValidate? onBeforeOpenValidate,
  23. void onConfirm(
    1. String?
    )?,
  24. TextEditingController? controller,
  25. String? initialValue,
  26. FocusNode? focusNode,
  27. TextInputType? keyboardType,
  28. TextCapitalization textCapitalization = TextCapitalization.none,
  29. TextInputAction? textInputAction,
  30. TextStyle? style,
  31. StrutStyle? strutStyle,
  32. TextDirection? textDirection,
  33. TextAlign textAlign = TextAlign.start,
  34. TextAlignVertical? textAlignVertical,
  35. bool autofocus = false,
  36. bool readOnly = false,
  37. bool? showCursor,
  38. String obscuringCharacter = '*',
  39. bool obscureText = false,
  40. bool autocorrect = true,
  41. SmartDashesType? smartDashesType,
  42. SmartQuotesType? smartQuotesType,
  43. bool enableSuggestions = true,
  44. MaxLengthEnforcement? maxLengthEnforcement,
  45. int? maxLines = 1,
  46. int? minLines,
  47. bool expands = false,
  48. int? maxLength,
  49. ValueChanged<String>? onChanged,
  50. GestureTapCallback? onTap,
  51. TapRegionCallback? onTapOutside,
  52. ValueChanged<String>? onFieldSubmitted,
  53. FormFieldSetter<String>? onSaved,
  54. FormFieldValidator<String>? validator,
  55. List<TextInputFormatter>? inputFormatters,
  56. bool? enabled,
  57. double cursorWidth = 2.0,
  58. double? cursorHeight,
  59. Radius? cursorRadius,
  60. Color? cursorColor,
  61. Brightness? keyboardAppearance,
  62. EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
  63. bool? enableInteractiveSelection,
  64. TextSelectionControls? selectionControls,
  65. InputCounterWidgetBuilder? buildCounter,
  66. ScrollPhysics? scrollPhysics,
  67. Iterable<String>? autofillHints,
  68. ScrollController? scrollController,
  69. String? restorationId,
  70. bool enableIMEPersonalizedLearning = true,
  71. MouseCursor? mouseCursor,
  72. SpellCheckConfiguration? spellCheckConfiguration,
  73. TextMagnifierConfiguration? magnifierConfiguration,
  74. UndoHistoryController? undoController,
  75. AppPrivateCommandCallback? onAppPrivateCommand,
  76. bool? cursorOpacityAnimates,
  77. BoxHeightStyle selectionHeightStyle = BoxHeightStyle.tight,
  78. BoxWidthStyle selectionWidthStyle = BoxWidthStyle.tight,
  79. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  80. ContentInsertionConfiguration? contentInsertionConfiguration,
  81. Clip clipBehavior = Clip.hardEdge,
  82. bool stylusHandwritingEnabled = true,
  83. bool canRequestFocus = true,
  84. AutovalidateMode? autovalidateMode = AutovalidateMode.onUserInteraction,
  85. InputDecoration? decoration,
  86. bool useCameraScanner = false,
  87. bool showBorder = false,
  88. bool? clearable,
  89. double? width,
  90. 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');