🔒 Blur Lock

A Flutter package that provides a secure card with blur lock overlay, supporting PIN authentication and biometric unlock (fingerprint/face).

✨ Features

  • 🔐 Blur overlay to lock sensitive widgets (cards, views, etc.)
  • 🔑 Unlock with custom PIN
  • 👆 Unlock with fingerprint or face (using local_auth)
  • 🔒 Re-lock anytime with a single tap
  • 📱 Works on both Android & iOS

📸 Demo


🚀 Installation

Add to your pubspec.yaml:

dependencies:
  blur_lock: ^1.0.0
  local_auth: ^2.3.0
  shared_preferences: ^2.2.0
Then run:
flutter pub get
⚙️ Setup
Android
In android/app/src/main/kotlin/.../MainActivity.kt use:
import io.flutter.embedding.android.FlutterFragmentActivity

class MainActivity: FlutterFragmentActivity() {
}
Add permissions to AndroidManifest.xml:
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
iOS
In ios/Runner/Info.plist add:
<key>NSFaceIDUsageDescription</key>
<string>We use Face ID to secure your data</string>
🛠 Usage
Initialize a default PIN (optional)
void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  // Set default PIN if not already set
  final existingPin = await LockManager.getPin();
  if (existingPin == null) {
    await LockManager.setPin("1234");
  }

  runApp(const MyApp());
}
SecureCard Widget
SecureCard(
  enableBiometrics: true,  // enable fingerprint/face unlock
  blurStrength: 12,
  child: Column(
    mainAxisAlignment: MainAxisAlignment.center,
    children: const [
      Icon(Icons.account_balance_wallet,
          size: 40, color: Colors.deepPurple),
      SizedBox(height: 12),
      Text('Bank Account',
          style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
      SizedBox(height: 8),
      Text('Account No: 1234 5678 9012'),
      Text('Balance: ₹1,23,456'),
    ],
  ),
)
🔑 Unlock Options
PIN Unlock: User taps the lock icon → enters PIN → content unlocks.
Biometric Unlock: User taps fingerprint icon → device shows biometric sheet → unlocks on success.
Lock Again: Tap the lock-open

Libraries

blur_lock