extended_image
extended_image copied to clipboard
GloblalKey ExtendedImageEditorState and then currentState is null
Hi guys, I am using this library for croping in the image. I am using ExtendedImage from file in GridView. I am getting GlobalKey<ExtendedImageEditorState> currentState variable NULL for some images. Can you please let me know what i am doing wrong?
Here is my code.
Container(
color: mListOfFiles[index].select! ? Colors.lightBlue : Colors.grey[300],
margin: EdgeInsets.all(5),
child: ExtendedImage.file(file,
fit: BoxFit.contain,
cacheRawData: true,
mode: ExtendedImageMode.editor,
extendedImageEditorKey: mListOfFiles[index].editorKey,
initEditorConfigHandler:(state){
return EditorConfig(
cropAspectRatio: state!.extendedImageInfo!.image.width > state.extendedImageInfo!.image.height ? ExCropAspectRatios.ratio5_4 : ExCropAspectRatios.ratio4_5
);
}
),
),
mListOfFiles.forEach((element) async {
if (element.editorKey!.currentState != null) {
Uint8List? listImageCropData = await ExCropAspectRatios.cropImageDataWithDartLibrary(state: element.editorKey!.currentState!);
if(listImageCropData != null)
{
String fileName = basename(element.imageFile!.path);
File editFile = File(
'${settings.selectedPresentationPath}/${cUserSittings.rowKey}_${appointment.phoneNumber}/${BLOBS.Cropped.toString()}/${fileName}');
editFile.writeAsBytesSync(listImageCropData);
}
}
else
{
print("Editkey current state is null.");
}
Thank you. Asif.
editor mode for every image in Gridview??
@zmtzawqlp Yes the editor mode is for every image in GridView.
Any update on this?
I encountered the same problem, the image that can be loaded will not be empty currentState, and the image that cannot be loaded will be reported as empty currentState
Hi @jsonsuxing after facing this problem, we had not find any solution to fix the crop in the gridview, so then we had removed the crop from GridView and instead we are cropping the image in a separate screen to crop it.
Thanks for your reply, I didn't crop it in the GridView, but selected it from the Android album, using the.file constructor. Some images can be displayed, some can't be displayed, I'm eating out now, I need more detailed parameters I can take a look at when I get back
---- Replied Message ---- | From | Asif @.> | | Date | 03/13/2024 17:15 | | To | fluttercandies/extended_image @.> | | Cc | jsonsuxing @.>, Mention @.> | | Subject | Re: [fluttercandies/extended_image] GloblalKey ExtendedImageEditorState and then currentState is null (Issue #497) |
Hi @jsonsuxing after facing this problem, we had not find any solution to fix the crop in the gridview, so then we had removed the crop from GridView and instead we cropping the image in a separate screen to crop it.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>