Skip to content

Commit

Permalink
fix: fixed camera_android_camerax version issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Pranjal095 committed Mar 6, 2025
1 parent 738072b commit 3b173d0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 21 deletions.
27 changes: 8 additions & 19 deletions frontend/lib/screens/face_upload_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,6 @@ class _FaceUploadScreenState extends State<FaceUploadScreen> {
}
}

Widget _buildCameraPreview() {
int quarterTurns = 0;
if (_cameras != null && _cameras!.isNotEmpty) {
quarterTurns = _cameras![_selectedCameraIndex].sensorOrientation ~/ 90;
}
return RotatedBox(
quarterTurns: quarterTurns,
child: AspectRatio(
aspectRatio: 1 / _cameraController!.value.aspectRatio,
child: CameraPreview(_cameraController!),
),
);
}

Future<void> _detectFaces(XFile image) async {
final inputImage = InputImage.fromFilePath(image.path);
final List<Face> faces = await _faceDetector.processImage(inputImage);
Expand Down Expand Up @@ -206,11 +192,14 @@ class _FaceUploadScreenState extends State<FaceUploadScreen> {
height: 400,
child: _capturedImage == null
? (_cameraController != null && _cameraController!.value.isInitialized
? ClipRRect(
borderRadius: BorderRadius.circular(15),
child: _buildCameraPreview(),
)
: Center(child: CircularProgressIndicator()))
? AspectRatio(
aspectRatio: _cameraController!.value.aspectRatio,
child: ClipRRect(
borderRadius: BorderRadius.circular(15),
child: CameraPreview(_cameraController!),
),
)
: Center(child: CircularProgressIndicator()))
: ClipRRect(
borderRadius: BorderRadius.circular(15),
child: Image.file(File(_capturedImage!.path), fit: BoxFit.cover),
Expand Down
6 changes: 4 additions & 2 deletions frontend/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ dependencies:
permission_handler: ^11.3.1
timezone: ^0.10.0
camera: ^0.11.0+2
webview_flutter: ^4.10.0
google_mlkit_face_detection: ^0.12.0
google_mlkit_face_detection: ^0.11.0

dev_dependencies:
flutter_test:
Expand All @@ -91,6 +90,9 @@ dev_dependencies:

# flutter_launcher_icons: "^0.13.1"

dependency_overrides:
camera_android_camerax: 0.6.11

flutter_launcher_icons:
android: "launcher_icon"
ios: true
Expand Down

0 comments on commit 3b173d0

Please sign in to comment.