face_detection_lock 0.2.0
face_detection_lock: ^0.2.0 copied to clipboard
Face detection lock screen widget for Flutter. Unlocks when a face is detected.
Changelog #
All notable changes to this project will be documented in this file.
0.2.0 #
Added #
- Face verification — optional
verificationProviderparameter enables "only enrolled faces unlock" mode. FaceVerificationProvider— abstract interface for pluggable verification backends (local, cloud, or custom).LocalFaceVerificationProvider— on-device verification using ML Kit contour-based feature extraction and cosine similarity matching.FaceGateCloudProvider— REST client implementingFaceVerificationProviderwith configurablebaseUrl,apiKey,timeout,retryCount, andbasePath.FallbackVerificationProvider— wraps a primary and fallback provider for resilient verification (e.g. cloud-first with local fallback).FaceFeatureExtractor— normalized contour feature extraction with cosine similarity and feature averaging utilities.LivenessChecker— basic anti-spoofing via eye open probability and head euler angle checks.FaceTemplate/FaceVerificationResult/LivenessResultdomain models with JSON serialization.FaceTemplateStore— abstract template storage withInMemoryTemplateStoreimplementation.FaceDetectionUnverifiedstate — emitted when a face is detected but does not match any enrolled template.- Frame throttling — configurable
detectionInterval(default 300ms) skips redundant frames for battery efficiency. - Debounced lock/unlock —
lockDelayandunlockDelayprevent UI flicker from momentary detection gaps. - Smooth transitions —
AnimatedSwitcherwith configurabletransitionDurationbetween lock/unlock states. - Haptic feedback — optional
enableHapticFeedbackon state transitions. - Lifecycle awareness — automatically pauses detection when the app is backgrounded and resumes on foreground.
PauseDetection/ResumeDetectionevents andFaceDetectionPausedstate with previous-state restoration.- Configurable
camDirection,resolution, andminFaceSizeparameters. - BLoC unit tests (15 test cases) and widget tests (17 test cases).
- GitHub Actions CI pipeline (
flutter analyze+flutter test). - Example app with three demo modes: Basic, Verification, and Advanced.
- Comprehensive dartdoc comments on all public APIs.
MIGRATION.md— migration guide from v0.0.1.
Fixed #
- Memory leak — internal
CameraControlleris now properly disposed. - Image stream never stopped on dispose.
- Swapped
noFace/noCameraOnDevicewidget mapping. - Removed dead
Completercode.
Changed #
- Migrated from deprecated
google_ml_visiontogoogle_mlkit_face_detection. - Upgraded to Dart 3 / Flutter 3.x SDK constraints.
- Added
FaceDetectionPermissionDeniedandFaceDetectionInitializationFailederror states. - Added try-catch around camera init and face detection.
- Added configurable camera initialization timeout (
initTimeout). - Added explicit camera permission handling.
Dependencies #
google_mlkit_face_detection: ^0.12.0(replacesgoogle_ml_vision)http: ^1.2.0bloc_test: ^9.1.0(dev)mocktail: ^1.0.0(dev)
0.0.1 #
- Initial release.
- Widget locks screen when no face is detected.
- Face snapshot accessible via callback.