Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: customStyleBuilder is not accumulating styles #2447

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
3 changes: 2 additions & 1 deletion lib/src/editor/widgets/delegate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import '../editor.dart';
import '../raw_editor/raw_editor.dart';
import 'text/text_selection.dart';

typedef CustomStyleBuilder = TextStyle Function(Attribute attribute);
typedef CustomStyleBuilder = TextStyle Function(
Attribute attribute, TextStyle style);
Comment on lines -13 to +14
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this a breaking change if this is a public API?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm... Probably. It's difficult without change the CustomStyleBuilder. I'm waiting for the response of @manudicri to know if i need to made more changes.


typedef CustomRecognizerBuilder = GestureRecognizer? Function(
Attribute attribute, Leaf leaf);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/editor/widgets/text/text_line.dart
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ class _TextLineState extends State<TextLine> {
final attr = attributes[key];
if (attr != null) {
/// Custom Attribute
final customAttr = widget.customStyleBuilder!.call(attr);
final customAttr = widget.customStyleBuilder!.call(attr, textStyle);
textStyle = textStyle.merge(customAttr);
}
}
Expand Down
Loading