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

套件詳情v3.0.1

extended_masked_text

一組小型自定義 TextEditingControllers,可為 Flutter 應用程式提供遮罩文字輸入功能

AndroidiOSmacOSWindowsLinux
近 30 天下載
2.4萬
喜歡數
147
Pub 分數
160

安裝套件

flutter pub add extended_masked_text

套件介紹

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

ExtendedMaskedText 是一個 Flutter 套件,提供用於建立帶格式文字輸入的自訂 TextEditingControllers,讓使用者能夠以預定格式輸入電話號碼、日期或身分證字號等資料。它支援即時格式化與輸入過程中的驗證,透過在輸入時確保結構正確來提升使用者體驗。此套件輕量且能無縫整合至多個平台的表單與輸入欄位中。

適用情境

  • 帶結構化資料的表單輸入
  • 帶格式的電話號碼輸入
  • 帶遮罩的日期和時間輸入
  • 信用卡號碼格式化
  • 基於用戶輸入的動態遮罩生成

主要特色

  • 即時輸入遮罩
  • 可自定義的遮罩模式
  • 自動光標定位
  • 支援動態遮罩
  • 內建驗證邏輯

適合對象

  • 開發表單密集型應用的開發者
  • 需要嚴格輸入格式的應用程式
  • 跨平台行動與桌面應用程式
  • 強調輸入準確性的使用者介面

使用建議

  • 可能需要仔細設計遮罩模式
  • 僅限文字輸入場景
  • 嵌套或可變遮罩可能帶來的複雜性
  • 不適用於非文字輸入類型
  • 需要手動處理遮罩中的特殊字元

原始 README

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

Extended Masked Text Logo

Extended Masked Text

This package is based on the source code of flutter_masked_text and is an attempt to fix some bugs and continue the development of the original one.

Usage

Import the library

import 'package:extended_masked_text/extended_masked_text.dart';

MaskedTextController

Create your mask controller:

final controller = MaskedTextController(mask: '000.000.000-00');

Set controller to your text field:

return MaterialApp(
    title: 'Masked Text Demo',
    theme: ThemeData(
        primarySwatch: Colors.blue,
    ),
    home: SafeArea(
        child: Scaffold(
            body: Column(
                children: <Widget>[
                    TextField(
                        // Add controller to TextField
                        controller: controller,
                    ),
                ],
            ),
        ),
    ),
);

MoneyMaskedTextController

Create your mask controller:

final controller = MoneyMaskedTextController(leftSymbol: 'R\$ ');

Set controller to your text field:

return MaterialApp(
    title: 'Money Masked Text Demo',
    theme: ThemeData(
        primarySwatch: Colors.blue,
    ),
    home: SafeArea(
        child: Scaffold(
            body: Column(
                children: <Widget>[
                    TextField(
                        // Add controller to TextField
                        controller: controller,
                    ),
                ],
            ),
        ),
    ),
);

所屬分類

原始碼儲存庫

使用此套件的專案