Skip to content

Commit

Permalink
fix(TM-43187): QWalk - take a photo on iPad is sideways
Browse files Browse the repository at this point in the history
  • Loading branch information
thelukewalton committed Jul 17, 2024
1 parent 8400c95 commit 0734b24
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/src/components/organisms/camera/camera_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<AwesomeFilter>? 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<XFile>(
Expand Down
12 changes: 11 additions & 1 deletion lib/src/components/organisms/file_picker/file_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -144,6 +148,7 @@ class ZdsFilePickerConfig {
int? maxPixelSize,
Set<String>? allowedExtensions,
bool? useLiveMediaOnly,
bool? useSystemCamera,
List<ZdsFilePickerOptions>? options,
}) {
return ZdsFilePickerConfig(
Expand All @@ -154,6 +159,7 @@ class ZdsFilePickerConfig {
allowedExtensions: allowedExtensions ?? this.allowedExtensions,
options: options ?? this.options,
useLiveMediaOnly: useLiveMediaOnly ?? this.useLiveMediaOnly,
useSystemCamera: useSystemCamera ?? this.useSystemCamera,
);
}

Expand Down Expand Up @@ -649,7 +655,11 @@ extension _Methods on ZdsFilePickerState {
Future<void> _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,
Expand Down

0 comments on commit 0734b24

Please sign in to comment.