fix: preserve letterSpacing and shadows from selectedTextStyle in text editor input#788
Open
faizahmaddae wants to merge 1 commit intohm21:stablefrom
Open
fix: preserve letterSpacing and shadows from selectedTextStyle in text editor input#788faizahmaddae wants to merge 1 commit intohm21:stablefrom
faizahmaddae wants to merge 1 commit intohm21:stablefrom
Conversation
…t input The text editor input was hard-coding letterSpacing: 0 and shadows: [] in the style copyWith, which overrode any values set on selectedTextStyle. This meant users could not see letter spacing or shadow changes in the live preview while editing text, even though the values were correctly saved to the final text layer. Removed both overrides so the input field respects whatever letterSpacing and shadows are set on the selected text style.
3545871 to
69df52e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
TextEditorInputwidget hard-codesletterSpacing: 0andshadows: []in its stylecopyWithcall (text_editor_input.dart#L206-L212):This means any
letterSpacingorshadowsset onselectedTextStyle(e.g. viasetTextStyle(style.copyWith(letterSpacing: 5))) is silently discarded in the live text input preview.Observed behavior
hintStylealso overrides)LayerWidgetTextItem)The values are correctly stored on the
TextLayerand render properly once the text is placed on the canvas, but users cannot see the effect while editing. This makes letter spacing and shadow controls appear broken during the editing experience.Root cause trace
TextEditorState.setTextStyle(style.copyWith(letterSpacing: value))→selectedTextStyleis updated correctlyTextEditorInputreceives updatedselectedTextStyleas a prop ✅_buildInputField()appliesselectedTextStyle.copyWith(letterSpacing: 0, shadows: [])→ overrides both values ❌RoundedBackgroundTextFieldreceivesstylewith zeroed-out values → preview shows no spacing or shadowsFix
Removed the
letterSpacing: 0andshadows: []lines so the input field respects whatever values are already set onselectedTextStyle. When these properties are not explicitly set, they default tonull(Flutter's default behavior), so there is no change in behavior for the default case.Impact
letterSpacing/shadowsare not explicitly set (defaults tonull)LayerWidgetTextItempreserves both properties)