From f36ca3777b749493318c288d12231d19d14f2e6a Mon Sep 17 00:00:00 2001 From: "Lucas.Xu" Date: Tue, 27 Feb 2024 20:41:14 +0700 Subject: [PATCH] fix: unable to resize the image (#4750) --- .../presentation/editor_plugins/image/image_menu.dart | 9 +++++---- .../editor_plugins/image/resizeable_image.dart | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) 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 { 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),