FLUTTER ECOSYSTEM

MahmoudAhmed121/number_pad_keyboard

PIN 코드 또는 숫자 입력을 위한 사용자 정의 가능한 숫자 패드 키보드를 제공하는 플러터 패키지입니다. 숫자 및 버튼에 대한 커스텀 스타일링 기능이 포함되어 있습니다.

숫자 패드 키보드 프로젝트 이미지
Stars
1
Forks
0
최근 푸시(UTC)
2024. 7. 9.
프로젝트 상태
활성
Mahmoud GitHub avatar
GITHUB User

Mahmoud ↗

Hello! My name is Mahmoud Ahmed and I am a computer and information technology! I am preparing for a career in mobile app design with Flutter and aspire

언어Dart

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 3 개
  • flutter{"sdk":"flutter"}
  • flutter_test개발 의존성{"sdk":"flutter"}
  • flutter_lints개발 의존성^3.0.0

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기

Number Pad Keyboard

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

https://raw.githubusercontent.com/MahmoudAhmed121/number_pad_keyboard/master/num_pad_image.png

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}');
              },
            ),
          ],
        ),
      ),
    );
  }
}