搜尋套件、儲存庫與 APP 分類

flutter_verification_code_field 封面
套件詳情v1.2.2

flutter_verification_code_field

Flutter 驗證碼輸入框。主要用於從授權郵件或訊息中輸入或貼上 OTP 碼。

AndroidiOS
近 30 天下載
96
喜歡數
27
Pub 分數
160

安裝套件

flutter pub add flutter_verification_code_field

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個用於建立乾淨、可自訂驗證碼輸入欄位的 Flutter 套件,非常適合從電子郵件或簡訊中輸入或貼上 OTP 碼。支援欄位間的自動焦點管理、貼上偵測,並在各裝置上提供流暢的使用者體驗。設計時著重於簡潔與易用性,能順暢整合至需要一次性密碼的身份驗證流程中。

適用情境

  • 登入時輸入OTP
  • 雙因素驗證
  • 透過電子郵件/SMS 進行帳戶驗證
  • 無密碼登入
  • 6位驗證碼的表單驗證
  • 行動應用程式入門

主要特色

  • 在程式碼欄位之間自動對焦
  • 從剪貼簿粘貼檢測
  • 可自訂樣式
  • 適用於所有螢幕尺寸的響應式設計
  • 同時支援 Android 和 iOS
  • 與表單控制器輕鬆整合

適合對象

  • 開發人員建構驗證流程
  • 需要OTP輸入的應用程式
  • 以使用者體驗為導向的行動應用程式
  • 專案需要最少設定的程式碼欄位
  • 注重可訪問性和可用性的團隊

使用建議

  • 需要手動處理驗證邏輯
  • 限制為單行數字輸入
  • 不支援動態欄位數量的內建支援
  • 可能需要為非預設主題添加額外的樣式
  • 不適用於多步驟驗證工作流程

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Flutter Verification Code Field

A flutter package which contains a verification code field with a number of advantages, namely with the ability to customize your own validation pattern, customize the number of OTP fields or their size, as well as the spacing between OTP fields, also supports text insertion or character replacement in any cell.


Platform


Table of contents

Installing

1. Depend on it

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

dependencies:
  flutter_verification_code_field: ^1.0.0
2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get
3. Import it

Now in your Dart code, you can use:

import 'package:flutter_verification_code_field/flutter_verification_code_field.dart';

Usage

VerificationCodeField is a Hook Widget that can be used for OTP verification. Include it in your code like:

    VerificationCodeField(
      length: 5,
      onFilled: (value) => print(value),
      size: Size(30, 60),
      spaceBetween: 16,
      matchingPattern: RegExp(r'^\d+$'),
    );

It has many configurable properties, including:

  • length – Number of the OTP Fields
  • size – Size of the single OTP Field
  • spaceBetween – Space between the OTP fields
  • matchingPattern – Pattern for validation

There are also custom callback:

  • onFilled – Callback function that is called when the verification code is filled

Bugs or Requests

If you encounter any problems feel free to open an issue. If you feel the library is missing a feature, please raise a ticket on GitHub and I'll look into it. Pull request are also welcome.

所屬分類

依賴

依賴清單 2 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。