[Mobile] Resize image getting an error on Read-only mode #674
-
I used to
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
This is due to a type cast bug in flutter_quill/src/widgets/embed/default_embed_builder.dart line 27 declares image as var . in !readOnly mode, it is ok because line 128 returns image wrapped in a GestureDetector as its child, You can fix this problem by providing your own embed builder with QuillEditor, in your constructor call. |
Beta Was this translation helpful? Give feedback.
-
He uses one QuillEditor[readOnly = false] to edit, which allows image to be resized, He then uses another QuillEditor[readOnly = true] to display it to other users like news articles. his problem is when padding are added to images in the readOnly = false editor, the underlying data structure is no longer workable with his other readOnly editor due to the type cast bug. anyway the fix is very easy, just inline the content of _menuOptionsForReadonlyImage to the caller code and the problem will automatically go away because the implementation of _menuOptionsForReadonlyImage does not require image to be actual Image, or another simple fix would be to change the signature of _menuOptionsForReadonlyImage, adjusting type of image from Image to Widget. basically a one liner fix. |
Beta Was this translation helpful? Give feedback.
This is due to a type cast bug in flutter_quill/src/widgets/embed/default_embed_builder.dart
line 27 declares image as var .
line 48 wraps image in Padding and assigned it to image, when scaling has been adjusted
in !readOnly mode, it is ok because line 128 returns image wrapped in a GestureDetector as its child,
in readOnly mode, it throws exception because in line 136, that image, which is actually a Padding by now, is passed to the function _menuOptionsForReadonlyImage and the function signature requires the image argument to be of Image class.
You can fix this problem by providing your own embed builder with QuillEditor, in your constructor call.