numpad 0.0.2 copy "numpad: ^0.0.2" to clipboard
numpad: ^0.0.2 copied to clipboard

Numpad for Pincode input on android and ios. Exposes onTap event for the number but 99 for back button. Check example.

example/lib/main.dart

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

void main() {
  runApp(const PasscodeScreen());
}

class PasscodeScreen extends StatefulWidget {
  const PasscodeScreen({Key? key}) : super(key: key);

  @override
  State<PasscodeScreen> createState() => _PasscodeScreenState();
}

class _PasscodeScreenState extends State<PasscodeScreen> {
  String code = "";
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        backgroundColor: Colors.white,
        body: SafeArea(
          child: SingleChildScrollView(
            padding: const EdgeInsets.all(16),
            child: Column(
              children: [
                const Text("Enter Passcode"),
                NumPad(
                  onTap: (val) {
                    if (val == 99) {
                      if (code.isNotEmpty) {
                        setState(() {
                          code = code.substring(0, code.length - 1);
                        });
                      }
                    } else {
                      setState(() {
                        code += "$val";
                      });
                    }
                    print(code);
                  },
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
1
likes
150
pub points
71%
popularity

Publisher

verified publisheracloe.com

Numpad for Pincode input on android and ios. Exposes onTap event for the number but 99 for back button. Check example.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on numpad