Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions lib/core/models/editor_configs/text_editor_configs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class TextEditorConfigs
this.enableMainEditorZoomFactor = false,
this.enableTapOutsideToSave = true,
this.enableAutoOverflow = true,
this.enableAutoWrapOnLayer = true,
this.initFontSize = 24.0,
this.initialPrimaryColor = const Color(0xFF000000),
this.initialSecondaryColor,
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -219,6 +231,7 @@ class TextEditorConfigs
bool? enableMainEditorZoomFactor,
bool? enableTapOutsideToSave,
bool? enableAutoOverflow,
bool? enableAutoWrapOnLayer,
Color? initialPrimaryColor,
Color? initialSecondaryColor,
double? initFontSize,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion lib/features/text_editor/text_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ class TextEditorState extends State<TextEditor>
colorMode: backgroundColorMode,
textStyle: selectedTextStyle,
customSecondaryColor: _secondaryColor != null,
maxTextWidth: (textEditorConfigs.enableAutoOverflow ||
maxTextWidth: (textEditorConfigs.enableAutoWrapOnLayer ||
textEditorConfigs.enableImageBoundaryTextWrap)
? _maxTextWidth
: null,
Expand Down