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

number_pad_keyboard 封面
套件詳情v0.0.6

number_pad_keyboard

一個 Flutter 套件,提供可自訂的數字鍵盤,用於輸入 PIN 碼或數位輸入。它包含數字和按鈕的自訂樣式等功能。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
52
喜歡數
90
Pub 分數
160

安裝套件

flutter pub add number_pad_keyboard

套件介紹

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

一個 Flutter 套件,提供可自訂的數字鍵盤,專為輸入 PIN 碼或數位輸入而設計。它允許開發者透過自訂樣式來調整數字和按鈕的外觀,確保跨平台的一致性。此鍵盤針對行動與桌面環境進行優化,支援 Android、iOS、Web、macOS、Windows 與 Linux。適用於驗證流程、付款輸入或任何需要安全數位輸入的場景。

適用情境

  • PIN碼輸入
  • 安全的數字輸入
  • 支付表單欄位
  • 驗證畫面
  • 使用者ID驗證
  • 數位鍵盤介面

主要特色

  • 可自訂的按鈕樣式
  • 跨平台相容性
  • PIN 碼聚焦設計
  • 可設定的數字佈局
  • 響應式 UI 元件
  • 與 TextFormField 的輕鬆整合

適合對象

  • 行動應用程式開發人員
  • Web 應用程式創建者
  • 桌面應用程式建構工具
  • 注重安全的應用程式
  • 需要數值輸入的表單

使用建議

  • 僅限數字輸入
  • 無內建驗證
  • 需要手動處理輸入事件
  • 不適合用於文字輸入
  • 可能需要額外的樣式以支援深色模式

原始 README

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

Number Pad Keyboard

A Flutter package that provides a customizable number pad keyboard widget for entering PIN codes or numeric input.

Features

  • Customizable Design: Easily customize the look and feel of the number pad keyboard.
  • PIN Code Entry: Suitable for entering PIN codes or any numeric input in Flutter applications.
  • Flexible Usage: Integrate seamlessly into any Flutter project requiring a numeric keyboard interface.

Installation

Add the following dependency to your pubspec.yaml file:

dependencies:
  number_pad_keyboard: ^1.0.0

Importing

To use the Number Pad Keyboard widget in your Flutter project, import it as follows:

import 'package:number_pad_keyboard/number_pad_keyboard.dart';

Example


import 'package:flutter/material.dart';
import 'package:number_pad_keyboard/number_pad_keyboard.dart';

void main() {
  runApp(
    const MyApp(),
  );
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Number Pad Keyboard Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final TextEditingController _textController = TextEditingController();

  void _addDigit(int digit) {
    if (_textController.text.length < 10) {
      setState(() {
        _textController.text = _textController.text + digit.toString();
      });
    }
  }

  void _backspace() {
    if (_textController.text.isNotEmpty) {
      setState(() {
        _textController.text =
            _textController.text.substring(0, _textController.text.length - 1);
      });
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Number Pad Keyboard Example'),
      ),
      body: SizedBox(
        width: double.infinity,
        child: Column(
          mainAxisAlignment: MainAxisAlignment.end,
          children: <Widget>[
            Padding(
              padding: const EdgeInsets.all(20.0),
              child: TextFormField(
                controller: _textController,
                decoration: const InputDecoration(
                  border: OutlineInputBorder(),
                  labelText: 'PIN Code',
                ),
                readOnly: true,
                textAlign: TextAlign.center,
                style: const TextStyle(fontSize: 24.0),
              ),
            ),

            const SizedBox(height: 200.0,),

            NumberPadKeyboard(
              addDigit: _addDigit,
              backspace: _backspace,
              enterButtonText: 'ENTER',
              onEnter: () {
                debugPrint('PIN Code: ${_textController.text}');
              },
            ),
          ],
        ),
      ),
    );
  }
}

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。