pin_input_text_field 3.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 97

pub package GitHub GitHub top language

pin_input_text_field #

PinInputTextField is a TextField widget to help display different style pin. It supports all the platforms flutter supports.

Feature 👇👇 #

  • allow you customized the shape, any!
  • built-in 4 commonly used pin styles of shape
  • obscure support
  • solid support
  • enterColor support
  • support all the textField properties support
  • Flutter web support

Example 💎 #

Thanks to the Flutter Web, you can enjoy the preview by website without any installation.

Decoration #





Installing 🔧 #

Install the latest version from pub.

Usage 🚅 #

Attributes #

Customizable attributes for PinInputTextField

Attribute Name Example Value Description
pinLength 6 The max length of pin, the default is 6
onSubmit (String pin){} The callback will execute when user click done, sometimes is not working in Android.
decoration BoxLooseDecoration Decorate the pin, there are 3 inside styles, the default is BoxLooseDecoration
inputFormatters WhitelistingTextInputFormatter.digitsOnly Just like TextField's inputFormatter, the default is WhitelistingTextInputFormatter.digitsOnly
keyboardType Just like TextField's keyboardType, the default is
pinEditingController PinEditingController Controls the pin being edited. If null, this widget will create its own PinEditingController
autoFocus false Same as TextField's autoFocus, the default is false
focusNode FocusNode Same as TextField's focusNode
textInputAction TextInputAction.done Same as TextField's textInputAction, not working in digit mode
enabled true Same as TextField's enabled, the default is true
onChanged (String pin){} Same as TextField's onChanged

FormField #

Instead of using PinInputTextField, using PinInputTextFormField to control validate.

ObscureStyle #

/// Determine whether replace [obscureText] with number.
final bool isTextObscure;
/// The display text when [isTextObscure] is true, emoji supported
final String obscureText;

Contributors 🙏 #

This project exists thanks to all the people who contribute.




Notice after Version 2.0.0 ⚠️ #

Please set the selection when you set the text programmatically, just like this.

Don't set the selection in lib code since if it will cause dead loop in iOS. 🤔

If you have any idea, please make a Pull Request.

Known Issue 🥶 #

The PinEditingController listener will execute more than once when programmatically set text, you can filter some duplicate values in your code.

[3.0.1] - 2019/12/31

  • Update: optimise directory

[3.0.0] - 2019/12/30

  • Update: minimum sdk version - 2.7
  • New: add built-in CircleDecoration
  • New: support customized decoration, you can draw anything you want from now!

[2.1.0] - 2019/10/24

  • New: add hintText for all PinDecoration .
  • New: custom gapSpace support for UnderlineDecoration and BoxLooseDecoration.

[2.0.3] - 2019/10/16

  • New: add onChanged parameter.
  • Fix: fix null controller will not work in PinInputTextFormField.

[2.0.2] - 2019/10/08

  • Fix: fix missing first build initial value. Thanks to daniel-v

[2.0.1] - 2019/09/27

  • New: add 'PinInputTextFormField' to support form validate. Thanks to rajajain08.

[2.0.0] - 2019/08/12

  • Update: parameter pinEditingController renamed to controller.
  • Remove: remove the PinEditingController class, just simply use TextEditingController.
  • Fix: support dynamically changing of length & controller.
  • New: allow custom key.
  • Notice: Please set the selection when you set the text programmatically.

[1.0.1] - 2019/06/23

  • Fix: fix fatal error

[1.0.0] - 2019/06/23

  • Update: obscure text support emoji now.

[0.4.0] - 2019/05/23

  • New: add 'enable' to control pin input.

[0.3.1] - 2019/05/12

  • Update: complete example and pubspec.yaml.

[0.3.0] - 2019/04/09

  • New: no need to correct user's input.
  • New: align actual text in center to make popup window more natural.
  • New: obscure mode is always on now.
  • New: add textInputAction to control TextInputAction.

Breaking Change #

  • PinEditingController constructor must provide pinLength.
  • PinEditingController constructor provide new field autoDispose to simplify dispose.
  • PinTextField constructor remove width and height field, if you want customize size of the PinInputTextField, you can wrap a Container widget.

[0.2.1] - 2019/01/20

  • change default color of underlineDecoration from Colors.Black to Colors.cyan.
  • add more detail example.

[0.2.0] - 2019/01/20

  • add keyboardType & inputFormatters control.
  • add autoFocus & focusNode control.
  • add controller to assign pin.

[0.1.1] - 2019/01/09

  • change license from MIT to Apache.

[0.1.0] - 2019/01/09

  • add comment to help understand source code.
  • add obscure style to be more customize.
  • add onPinChanged to observe the text changed.
  • add solidColor to set background color in BoxLooseDecoration & BoxTightDecoration.
  • add enteredColor for UnderlineDecoration&BoxLooseDecoration.
  • remove const default variable in PinInputTextField.
  • fix wrong place in painting

[0.0.1] - 2018/12/24.

  • first commit.


example/main.dart #

Full examples see this

import 'package:pin_input_text_field/pin_input_text_field.dart';

                pinLength: 4,
                decoration: _pinDecoration,
                controller: _pinEditingController,
                autoFocus: true,
                textInputAction: TextInputAction.go,
                onSubmit: (pin) {
                  debugPrint('submit pin:$pin');

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  pin_input_text_field: ^3.0.1

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:pin_input_text_field/pin_input_text_field.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 16, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies