random_number_keypad 1.0.1 copy "random_number_keypad: ^1.0.1" to clipboard
random_number_keypad: ^1.0.1 copied to clipboard

A customizable Flutter widget providing a secure numeric keypad with random key positions, PIN masking, customizable length, and callback on PIN entry completion.

RandomNumberKeypad #

RandomNumberKeypad is a customizable Flutter widget that provides a secure numeric keypad with randomly positioned keys for PIN input. It is designed to enhance user security by shuffling the keypad layout after every use. The widget allows for masked or visible PIN entry and supports various PIN lengths.

Features #

  • Numeric keypad with random key positions.
  • Customizable PIN length (default is 4).
  • Option to show or hide PIN input (masked input).
  • Callback when the user completes PIN entry.
  • Dismissible keyboard overlay.

Installation #

Add the widget file random_number_keypad.dart to your project and import it:

import 'package:random_number_keypad/random_number_keypad.dart';

Usage #

Basic Example #

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('Random Number Keypad')),
        body: Center(
          child: RandomNumberKeypad(
            pinLength: 4,
            onComplete: (pin) {
              print('Entered PIN: $pin');
            },
            showInput: false, // Set to true to show PIN input
          ),
        ),
      ),
    );
  }
}

Parameters #

Parameter Type Default Description
pinLength int 4 The length of the PIN to be entered.
onComplete Function(String) Required A callback function triggered when the user completes the PIN entry. The entered PIN is passed as a string.
showInput bool true Determines whether the entered PIN should be visible (true) or masked (false).

Customization #

  • Randomized Keys: Each time the keyboard is shown, the numeric keys are shuffled to ensure secure PIN entry.
  • Keyboard Overlay: The keyboard appears as a dismissible overlay, ensuring it doesn't interfere with the app's layout.

Example of Masked Input #

To hide the PIN input, set showInput to false:

RandomNumberKeypad(
  pinLength: 6,
  onComplete: (pin) {
    print('Entered PIN: $pin');
  },
  showInput: false,
)

Contributions #

Feel free to contribute by submitting issues or pull requests. All contributions are welcome!

License #

This widget is released under the MIT License.


Happy coding with RandomNumberKeypad! 🎉

2
likes
0
points
5
downloads

Publisher

verified publishersivaprasadnk.dev

Weekly Downloads

A customizable Flutter widget providing a secure numeric keypad with random key positions, PIN masking, customizable length, and callback on PIN entry completion.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on random_number_keypad