Skip to content

Commit 1e64772

Browse files
authored
fix(widget-layer): correct application of optional width in layer calculations (#728)
1 parent 9bdc457 commit 1e64772

File tree

6 files changed

+9
-3
lines changed

6 files changed

+9
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 11.15.4
4+
- **FIX**(widget-layer): Resolve the issue of the optional `width` being applied incorrectly.
5+
36
## 11.15.3
47
- **FEAT**(widget-layer): Add optional `width` property.
58

lib/core/models/layers/widget_layer.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ class WidgetLayer extends Layer {
187187
maxDecimalPlaces: maxDecimalPlaces,
188188
enableMinify: enableMinify,
189189
),
190+
if (layer is WidgetLayer && width != layer.width) 'width': width,
190191
};
191192
}
192193

lib/features/main_editor/services/layer_copy_manager.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ class LayerCopyManager {
185185
flipX: layer.flipX,
186186
flipY: layer.flipY,
187187
meta: layer.meta,
188+
width: layer.width,
188189
interaction: layer.interaction.copyWith(),
189190
boxConstraints: layer.boxConstraints?.copyWith(),
190191
exportConfigs: layer.exportConfigs.copyWith(),

lib/shared/services/import_export/export_state_history.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,8 @@ class ExportStateHistory {
310310
updateReference(widgetLayer, recordPosition: widgetRecords.length);
311311

312312
double imageWidth =
313-
_editorConfigs.stickerEditor.initWidth * layer.scale;
313+
(layer.width ?? _editorConfigs.stickerEditor.initWidth) *
314+
layer.scale;
314315

315316
Size targetSize = Size(
316317
imageWidth,

lib/shared/widgets/layer/widgets/layer_widget_custom_item.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class LayerWidgetCustomItem extends StatelessWidget {
2323
@override
2424
Widget build(BuildContext context) {
2525
return SizedBox(
26-
width: stickerEditorConfigs.initWidth * layer.scale,
26+
width: (layer.width ?? stickerEditorConfigs.initWidth) * layer.scale,
2727
child: FittedBox(
2828
fit: BoxFit.contain,
2929
child: layer.widget,

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: pro_image_editor
22
description: "A Flutter image editor: Seamlessly enhance your images with user-friendly editing features."
3-
version: 11.15.3
3+
version: 11.15.4
44
homepage: https://github.com/hm21/pro_image_editor/
55
repository: https://github.com/hm21/pro_image_editor/
66
documentation: https://github.com/hm21/pro_image_editor/

0 commit comments

Comments
 (0)