fix: unable to resize the image (#4750)

This commit is contained in:
Lucas.Xu 2024-02-27 20:41:14 +07:00 committed by GitHub
parent 74233d2606
commit f36ca3777b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 6 deletions

View File

@ -118,7 +118,8 @@ class _ImageAlignButtonState extends State<_ImageAlignButton> {
canTap: (details) => false, canTap: (details) => false,
); );
String get align => widget.node.attributes['align'] ?? 'center'; String get align =>
widget.node.attributes[ImageBlockKeys.align] ?? centerAlignmentKey;
final popoverController = PopoverController(); final popoverController = PopoverController();
late final EditorState editorState; late final EditorState editorState;
@ -188,11 +189,11 @@ class _ImageAlignButtonState extends State<_ImageAlignButton> {
FlowySvgData iconFor(String alignment) { FlowySvgData iconFor(String alignment) {
switch (alignment) { switch (alignment) {
case 'right': case rightAlignmentKey:
return FlowySvgs.align_right_s; return FlowySvgs.align_right_s;
case 'center': case centerAlignmentKey:
return FlowySvgs.align_center_s; return FlowySvgs.align_center_s;
case 'left': case leftAlignmentKey:
default: default:
return FlowySvgs.align_left_s; return FlowySvgs.align_left_s;
} }

View File

@ -93,9 +93,9 @@ class _ResizableImageState extends State<ResizableImage> {
return _buildLoading(context); return _buildLoading(context);
} }
_cacheImage ??= FlowyNetworkImage( _cacheImage = FlowyNetworkImage(
url: widget.src, url: widget.src,
width: widget.width, width: imageWidth - moveDistance,
userProfilePB: _userProfilePB, userProfilePB: _userProfilePB,
errorWidgetBuilder: (context, url, error) => errorWidgetBuilder: (context, url, error) =>
_buildError(context, error), _buildError(context, error),