From c5e44edc3d30df6759e99c152ac22c958b1a0da2 Mon Sep 17 00:00:00 2001 From: Tino <4519784+TinoGuo@users.noreply.github.com> Date: Wed, 30 Dec 2020 17:42:25 +0800 Subject: [PATCH] update parameter and keep same (#58) --- CHANGELOG.md | 3 +++ lib/src/widget/pin_widget.dart | 14 +++++++------- pubspec.yaml | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d490847..f878117 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## [3.3.0] - 2020/12/30 +* Update: `inputFormatter` replace with `inputFormatters` to keep same as TextField. + ## [3.2.0] - 2020/12/29 * New: Cursor display #56 * Hint: Cursor would override hintText is enabled. diff --git a/lib/src/widget/pin_widget.dart b/lib/src/widget/pin_widget.dart index 618db0f..95c83d2 100644 --- a/lib/src/widget/pin_widget.dart +++ b/lib/src/widget/pin_widget.dart @@ -70,7 +70,7 @@ class PinInputTextField extends StatefulWidget { this.pinLength: _kDefaultPinLength, this.onSubmit, this.decoration = _kDefaultDecoration, - List inputFormatter, + List inputFormatters, this.keyboardType: TextInputType.phone, this.controller, this.focusNode, @@ -99,11 +99,11 @@ class PinInputTextField extends StatefulWidget { (decoration as SupportGap).getGapWidthList == null || (decoration as SupportGap).getGapWidthList.length == pinLength - 1)), - inputFormatters = inputFormatter == null + inputFormatters = inputFormatters == null ? [ LengthLimitingTextInputFormatter(pinLength), ] - : inputFormatter + : inputFormatters ..add(LengthLimitingTextInputFormatter(pinLength)), textCapitalization = textCapitalization ?? TextCapitalization.none, cursor = cursor ?? Cursor.disabled(), @@ -398,7 +398,7 @@ class PinInputTextFormField extends FormField { this.pinLength = _kDefaultPinLength, ValueChanged onSubmit, PinDecoration decoration = _kDefaultDecoration, - List inputFormatter, + List inputFormatters, TextInputType keyboardType = TextInputType.phone, FocusNode focusNode, bool autoFocus = false, @@ -433,11 +433,11 @@ class PinInputTextFormField extends FormField { (decoration as SupportGap).getGapWidthList == null || (decoration as SupportGap).getGapWidthList.length == pinLength - 1)), - inputFormatters = inputFormatter == null + inputFormatters = inputFormatters == null ? [ LengthLimitingTextInputFormatter(pinLength), ] - : inputFormatter + : inputFormatters ..add(LengthLimitingTextInputFormatter(pinLength)), super( key: key, @@ -471,7 +471,7 @@ class PinInputTextFormField extends FormField { pinLength: pinLength, onSubmit: onSubmit, decoration: decoration.copyWith(errorText: field.errorText), - inputFormatter: inputFormatter, + inputFormatters: inputFormatters, keyboardType: keyboardType, controller: state._effectiveController, focusNode: focusNode, diff --git a/pubspec.yaml b/pubspec.yaml index bf5bd04..3d0ff5f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: pin_input_text_field description: A textField widget to help display different style pin written in pure dart, no extra dependency. -version: 3.2.0 +version: 3.3.0 homepage: https://github.com/TinoGuo/pin_input_text_field environment: