flutter_secure_pin_pad

pub package Build Status License: MIT Flutter

An enterprise-grade, highly customizable PIN entry pad widget for Flutter. Designed for banking, fintech, and security-sensitive apps, featuring biometric auth fallback, anti-shoulder surfing shuffle mode, shake error feedback, and brute-force lockout timers.


๐ŸŒŸ Key Features

  • ๐Ÿ” Anti-Shoulder Surfing Mode: Option to dynamically shuffle digit positions on every press to prevent screen recording and shoulder surfing attacks.
  • ๐Ÿ‘† Biometric Fallback Support: Native integration hook for Face ID / Fingerprint authentication.
  • โฑ๏ธ Brute-Force Lockout Protection: Automatically locks out entry after configurable failed attempt thresholds with animated countdown timers.
  • ๐Ÿ“ณ Haptic Feedback & Animations: Built-in elastic shake animations and native haptic feedback response on keypress.
  • ๐ŸŽจ Full Theme Customization: Dark and Light mode presets with customizable dot shapes, button shapes, colors, and icons.

๐Ÿ“ฆ Installation

Add flutter_secure_pin_pad to your pubspec.yaml:

dependencies:
  flutter_secure_pin_pad: ^1.0.0

Then run:

flutter pub get

๐Ÿš€ Quick Start

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

class MyPinScreen extends StatefulWidget {
  @override
  State<MyPinScreen> createState() => _MyPinScreenState();
}

class _MyPinScreenState extends State<MyPinScreen> {
  final PinPadController _controller = PinPadController(
    pinLength: 4,
    maxFailedAttempts: 3,
    lockoutDuration: const Duration(seconds: 30),
  );

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: SecurePinPad(
          controller: _controller,
          enableDigitShuffle: true, // Anti-shoulder surfing
          theme: PinPadTheme.dark(),
          onPinSubmitted: (pin) {
            if (pin == '1234') {
              _controller.recordSuccess();
              print('Access Granted!');
            } else {
              _controller.recordFailedAttempt();
              print('Invalid PIN');
            }
          },
          onBiometricPressed: () {
            print('Biometric auth pressed');
          },
        ),
      ),
    );
  }
}

๐Ÿงช Testing

Run automated package tests:

flutter test

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

Developed with โค๏ธ by Olamilekan Adeyemi (@lekthedeveloper).