Closed nguyenxuankiet262 closed 7 months ago
Please provide me with the logic of the code you are using. I will assist as quickly as possible
@nguyenxuankiet262 This error occurs when you call openCropper while openPicker has not yet closed.
@nguyenxuankiet262 This error occurs when you call openCropper while openPicker has not yet closed.
- Can you tell me what functionality you are looking for?
- Why not use the cropper directly within openPicker?
Hi! Thank for quick response
I have a function pick and crop multiple images so i can't use openPicker for cropping multiple images. I must use openCropper function to crop selected images picked from openPicker
Please provide me with the logic of the code you are using. I will assist as quickly as possible
final medias = await _picker.openPicker( cropping: true, localized: LocalizedImagePicker(), pickerOptions: HLPickerOptions( convertHeicToJPG: true, enablePreview: true, maxDuration: 60, maxSelectedAssets: 5, maxFileSize: 100 * 1024, usedCameraButton: false, mediaType: MediaType.image, convertLivePhotosToJPG: true, ), cropOptions: HLCropOptions( aspectRatioPresets: [CropAspectRatioPreset.original, CropAspectRatioPreset.square], compressQuality: 1, compressFormat: CompressFormat.jpg, croppingStyle: CroppingStyle.normal, ), ); if (medias.length > 1) { List<HLPickerItem> pickMedias = []; for (var image in medias) { try { var pickMedia = await _picker.openCropper( image.path, localized: LocalizedImagePicker(), cropOptions: HLCropOptions( aspectRatioPresets: [CropAspectRatioPreset.original, CropAspectRatioPreset.square], compressQuality: 1, compressFormat: CompressFormat.jpg, croppingStyle: CroppingStyle.normal, ), ); pickMedias.add(pickMedia); } catch (err) { print("err: $err"); } } }
Currently, the library does not support cropping multiple images at once. You will need to use await Future.delayed(const Duration(seconds: 1));
to ensure that openPicker is closed before using openCropper.
I will consider implementing the functionality to crop multiple images right now
@nguyenxuankiet262 The feature to crop multiple images has been supported. You can update to the new version
I'm using iphone 11 promax, os 17.2.1, xcode 15.1, Flutter SDK 3.3.9
it worked fine when crop images in openPicker function but when i call openCropper function, i got this issue
Attempt to present <CropViewController.CropViewController: 0x1062b1090> on <TLPhotoPicker.TLPhotosPickerViewController: 0x107857c00> (from <TLPhotoPicker.TLPhotosPickerViewController: 0x107857c00>) whose view is not in the window hierarchy.