pinput 0.1.9

PinPut #

PIN input field widget for Flutter with paste from clipboard functionality

Contents #

Overview #

This widget keeps whole width of parent widget and layouts textfields in a way to create PIN code input field look it accepts string of any length and calls the onSubmit method when all fields are filled.

drawing

Installation #

Install the latest version from pub.

Properties #

PropertyDefault/Meaning
onSubmit@required Function
fieldsCount@required number
isTextObscurefalse
textStyleTextStyle(fontSize: 30)
spaceBetweenspace between fields Default: 10.0
clearButtonIconIcon(Icons.backspace, size: 30)
pasteButtonIconIcon(Icons.content_paste, size: 30)
unFocusWhenDefault is False, True to hide keyboard
inputDecorationAbility to style field's border, padding etc...
keybaordTypenumber
keyboardActionnext
actionButtonEnabledtrue
autoFocustrue
textCapitalizationTextCapitalization.none

Example #

Import the package:


import 'package:flutter/material.dart';
import 'package:pinput/pin_put/pin_put.dart';

void main() => runApp(PinPutTest());

class PinPutTest extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        theme: ThemeData(
          primaryColor: Colors.green,
          hintColor: Colors.green,
        ),
        home: Scaffold(
            body: Builder(
          builder: (context) => Padding(
                padding: const EdgeInsets.all(40.0),
                child: Center(
                  child: PinPut(
                    fieldsCount: 4,
                    onSubmit: (String pin) => _showSnackBar(pin, context),
                  ),
                ),
              ),
        )));
  }

  void _showSnackBar(String pin, BuildContext context) {
    final snackBar = SnackBar(
      duration: Duration(seconds: 5),
      content: Container(
          height: 80.0,
          child: Center(
            child: Text(
              'Pin Submitted. Value: $pin',
              style: TextStyle(fontSize: 25.0),
            ),
          )),
      backgroundColor: Colors.greenAccent,
    );
    Scaffold.of(context).showSnackBar(snackBar);
  }
}

👍 Support #

Contribute #

  1. Fork it

  2. Create your feature branch (git checkout -b my-new-feature)

  3. Commit your changes (git commit -am 'Add some feature')

  4. Push to the branch (git push origin my-new-feature)

  5. Create new Pull Request

Changelog #

0.1.9 -07/02/2019 #

  • Added
PropertyDefault/Meaning
onClearClear button callback

0.1.8 -06/14/2019 #

👍 With the help of community: @datvo0110, @almeynman

  • Fixed minor bugs
  • Added
PropertyDefault/Meaning
containerHeight100.0

0.1.7 -05/12/2019 #

👍 With the help of community: @datvo0110, @mwgriffiths88, @inromualdo

  • Fixed minor bugs, check clipboard when app is resumed...
  • Added Properties ability to hide keyboard & custumize more
PropertyDefault/Meaning
textCapitalizationTextCapitalization.none

0.1.6 -01/17/2019 #

  • Added Properties ability to hide keyboard & custumize more
PropertyDefault/Meaning
clearButtonIconIcon(Icons.backspace, size: 30)
pasteButtonIconIcon(Icons.content_paste, size: 30)
unFocusWhenDefault is False, True to hide keyboard
textStyleTextStyle(fontSize: 30)
spaceBetweenspace between fields Default: 10.0
inputDecorationAbility to style field's border, padding etc...

0.1.5 - 12/17/2018 #

  • Added Copy From Clipboard fnctionality if copied text length is equal to fields count
PropertyDefault
pasteButtonIconIcons.content_paste

*Note that

clearButtonEnabled will change with actionButtonEnabled in next release, right now if it is true both clear and paste functinality works

0.1.4 - 10/31/2018 #

  • Added
PropertyDefault
autoFocustrue

0.1.3+1 - 11026/2018 #

  • Minor fixes

0.1.3 - 10/26/2018 #

  • Transformed plugin to MVVM pattern
  • Fixed onSubmit call when all fieds aren't filled
  • Updated Demo
  • Added
PropertyDefault
clearButtonIconIcons.backspace
clearButtonEnabledtrue
clearButtonColor0xFF66BB6A

0.1.2 - 10/24/2018 #

  • Added
PropertyDefault
borderRadius5.0
keybaordTypenumber
keyboardActionnext

0.1.1 - 10/24/2018 #

  • Added
PropertyDefault
onSubmitFunction
fieldsCount4
isTextObscurefalse
fontSize40.0

0.0.1 - 10/24/2018 #

  • Initial release, working base functionality

example/README.md

example #

PinPut widget Example

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

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


dependencies:
  pinput: ^0.1.9

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:pinput/pin_put/pin_put.dart';
import 'package:pinput/pin_put/pin_put_bloc.dart';
import 'package:pinput/pin_put/pin_put_state.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
86
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
93
Learn more about scoring.

We analyzed this package on Jul 17, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8

Admin