A Flutter package that help you create a verification input.

Overview

flutter_verification_code Pub

After install, in your Dart code, you can use:

import 'package:flutter_verification_code/flutter_verification_code.dart';

Usage

VerificationCode(
            textStyle: TextStyle(fontSize: 20.0, color: Colors.red[900]),
            keyboardType: TextInputType.number,
            underlineColor: Colors.amber, // If this is null it will use primaryColor: Colors.red from Theme
            length: 4,
            cursorColor: Colors.blue, // If this is null it will default to the ambient
            // clearAll is NOT required, you can delete it
            // takes any widget, so you can implement your design
            clearAll: Padding(
              padding: const EdgeInsets.all(8.0),
              child: Text(
                'clear all',
                style: TextStyle(fontSize: 14.0, decoration: TextDecoration.underline, color: Colors.blue[700]),
              ),
            ),
            onCompleted: (String value) {
              setState(() {
                _code = value;
              });
            },
            onEditing: (bool value) {
              setState(() {
                _onEditing = value;
              });
              if (!_onEditing) FocusScope.of(context).unfocus();
            },
          ),
onEditing: (bool value) {
  setState(() {
    _onEditing = value;
  });
},
Center(
  child: (_onEditing != true)
      ? Text('Your code: $_code')
      : Text('Please enter full code'),
),

Full example is here https://github.com/awaik/flutter_verification_code/tree/master/example

Showcase

Image|100x100, 10%

Image|100x100, 10%

Comments
  • Loosing focus when typing value

    Loosing focus when typing value

    Hi Awaik, I've tried with your example, but face a problem

    Simulator Screen Shot - iPhone 8 - 2019-12-16 at 08 37 49 When typing the first value, instead of jumping to the next text field, it loses focus.

    I think the problem happens when I upgrade Dart and Flutter version: [✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.14.6 18G1012, locale en-US) • Flutter version 1.12.13+hotfix.5 at /Users/anlam/Documents/Flutter_Dev/flutter • Framework revision 27321ebbad (5 days ago), 2019-12-10 18:15:01 -0800 • Engine revision 2994f7e1e6 • Dart version 2.7.0

    opened by anlam87 4
  • Remove Input and Text Color

    Remove Input and Text Color

    Hello I think you should remove Input and Text color, the current create black input and text color if you use customised them, I have change the following and works for me.

    this.textStyle = const TextStyle(fontSize: 25.0,  color: Colors.black),
    
    decoration: InputDecoration(
          border: (border ? null : InputBorder.none),
          counterText: "",
          contentPadding: EdgeInsets.all(((widget.itemSize * 2) / 10)),
          errorMaxLines: 1,
          fillColor: Colors.black),
    

    Thanks

    opened by almayahi 3
  • Keyboard can not display on ios

    Keyboard can not display on ios

    i am using version flutter_verification_code: ^0.1.5+1 everything is ok on android but i can not display the keyboard on ios device

    ══╡ EXCEPTION CAUGHT BY FOUNDATION LIBRARY ╞════════════════════════════════════════════════════════ flutter: The following assertion was thrown while dispatching notifications for FocusNode: flutter: The requested TextInputAction "TextInputAction.previous" is not supported on iOS. flutter: 'package:flutter/src/services/text_input.dart': flutter: Failed assertion: line 921 pos 11: '_iOSSupportedInputActions.contains(inputAction)' flutter: flutter: Either the assertion indicates an error in the framework itself, or we should provide substantially flutter: more information in this error message to help you determine and fix the underlying cause. flutter: In either case, please report this assertion by filing a bug on GitHub: flutter: https://github.com/flutter/flutter/issues/new?template=BUG.md flutter: flutter: When the exception was thrown, this was the stack:

    bug 
    opened by thienhaole92 3
  • How to paste the verification code?

    How to paste the verification code?

    I'm trying to copy paste the verification code into the Verification but it is only able to paste the first 2 digits. Does anyone know how to paste all 6 digits? Thanks in advance!

    Below is my code:

    VerificationCode(
                  textStyle: TextStyle(fontSize: 21.0, color: Color(0xff0074e0)),
                  underlineColor: Color(0xff0074e0),
                  keyboardType: TextInputType.number,
                  length: 6,
                  // clearAll is NOT required, you can delete it
                  // takes any widget, so you can implement your design
                  onCompleted: (String value) {
                    setState(() {
                      _code = value;
                    });
                  },
                  onEditing: (bool value) {
                    setState(() {
                      _onEditing = value;
                    });
                  },
                ),
    
    opened by ScottLee97 2
  • can remove after fill the textfield

    can remove after fill the textfield

    dear verification code developer, I add some methods in onChange's text field and this is helping me with my own project. This my previous. WhatsApp Video 2021-04-21 at 14 25 37 And still the same a bug. WhatsApp Video 2021-04-21 at 14 22 25

    opened by manofi21 2
  • Backspace not working if the current code is empty

    Backspace not working if the current code is empty

    In case, if a user has input 3 codes and found that the previous one not correct,

    therefore, he might use keyboard backspace to delete the previous one, but this does not work as expected.

    opened by dreamer2q 2
  • resolve RangedError Bug

    resolve RangedError Bug

    this bug occur when create VerificationCode in stateful widget and after created , call Navigation.pop() and again come back to that page. when VerificationCode created _listController become empty but if it is not first time to create VerificationCode _listFocusNode , is not empty therefor if statement in initState not call and Given that widget list is not empty we get error when call _listControllerText[index] because _listController is empty and we call its items. for resolve that , i deleted the if statement in initState() and instead of that inserted _listFocusNode.clear()

    opened by mohpezeshki 2
  • add filled property to activate fillColor

    add filled property to activate fillColor

    #31 Add filled property to activate input background color when fillColor has a value

    documentation:

    If true the decoration's container is filled with fillColor.

    When InputDecorator.isHovering is true, the hoverColor is also blended into the final fill color.

    Typically this field set to true if border is an UnderlineInputBorder.

    The decoration's container is the area which is filled if filled is true and bordered per the border. It's the area adjacent to icon and above the widgets that contain helperText, errorText, and counterText.

    This property is false by default.

    opened by ebrahim-2 1
  • Question: The cursor of the last input box is in the middle of the text.

    Question: The cursor of the last input box is in the middle of the text.

    Add in the 218th line of the code:

    selection: TextSelection.fromPosition(TextPosition(
                        affinity: TextAffinity.downstream,
                        offset: _listControllerText[_index].text.length,
                      ))
    
    opened by Xorn4400 1
  • added input formatter to accept only digits

    added input formatter to accept only digits

    Work in progress. I am new to contributing to open source. This will be my 1st contribution so please let me know if I need to make any changes @awaik

    opened by rajrushilmakkar 1
  • Feature Request * for numbers typed

    Feature Request * for numbers typed

    or any character specified by the user so that the pin number will not be seen while the user types it.

    this looks like some work but the simplest would be to add

    obscureText: true

    to your TextField widget.

    opened by chitgoks 1
  • If backspace pressed in empty box, move to previous box

    If backspace pressed in empty box, move to previous box

    i noticed that if backspace is pressed in a box with a character in it, the character is erased and focus is transferred to the previous box during editing when a character is entered focus is transferred to the next box - which is empty if backspace is pressed in the empty box, nothing happens because the onChange function is not triggered by a backspace in an empty text field i added a check in the onKey of the existing RawKeyboardListener to check if backspace is pressed in an empty box, and move to the previous box

    opened by avraham-mayer 0
  • The underline sticks together and enters from right to left!

    The underline sticks together and enters from right to left!

    Screen Shot 1400-10-25 at 23 07 08

    VerificationCode( length: 3, textStyle: TextStyle(fontSize: 20, color: Colors.black), underlineColor: Colors.black, keyboardType: TextInputType.number, underlineUnfocusedColor: Colors.black, onCompleted: (value) { setState(() { _code = value; }); }, onEditing: (value) {}, ),

    opened by aliazizi77 2
Owner
Alex Awaik
Android & iOS developer - Dart, Flutter, Swift
Alex Awaik
Verify code input. You can create a verify code input.

flutter_verification_code_input A Flutter package that help you create a verification input. Installing flutter_verification_code_input: git:

Tiny Express 49 Dec 7, 2022
Verify code input. You can create a verify code input.

flutter_verification_code_input A Flutter package that help you create a verification input. Installing flutter_verification_code_input: git:

Tiny Express 49 Dec 7, 2022
Flutter Plugin - Simple character blocked input that usually used for redeem/validation input.

Block Input Simple character blocked input that usually used for redeem code or validation code input. Gallery Example Full example import 'package:bl

Enkh-Amar 7 Nov 2, 2022
Flutter + Firebase Auth Demo App that uses Google, Facebook, Email/Password Signup/Login, Email Verification and more!

Flutter Firebase Auth Demo Flutter + Firebase Auth Demo App that uses Google, Facebook, Email/Password Signup/Login, Email Verification and more! Feat

Rivaan Ranawat 55 Jan 7, 2023
🔥🚀 Flutter package to create Pin code input text field with every pixel customization possibility 🎨 with beautiful animations

Flutter PinPut From Tornike ?? ?? Flutter package to create Pin code input (OTP) text field with every pixel customization possibility ?? and beautifu

Tornike 451 Jan 2, 2023
Chance Dart is a free Open Source project that lets you create random strings, integers, and other things to help with tiresome tasks, especially when building automated tests or wherever else you require anything random.

Chance Dart Random generator helper for Dart Homepage • Documentation Overview Chance Dart is a free Open Source project that lets you create random s

Ayotomide 55 Dec 27, 2022
Flutter package for Android and iOS allow you to show a wide range of hyperlinks either in the input field or in an article view

Tagtly package help you to detect a lot of hyperlink text such as.. email, url, social media tags, hashtag and more either when user type in text field or when appear a text read only.

Mohamed Nasr 4 Jul 25, 2022
A flutter package which will help you to create a draggable widget that can be dragged around the screen.

A flutter package which will help you to create a draggable widget that can be dragged around the screen. Demo Features ?? Manually Control the positi

Adar 31 Aug 10, 2022
A new flutter package project which contains lots of beautiful alert dialog that will help you lot to create beautiful awesome alert box very quickly and easily.

A new flutter package project which contains lots of beautiful alert dialog that will help you lot to create beautiful awesome alert box very quickly and easily.

Karan Soni 8 Jan 8, 2022
Flutter package that provides you custom clippers to help you achieve various custom shapes.

flutter_custom_clippers Flutter package that provides you custom clippers to help you achieve various custom shapes. Usage To use this plugin, add flu

Damodar Lohani 291 Dec 23, 2022
A package help you to make api call and handle error faster, also you can check for internet before call api.

http_solver ##not for production use, only for learning purpose. A package help you to make api call and handle error faster, also you can check for i

Abdelrahman Saed 1 Jun 18, 2020
A Flutter library aims to help you create animated, simple, and stylish Material Dialogs in your app.

Flutter Material Dialogs Flutter Material Dialogs ?? A Flutter library aims to help you create ????animated, ?? simple, ?? stylish Material Dialogs in

Ezaldeen Sahb 69 Dec 25, 2022
This package adds CustomRefreshIndicator widget that allows you to create whatever indicator you want.

Custom Refresh Indicator A flutter package that allows you to easily create a custom refresh indicator widget. TLDR; ONLINE DEMO! QUICK START CustomRe

Kamil Klyta 315 Dec 16, 2022
This project is a NGO which let you donate anything or even let you ask for help to people.

ngo_app This app is written in flutter using dart language. Getting Started This project is a NGO which let you donate anything or even let you ask fo

null 1 May 8, 2022
Introduction to flutter app final input

TASK CREATOR Introduction to Flutter URSB Webinar Topics What is flutter Why Flutter ? Flutter architecture Advantage and Disadvantage Widgets State A

Nehry Dedoro 2 Aug 28, 2022
MoneyTextFormField is one of the flutter widget packages that can be used to input values in the form of currencies, by displaying the output format in realtime.

MoneyTextFormField MoneyTextFormField is one of the flutter widget packages that can be used to input values in the form of currencies, by displaying

Fadhly Permata 11 Jan 1, 2023
Masked text input formatter for flutter.

mask_text_input_formatter The package provides TextInputFormatter for TextField and TextFormField which format the input by a given mask. Example Chec

Sergey 200 Dec 25, 2022
Input fields for Flutter standalone or within a form

Flutter Input Widgets - Standalone or within a Form → flutter_input This package provides input widgets (fields) to manipulate data. The data to manip

null 7 Mar 14, 2021
This is an auction application just like eBay. Using firebase as the backend for signup & sign-in functionality. In addition to that, it's a two pages application with user bid in input and count down view.

Nilam This is an auction application just like eBay. Using firebase as the backend for signup & sign-in functionality. In addition to that, it's a two

Md. Siam 5 Nov 9, 2022