FormeTimeField constructor

FormeTimeField({
  1. TimeOfDay? initialValue,
  2. FormeTimeFieldFormatter? formatter,
  3. required String name,
  4. bool readOnly = false,
  5. Key? key,
  6. InputDecoration? decoration,
  7. int? maxLines = 1,
  8. int? order,
  9. bool quietlyValidate = false,
  10. bool autofocus = false,
  11. int? minLines,
  12. int? maxLength,
  13. TextStyle? style,
  14. ToolbarOptions? toolbarOptions,
  15. TextInputAction? textInputAction,
  16. TextCapitalization textCapitalization = TextCapitalization.none,
  17. bool obscureText = false,
  18. StrutStyle? strutStyle,
  19. TextAlign textAlign = TextAlign.start,
  20. TextAlignVertical? textAlignVertical,
  21. TextDirection? textDirection,
  22. bool? showCursor,
  23. String obscuringCharacter = '•',
  24. bool autocorrect = true,
  25. SmartDashesType? smartDashesType,
  26. SmartQuotesType? smartQuotesType,
  27. bool enableSuggestions = true,
  28. bool expands = false,
  29. MaxLengthEnforcement? maxLengthEnforcement,
  30. double cursorWidth = 2.0,
  31. double? cursorHeight,
  32. Radius? cursorRadius,
  33. Color? cursorColor,
  34. BoxHeightStyle selectionHeightStyle = BoxHeightStyle.tight,
  35. BoxWidthStyle selectionWidthStyle = BoxWidthStyle.tight,
  36. Brightness? keyboardAppearance,
  37. EdgeInsets scrollPadding = const EdgeInsets.all(20),
  38. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  39. MouseCursor? mouseCursor,
  40. ScrollPhysics? scrollPhysics,
  41. Iterable<String>? autofillHints,
  42. bool enableInteractiveSelection = true,
  43. bool enabled = true,
  44. VoidCallback? onEditingComplete,
  45. AppPrivateCommandCallback? appPrivateCommandCallback,
  46. InputCounterWidgetBuilder? buildCounter,
  47. ScrollController? scrollController,
  48. TextSelectionControls? textSelectionControls,
  49. Duration? asyncValidatorDebounce,
  50. AutovalidateMode? autovalidateMode,
  51. ValueChanged<TimeOfDay?>? onSubmitted,
  52. FormeFieldStatusChanged<TimeOfDay?>? onStatusChanged,
  53. dynamic onInitialed,
  54. FormeFieldSetter<TimeOfDay?>? onSaved,
  55. FormeValidator<TimeOfDay?>? validator,
  56. FormeAsyncValidator<TimeOfDay?>? asyncValidator,
  57. TimePickerEntryMode? initialEntryMode,
  58. String? cancelText,
  59. String? confirmText,
  60. String? helpText,
  61. RouteSettings? routeSettings,
  62. TransitionBuilder? builder,
  63. bool requestFocusOnUserInteraction = true,
  64. FormeFieldDecorator<TimeOfDay?>? decorator,
  65. bool registrable = true,
  66. FormeFieldValidationFilter<TimeOfDay?>? validationFilter,
  67. FocusNode? focusNode,
})

Implementation

FormeTimeField({
  TimeOfDay? initialValue,
  this.formatter,
  required String name,
  bool readOnly = false,
  Key? key,
  InputDecoration? decoration,
  int? maxLines = 1,
  int? order,
  bool quietlyValidate = false,
  bool autofocus = false,
  int? minLines,
  int? maxLength,
  TextStyle? style,
  ToolbarOptions? toolbarOptions,
  TextInputAction? textInputAction,
  TextCapitalization textCapitalization = TextCapitalization.none,
  bool obscureText = false,
  StrutStyle? strutStyle,
  TextAlign textAlign = TextAlign.start,
  TextAlignVertical? textAlignVertical,
  TextDirection? textDirection,
  bool? showCursor,
  String obscuringCharacter = '•',
  bool autocorrect = true,
  SmartDashesType? smartDashesType,
  SmartQuotesType? smartQuotesType,
  bool enableSuggestions = true,
  bool expands = false,
  MaxLengthEnforcement? maxLengthEnforcement,
  double cursorWidth = 2.0,
  double? cursorHeight,
  Radius? cursorRadius,
  Color? cursorColor,
  BoxHeightStyle selectionHeightStyle = BoxHeightStyle.tight,
  BoxWidthStyle selectionWidthStyle = BoxWidthStyle.tight,
  Brightness? keyboardAppearance,
  EdgeInsets scrollPadding = const EdgeInsets.all(20),
  DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  MouseCursor? mouseCursor,
  ScrollPhysics? scrollPhysics,
  Iterable<String>? autofillHints,
  bool enableInteractiveSelection = true,
  bool enabled = true,
  VoidCallback? onEditingComplete,
  AppPrivateCommandCallback? appPrivateCommandCallback,
  InputCounterWidgetBuilder? buildCounter,
  ScrollController? scrollController,
  TextSelectionControls? textSelectionControls,
  Duration? asyncValidatorDebounce,
  AutovalidateMode? autovalidateMode,
  ValueChanged<TimeOfDay?>? onSubmitted,
  FormeFieldStatusChanged<TimeOfDay?>? onStatusChanged,
  FormeFieldInitialed<TimeOfDay?>? onInitialed,
  FormeFieldSetter<TimeOfDay?>? onSaved,
  FormeValidator<TimeOfDay?>? validator,
  FormeAsyncValidator<TimeOfDay?>? asyncValidator,
  TimePickerEntryMode? initialEntryMode,
  String? cancelText,
  String? confirmText,
  String? helpText,
  RouteSettings? routeSettings,
  TransitionBuilder? builder,
  bool requestFocusOnUserInteraction = true,
  FormeFieldDecorator<TimeOfDay?>? decorator,
  bool registrable = true,
  FormeFieldValidationFilter<TimeOfDay?>? validationFilter,
  FocusNode? focusNode,
}) : super(
        focusNode: focusNode,
        validationFilter: validationFilter,
        enabled: enabled,
        registrable: registrable,
        decorator: decorator,
        requestFocusOnUserInteraction: requestFocusOnUserInteraction,
        order: order,
        quietlyValidate: quietlyValidate,
        asyncValidatorDebounce: asyncValidatorDebounce,
        autovalidateMode: autovalidateMode,
        onStatusChanged: onStatusChanged,
        onInitialed: onInitialed,
        onSaved: onSaved,
        validator: validator,
        asyncValidator: asyncValidator,
        key: key,
        name: name,
        readOnly: readOnly,
        initialValue: initialValue,
        builder: (baseState) {
          final bool readOnly = baseState.readOnly;
          final bool enabled = baseState.enabled;
          final _FormeTimeFieldState state =
              baseState as _FormeTimeFieldState;

          void pickTime() {
            showTimePicker(
              context: state.context,
              initialTime: state.value ?? TimeOfDay.now(),
              builder: builder,
              routeSettings: routeSettings,
              initialEntryMode: initialEntryMode ?? TimePickerEntryMode.dial,
              cancelText: cancelText,
              confirmText: confirmText,
              helpText: helpText,
            ).then((value) {
              if (value != null) {
                state.didChange(value);
              }
              state.focusNode.requestFocus();
            });
          }

          return TextField(
            focusNode: state.focusNode,
            controller: state.textEditingController,
            decoration: decoration?.copyWith(errorText: state.errorText),
            obscureText: obscureText,
            maxLines: maxLines,
            minLines: minLines,
            enabled: enabled,
            readOnly: true,
            onTap: readOnly ? null : pickTime,
            onEditingComplete: onEditingComplete,
            onSubmitted:
                onSubmitted == null ? null : (v) => onSubmitted(state.value),
            onAppPrivateCommand: appPrivateCommandCallback,
            textInputAction: textInputAction,
            textCapitalization: textCapitalization,
            style: style,
            strutStyle: strutStyle,
            textAlign: textAlign,
            textAlignVertical: textAlignVertical,
            textDirection: textDirection,
            showCursor: showCursor,
            obscuringCharacter: obscuringCharacter,
            autocorrect: autocorrect,
            smartDashesType: smartDashesType,
            smartQuotesType: smartQuotesType,
            enableSuggestions: enableSuggestions,
            expands: expands,
            cursorWidth: cursorWidth,
            cursorHeight: cursorHeight,
            cursorRadius: cursorRadius,
            cursorColor: cursorColor,
            selectionHeightStyle: selectionHeightStyle,
            selectionWidthStyle: selectionWidthStyle,
            keyboardAppearance: keyboardAppearance,
            scrollPadding: scrollPadding,
            dragStartBehavior: dragStartBehavior,
            mouseCursor: mouseCursor,
            scrollPhysics: scrollPhysics,
            autofillHints: readOnly ? null : autofillHints,
            autofocus: autofocus,
            toolbarOptions: toolbarOptions,
            enableInteractiveSelection: enableInteractiveSelection,
            buildCounter: buildCounter,
            maxLengthEnforcement: maxLengthEnforcement,
            maxLength: maxLength,
            scrollController: scrollController,
            selectionControls: textSelectionControls,
          );
        },
      );