vercoder_inputer

Enter the verification code received by the phone or other device.
一个基于flutter的验证码输入框控件.

Demo

控制用户精准输入长度.

Features

  • x 可以自定义验证码长度
  • x 当全部输入完成后,会自动调用协议方法,通过代理返回验证码及上下文context
  • x 可以通过verCode属性获取输入的验证码
  • x 用户自定义控件的尺寸

Version

nameVercodeEditText
latest0.8.0

Usage

1.第一步,在你的pubspec.yml声明

   dependencies:
     vercoder_inputer: ^0.8.0

2.添加引用

import 'package:vercoder_inputer/vercoder_inputer.dart';
...

3.在需要使用的页面创建控件,并声明遵守协议方法

class _MyHomePageState extends State < MyHomePage > implements InputerProtocol{

    //实现协议方法
    void didFinishedInputer(WGQVerCodeInputer inputer,BuildContext ctx,String verCode){
        print("verCode is $verCode");
        
        //判断验证码是否正确
        bool correct = false;//(此处修改成你自己的判断逻辑)
        if (!correct) {
        	inputer.reset();
        }
    }
 
 
 
    @override
    Widget build(BuildContext context) {
        //自定义外观样式(可选)
       Options opt = Options();
       opt.fontSize = 22.0;
       opt.fontColor = Colors.indigo;
       opt.fontWeight = FontWeight.w700;
       opt.emptyUnderLineColor = Colors.green;
       opt.inputedUnderLineColor = Colors.pink;
       opt.focusedColor = Colors.orange;
        //创建控件,并指明代理对象(delegate)
        WGQVerCodeInputer verCodeInputer = WGQVerCodeInputer(codeLength: 6, size: Size(375.0, 48.0), options:opt,delegate:this, );
        return new Scaffold(
            appBar: new AppBar(
                title: new Text(widget.title),
            ),
            body: Padding(
                padding: EdgeInsets.only(top: 100.0),
                child: verCodeInputer,
            )
        );
    }

Contact me

Libraries

WGQVerCodeInputer

Dart

dart:ui
Built-in types and core primitives for a Flutter application. [...]

Core

dart:async
Support for asynchronous programming, with classes such as Future and Stream. [...]
dart:collection
Classes and utilities that supplement the collection support in dart:core. [...]
dart:convert
Encoders and decoders for converting between different data representations, including JSON and UTF-8. [...]
dart:core
Built-in types, collections, and other core functionality for every Dart program. [...]
dart:developer
Interact with developer tools such as the debugger and inspector. [...]
dart:math
Mathematical constants and functions, plus a random number generator. [...]
dart:typed_data
Lists that efficiently handle fixed sized data (for example, unsigned 8 byte integers) and SIMD numeric types. [...]

VM

dart:io
File, socket, HTTP, and other I/O support for non-web applications. [...]
dart:isolate
Concurrent programming using isolates: independent workers that are similar to threads but don't share memory, communicating only via messages. [...]