Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

fix: unable to resize the image (#4750)

Lucas.Xuf36ca3777b74
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/image_menu.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/image_menu.dart
index 64ee4f9f29..ca765bc0ed 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/image_menu.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/image_menu.dart
@@ -118,7 +118,8 @@ class _ImageAlignButtonState extends State<_ImageAlignButton> {
canTap: (details) => false,
);
- String get align => widget.node.attributes['align'] ?? 'center';
+ String get align =>
+ widget.node.attributes[ImageBlockKeys.align] ?? centerAlignmentKey;
final popoverController = PopoverController();
late final EditorState editorState;
@@ -188,11 +189,11 @@ class _ImageAlignButtonState extends State<_ImageAlignButton> {
FlowySvgData iconFor(String alignment) {
switch (alignment) {
- case 'right':
+ case rightAlignmentKey:
return FlowySvgs.align_right_s;
- case 'center':
+ case centerAlignmentKey:
return FlowySvgs.align_center_s;
- case 'left':
+ case leftAlignmentKey:
default:
return FlowySvgs.align_left_s;
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/resizeable_image.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/resizeable_image.dart
index 5038e781a0..1e2305137d 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/resizeable_image.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/resizeable_image.dart
@@ -93,9 +93,9 @@ class _ResizableImageState extends State<ResizableImage> {
return _buildLoading(context);
}
- _cacheImage ??= FlowyNetworkImage(
+ _cacheImage = FlowyNetworkImage(
url: widget.src,
- width: widget.width,
+ width: imageWidth - moveDistance,
userProfilePB: _userProfilePB,
errorWidgetBuilder: (context, url, error) =>
_buildError(context, error),