Skip to content

fix: preserve letterSpacing and shadows from selectedTextStyle in text editor input#788

Open
faizahmaddae wants to merge 1 commit intohm21:stablefrom
faizahmaddae:fix/preserve-letter-spacing
Open

fix: preserve letterSpacing and shadows from selectedTextStyle in text editor input#788
faizahmaddae wants to merge 1 commit intohm21:stablefrom
faizahmaddae:fix/preserve-letter-spacing

Conversation

@faizahmaddae
Copy link
Contributor

@faizahmaddae faizahmaddae commented Mar 9, 2026

Problem

The TextEditorInput widget hard-codes letterSpacing: 0 and shadows: [] in its style copyWith call (text_editor_input.dart#L206-L212):

style: widget.selectedTextStyle.copyWith(
  color: widget.textColor,
  fontSize: widget.textFontSize,
  letterSpacing: 0,           // ← overrides any user-set value
  decoration: TextDecoration.none,
  shadows: [],                // ← overrides any user-set shadows
),

This means any letterSpacing or shadows set on selectedTextStyle (e.g. via setTextStyle(style.copyWith(letterSpacing: 5))) is silently discarded in the live text input preview.

Observed behavior

Context letterSpacing respected? shadows respected?
Hint text (placeholder) ✅ Yes ❌ No (hintStyle also overrides)
Live typing preview No — always 0 No — always empty
Final rendered layer (LayerWidgetTextItem) ✅ Yes ✅ Yes

The values are correctly stored on the TextLayer and 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

  1. User adjusts letter spacing / shadow → TextEditorState.setTextStyle(style.copyWith(letterSpacing: value))selectedTextStyle is updated correctly
  2. TextEditorInput receives updated selectedTextStyle as a prop ✅
  3. _buildInputField() applies selectedTextStyle.copyWith(letterSpacing: 0, shadows: [])overrides both values
  4. RoundedBackgroundTextField receives style with zeroed-out values → preview shows no spacing or shadows

Fix

Removed the letterSpacing: 0 and shadows: [] lines so the input field respects whatever values are already set on selectedTextStyle. When these properties are not explicitly set, they default to null (Flutter's default behavior), so there is no change in behavior for the default case.

 style: widget.selectedTextStyle.copyWith(
   color: widget.textColor,
   fontSize: widget.textFontSize,
-  letterSpacing: 0,
   decoration: TextDecoration.none,
-  shadows: [],
 ),

Impact

  • 2 lines removed, zero new lines added
  • No behavior change when letterSpacing / shadows are not explicitly set (defaults to null)
  • Enables real-time preview of letter spacing and shadow changes in the text editor input
  • Consistent with how the final layer rendering already works (LayerWidgetTextItem preserves both properties)

…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.
@faizahmaddae faizahmaddae force-pushed the fix/preserve-letter-spacing branch from 3545871 to 69df52e Compare March 9, 2026 16:36
@faizahmaddae faizahmaddae changed the title fix: preserve letterSpacing from selectedTextStyle in text editor input fix: preserve letterSpacing and shadows from selectedTextStyle in text editor input Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant