diff --git a/lib/src/components/organisms/camera/camera_page.dart b/lib/src/components/organisms/camera/camera_page.dart index f23c500..56aa3bf 100644 --- a/lib/src/components/organisms/camera/camera_page.dart +++ b/lib/src/components/organisms/camera/camera_page.dart @@ -92,11 +92,12 @@ class ZdsCamera extends StatelessWidget { bool showPreview = true, bool rootNavigator = true, bool saveGPSLocation = false, + bool useSystemCamera = false, CaptureRequestBuilder? photoPathBuilder, CaptureRequestBuilder? videoPathBuilder, List? filters, }) async { - if (kIsWeb) { + if (useSystemCamera || kIsWeb) { return image_picker.ImagePicker().pickImage(source: image_picker.ImageSource.camera); } else { return Navigator.of(context, rootNavigator: rootNavigator).push( diff --git a/lib/src/components/organisms/file_picker/file_picker.dart b/lib/src/components/organisms/file_picker/file_picker.dart index dc20e3c..021daa2 100644 --- a/lib/src/components/organisms/file_picker/file_picker.dart +++ b/lib/src/components/organisms/file_picker/file_picker.dart @@ -65,6 +65,7 @@ class ZdsFilePickerConfig { this.maxPixelSize = 0, this.allowedExtensions = const {}, this.useLiveMediaOnly = false, + this.useSystemCamera = false, this.showCapturePreview = true, this.giphyKey, this.options = const [ @@ -107,6 +108,9 @@ class ZdsFilePickerConfig { /// images will always be compressed with 250Kb as max size. final int maxFileSize; + /// Used to define whether to use system camera or not. + final bool useSystemCamera; + /// The options that will be shown in the file picker. /// /// Defaults to all of the options. @@ -144,6 +148,7 @@ class ZdsFilePickerConfig { int? maxPixelSize, Set? allowedExtensions, bool? useLiveMediaOnly, + bool? useSystemCamera, List? options, }) { return ZdsFilePickerConfig( @@ -154,6 +159,7 @@ class ZdsFilePickerConfig { allowedExtensions: allowedExtensions ?? this.allowedExtensions, options: options ?? this.options, useLiveMediaOnly: useLiveMediaOnly ?? this.useLiveMediaOnly, + useSystemCamera: useSystemCamera ?? this.useSystemCamera, ); } @@ -649,7 +655,11 @@ extension _Methods on ZdsFilePickerState { Future _handleCameraAction(BuildContext context) async { try { if (!mounted) return; - final photo = await ZdsCamera.takePhoto(context, showPreview: config.showCapturePreview); + final photo = await ZdsCamera.takePhoto( + context, + showPreview: config.showCapturePreview, + useSystemCamera: config.useSystemCamera, + ); if (photo != null && context.mounted) { final file = await onPicked( context,