From 27a2fa718667f0ce02e6b17b8ac33eafb48dc723 Mon Sep 17 00:00:00 2001 From: Saif Addin Date: Mon, 22 Dec 2025 11:07:06 +0100 Subject: [PATCH 1/2] feat(text-editor): auto-wrap on layer setting for granular behavior --- .../editor_configs/text_editor_configs.dart | 15 +++++++++++++++ lib/features/text_editor/text_editor.dart | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/core/models/editor_configs/text_editor_configs.dart b/lib/core/models/editor_configs/text_editor_configs.dart index 6156aed3f..9bcd5108b 100644 --- a/lib/core/models/editor_configs/text_editor_configs.dart +++ b/lib/core/models/editor_configs/text_editor_configs.dart @@ -56,6 +56,7 @@ class TextEditorConfigs this.enableMainEditorZoomFactor = false, this.enableTapOutsideToSave = true, this.enableAutoOverflow = true, + this.enableAutoWrapOnLayer = false, this.initFontSize = 24.0, this.initialPrimaryColor = const Color(0xFF000000), this.initialSecondaryColor, @@ -168,6 +169,17 @@ class TextEditorConfigs /// (e.g., the screen width). final bool enableAutoOverflow; + /// Whether the text should automatically wrap when it reaches the end of + /// the screen on the final image. + /// + /// If set to `true`, the text will wrap to the next line instead of + /// overflowing, ensuring it stays within the visible area + /// (e.g., the screen width). + /// + /// If set to `false`, the text will only wrap if the user deliberately + /// entered a new line while editing. + final bool enableAutoWrapOnLayer; + /// The minimum scale factor from the layer. final double minScale; @@ -219,6 +231,7 @@ class TextEditorConfigs bool? enableMainEditorZoomFactor, bool? enableTapOutsideToSave, bool? enableAutoOverflow, + bool? enableAutoWrapOnLayer, Color? initialPrimaryColor, Color? initialSecondaryColor, double? initFontSize, @@ -254,6 +267,8 @@ class TextEditorConfigs enableTapOutsideToSave: enableTapOutsideToSave ?? this.enableTapOutsideToSave, enableAutoOverflow: enableAutoOverflow ?? this.enableAutoOverflow, + enableAutoWrapOnLayer: + enableAutoWrapOnLayer ?? this.enableAutoWrapOnLayer, initialPrimaryColor: initialPrimaryColor ?? this.initialPrimaryColor, initialSecondaryColor: initialSecondaryColor ?? this.initialSecondaryColor, diff --git a/lib/features/text_editor/text_editor.dart b/lib/features/text_editor/text_editor.dart index bfd2dc4ce..eca4d54c7 100644 --- a/lib/features/text_editor/text_editor.dart +++ b/lib/features/text_editor/text_editor.dart @@ -323,7 +323,7 @@ class TextEditorState extends State colorMode: backgroundColorMode, textStyle: selectedTextStyle, customSecondaryColor: _secondaryColor != null, - maxTextWidth: (textEditorConfigs.enableAutoOverflow || + maxTextWidth: (textEditorConfigs.enableAutoWrapOnLayer || textEditorConfigs.enableImageBoundaryTextWrap) ? _maxTextWidth : null, From 5ec3d60d0f68cc347e789f18f768b5397992dc73 Mon Sep 17 00:00:00 2001 From: Saif Addin Date: Mon, 22 Dec 2025 11:13:28 +0100 Subject: [PATCH 2/2] fix(text-editor): default autoWrapOnLayer true --- lib/core/models/editor_configs/text_editor_configs.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core/models/editor_configs/text_editor_configs.dart b/lib/core/models/editor_configs/text_editor_configs.dart index 9bcd5108b..71d67b007 100644 --- a/lib/core/models/editor_configs/text_editor_configs.dart +++ b/lib/core/models/editor_configs/text_editor_configs.dart @@ -56,7 +56,7 @@ class TextEditorConfigs this.enableMainEditorZoomFactor = false, this.enableTapOutsideToSave = true, this.enableAutoOverflow = true, - this.enableAutoWrapOnLayer = false, + this.enableAutoWrapOnLayer = true, this.initFontSize = 24.0, this.initialPrimaryColor = const Color(0xFF000000), this.initialSecondaryColor,