Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

pin input

100% dart based and lightweight pin input field widget for flutter.input

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.

pin input demo

installation

install the latest version from pub.

properties

property default/meaning
onsubmit @required function
fieldscount @required number
istextobscure false
textstyle textstyle(fontsize: 30)
spacebetween space between fields default: 10.0
clearbuttonicon icon(icons.backspace, size: 30)
pastebuttonicon icon(icons.content_paste, size: 30)
unfocuswhen default is false, true to hide keyboard
inputdecoration ability to style field’s border, padding etc…
keybaordtype number
keyboardaction next
actionbuttonenabled true
autofocus true

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);
  }
}

Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.