You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The customStyleBuilder in flutter_quill does not accumulate styles when multiple attributes are applied to the same text. Instead, it processes each attribute independently, leading to only the last attribute being applied. This behavior makes it impossible to correctly combine styles like bold, italic, underline, and custom font sizes.
Steps to Reproduce
Create a QuillEditor with a customStyleBuilder to handle custom styles.
Apply multiple styles (e.g., bold, italic, and size) to the same text.
Observe that only one of the styles is applied (the last one processed).
Expected Behavior
All styles (bold, italic, underline, size, etc.) should be combined into a single TextStyle and applied simultaneously to the text.
Actual Behavior
Only one style (the last one processed by customStyleBuilder) is applied, overriding any previously applied styles.
Example Code
configurations: QuillEditorConfigurations(
customStyleBuilder: (attribute) {
// basically settings.fontSize is the size factor of a zoom mechanism already implemented, so i can make the text larger or smaller by pinching the screen, without modifying the quill editor document
TextStyle style = DefaultTextStyle.of(context).style.copyWith(fontSize: settings.fontSize * 20);
if (attribute.key == "bold" && attribute.value == true) {
style = style.copyWith(fontWeight: FontWeight.bold);
}
if (attribute.key == "italic" && attribute.value == true) {
style = style.copyWith(fontStyle: FontStyle.italic);
}
if (attribute.key == "underline" && attribute.value == true) {
style = style.copyWith(decoration: TextDecoration.underline);
}
// the thing I need the most, specific size attribute
if (attribute.key == "size") {
final size = double.parse(attribute.value.toString());
style = style.copyWith(fontSize: settings.fontSize * size);
}
return style;
},
)
(read comments)
Can you help me with this? Thank you so much
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
The question
The
customStyleBuilder
influtter_quill
does not accumulate styles when multiple attributes are applied to the same text. Instead, it processes each attribute independently, leading to only the last attribute being applied. This behavior makes it impossible to correctly combine styles like bold, italic, underline, and custom font sizes.Steps to Reproduce
Create a QuillEditor with a customStyleBuilder to handle custom styles.
Apply multiple styles (e.g., bold, italic, and size) to the same text.
Observe that only one of the styles is applied (the last one processed).
Expected Behavior
All styles (bold, italic, underline, size, etc.) should be combined into a single TextStyle and applied simultaneously to the text.
Actual Behavior
Only one style (the last one processed by customStyleBuilder) is applied, overriding any previously applied styles.
Example Code
(read comments)
Can you help me with this? Thank you so much
The text was updated successfully, but these errors were encountered: