Mu Biometric Auth 🔐
A highly customizable, responsive, and premium biometric authentication package for Flutter. Supports Fingerprint, FaceID, and TouchID on both Android and iOS with glassmorphic UI and smooth animations.
✨ Features
- Multi-Platform: Full support for iOS and Android.
- Premium UI: Glassmorphic design with backdrop filters and smooth micro-animations.
- Highly Customizable: Customize colors, gradients, icons, Lottie animations, blur intensity, and typography.
- Responsive: Built with
flutter_screenutilto ensure it looks great on any screen size. - Simplified API: One-line implementation for complex authentication flows.
- Validation Included: Handles error states, lockouts, and cancellations gracefully.
🚀 Installation
Add the following to your pubspec.yaml:
dependencies:
mu_biometric_auth: ^1.0.0
Platform Setup
Android
Add the biometric permission to your AndroidManifest.xml:
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
iOS
Add the FaceID usage description to your Info.plist:
<key>NSFaceIDUsageDescription</key>
<string>We need biometric authentication to secure your data.</string>
🛠 Usage
Simple Implementation
import 'package:mu_biometric_auth/mu_biometric_auth.dart';
void _authenticate() {
MuBiometricPrompt.show(
context,
reason: 'Please authenticate to proceed.',
onAuthenticated: () {
// Handle success
},
onError: (error) {
// Handle error
},
);
}
Full Customization
MuBiometricPrompt.show(
context,
title: 'Secure Vault',
description: 'Unlock your private files',
reason: 'Authentication required for Vault access',
authenticateButtonText: 'Unlock Now',
blurIntensity: 15.0,
gradientColors: [Colors.deepPurple, Colors.blueAccent],
lottieAsset: 'assets/security_animation.json', // Optional Lottie support
onAuthenticated: () => print('Success!'),
onError: (e) => print('Error: $e'),
);
🎨 Customization Options
| Property | Description | Default |
|---|---|---|
title |
The main header text | 'Secure Access' |
description |
Subtext explaining why auth is needed | 'Authenticate to continue' |
reason |
The reason displayed by the OS prompt | required |
gradientColors |
Colors for the primary button and icons | Purple, Blue |
blurIntensity |
Intensity of the background blur | 10.0 |
lottieAsset |
Path to a custom Lottie animation | null |
customIcon |
Custom IconData if Lottie is not used | fingerprint |
📝 License
MIT License.