fingerprint/MODIFICATION_IMPLEMENTATION.md
Aastha Shrivastava 3132b7e8cd first commit
2026-01-17 12:54:01 +05:30

74 lines
3.7 KiB
Markdown

# Modification Implementation Plan: Camera Stream & Isolate Processing
## Phase 1: Preparation & Dependencies
- [x] Add `opencv_dart` dependency to `pubspec.yaml`.
- [x] Run `flutter pub get`.
- [x] Run existing analysis to ensure a clean slate.
## Phase 2: Domain & Isolate Logic
- [x] Create `lib/domain/entities/quality_status.dart`.
- [x] Create `lib/core/services/image_processor_isolate.dart`.
- [x] Implement the Isolate entry point `spawn`.
- [x] Implement the message handling loop.
- [x] Implement logic to convert `CameraImage` to `cv.Mat`.
- [x] Implement `Laplacian` variance (Sharpness).
- [x] Implement `mean` intensity (Luminance).
- [x] Implement ROI logic.
- [x] Return `QualityStatus`.
## Phase 3: Data Layer Updates
- [x] Update `lib/data/datasources/camera_datasource.dart`:
- [x] Add `startImageStream` method signature and implementation.
- [x] Add `stopImageStream` method signature and implementation.
- [x] Update `lib/domain/repositories/scanner_repository.dart` interface.
- [x] Update `lib/data/repositories/scanner_repository_impl.dart` implementation.
## Phase 4: Presentation Layer - State Management
- [x] Update `lib/presentation/providers/scanner_provider.dart`:
- [x] Update `ScannerState` to include `QualityStatus`.
- [x] Update `ScannerNotifier`:
- [x] Initialize and dispose the Isolate.
- [x] Implement `startScanning` to listen to camera stream.
- [x] Implement throttling logic (5-10 FPS).
- [x] Send frames to Isolate and update state with results.
## Phase 5: Presentation Layer - UI
- [x] Create `lib/presentation/widgets/fingerprint_guide_painter.dart`:
- [x] Implement `CustomPainter` to draw the guide rectangle.
- [x] Accept color/status as parameters.
- [x] Update `lib/presentation/widgets/camera_preview_widget.dart`:
- [x] Replace static overlay with `CustomPaint` using `FingerprintGuidePainter`.
- [x] Connect to `ScannerState` for dynamic color updates.
- [x] Update `lib/presentation/screens/scanner_screen.dart`:
- [x] Update "Capture" button to be enabled/disabled based on `QualityStatus`.
- [x] Trigger `startScanning` on ready state.
## Phase 6: Verification & Cleanup
- [x] Run `dart_fix`.
- [x] Run `flutter analyze`.
- [x] Run `dart_format`.
- [x] Verify functionality (requires physical device for full camera stream test, or mock for logic).
## Phase 7: UI Refinements & Display Configuration
- [x] Create `lib/presentation/providers/display_config_provider.dart` for managing UI visibility.
- [x] Create `lib/presentation/widgets/display_config_dialog.dart` for settings.
- [x] Update `lib/presentation/widgets/camera_preview_widget.dart`:
- [x] Fix aspect ratio using `Transform.scale` to fill screen (Live View).
- [x] Integrate `DisplayConfig` to toggle guide, quality, and status text.
- [x] Update `lib/presentation/screens/scanner_screen.dart`:
- [x] Add Settings button to AppBar.
## Phase 8: Quality Analysis Tuning
- [x] Update `lib/core/services/quality_checker.dart`:
- [x] Increase `isBigEnough` threshold from 5% to 25% to prevent background objects from validating the position check when the finger is removed.
## Journal
- Initial plan created.
- Phase 1 complete: Added `opencv_dart` and verified dependencies.
- Phase 2 complete: Implemented Isolate logic with `opencv_dart`.
- Phase 3 complete: Updated Data and Domain layers for streaming.
- Phase 4 complete: Implemented State Management with Throttled Stream.
- Phase 5 complete: Implemented UI with CustomPainter and dynamic feedback.
- Phase 6 complete: Verified and cleaned up.
- Phase 7 complete: Fixed CameraPreview aspect ratio and added Display Settings dialog.
- Phase 8 complete: Tuned quality checker to strictly enforce finger presence (25% area coverage).