blur_lock 0.0.1
blur_lock: ^0.0.1 copied to clipboard
A Flutter package to secure your sensitive UI content with a blur effect, PIN authentication, and biometric authentication (fingerprint/face unlock). Easily wrap any widget (like cards, containers, or [...]
import 'package:flutter/material.dart';
import 'package:blur_lock/blur_lock.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// Check if a PIN is already set, if not set a default one
final existingPin = await LockManager.getPin();
if (existingPin == null) {
await LockManager.setPin("1234");
print("Default PIN set: 1234");
}
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Blur Lock + Biometrics',
theme: ThemeData(
primarySwatch: Colors.deepPurple,
useMaterial3: true,
),
home: Scaffold(
appBar: AppBar(
title: const Text('Blur Lock + Biometrics'),
centerTitle: true,
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SecureCard(
enableBiometrics: true,
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'),
],
),
),
const SizedBox(height: 20),
const Text(
'Tap the fingerprint icon to unlock with biometrics\nor the lock icon to enter PIN',
textAlign: TextAlign.center,
style: TextStyle(color: Colors.grey),
),
],
),
),
),
);
}
}