Skip to content

Commit

Permalink
add autofillHints and autovalidate deprecation notice (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
daveols authored Nov 18, 2020
1 parent 6675af2 commit af88619
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions lib/src/widget/pin_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ class PinInputTextField extends StatefulWidget {
/// Same as [TextField]'s toolbarOptions
final ToolbarOptions toolbarOptions;

/// Same as [TextField]'s autofillHints
final Iterable<String> autofillHints;

PinInputTextField({
Key key,
this.pinLength: _kDefaultPinLength,
Expand All @@ -72,6 +75,7 @@ class PinInputTextField extends StatefulWidget {
this.autocorrect = false,
this.enableInteractiveSelection = false,
this.toolbarOptions,
this.autofillHints,
}) :

/// pinLength must larger than 0.
Expand Down Expand Up @@ -208,6 +212,9 @@ class _PinInputTextFieldState extends State<PinInputTextField> {
/// Hide the Cursor
showCursor: false,

/// Autofill hints for the underlying platform.
autofillHints: widget.autofillHints,

/// Whether to correct the user input.
autocorrect: widget.autocorrect,

Expand Down Expand Up @@ -303,14 +310,17 @@ class PinInputTextFormField extends FormField<String> {
bool enabled = true,
FormFieldSetter<String> onSaved,
FormFieldValidator<String> validator,
bool autovalidate = false,
@Deprecated("'autovalidate' is deprecated and shouldn't be used, use 'autovalidateMode' instead")
bool autovalidate = false,
AutovalidateMode autovalidateMode = AutovalidateMode.disabled,
ValueChanged<String> onChanged,
TextCapitalization textCapitalization,
bool autocorrect = false,
bool enableInteractiveSelection = false,
ToolbarOptions toolbarOptions,
Iterable<String> autofillHints,
}) : assert(initialValue == null || controller == null),
assert(autovalidate != null),
assert(autovalidateMode != null),
assert(pinLength != null && pinLength > 0),

/// pinLength must larger than 0.
Expand Down Expand Up @@ -354,8 +364,9 @@ class PinInputTextFormField extends FormField<String> {
return result;
},
// FIXME: remove deprecated field in near future
// ignore: deprecated_member_use
// ignore: deprecated_member_use, deprecated_member_use_from_same_package
autovalidate: autovalidate,
autovalidateMode: autovalidateMode,
enabled: enabled,
builder: (FormFieldState<String> field) {
final _PinInputTextFormFieldState state = field;
Expand All @@ -375,6 +386,7 @@ class PinInputTextFormField extends FormField<String> {
enableInteractiveSelection: enableInteractiveSelection,
autocorrect: autocorrect,
toolbarOptions: toolbarOptions,
autofillHints: autofillHints,
);
});

Expand Down

0 comments on commit af88619

Please sign in to comment.