flutter pin code text field code example

Example: pin entry text field flutter

Installation 
In the dependencies: section of your pubspec.yaml, add the following line:

pin_entry_text_field: <latest_version>

Usage 
Import this class 
import 'package:pin_entry_text_field/pin_entry_text_field.dart';

Use the widget anywhere you need to retrieve PIN or OTP, the only required attribute is the onSubmit callback 
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: PinEntryTextField(
            onSubmit: (String pin){
              showDialog(
                context: context,
                builder: (context){
                  return AlertDialog(
                    title: Text("Pin"),
                    content: Text('Pin entered is $pin'),
                  );
                }
              ); //end showDialog()

            }, // end onSubmit
          ),
    );
  }

Tags:

Misc Example