mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: customizes checkbox text style
This commit is contained in:
parent
f6fbe55477
commit
59838f5845
@ -86,6 +86,7 @@ class _CheckboxNodeWidgetState extends State<CheckboxNodeWidget>
|
||||
key: _richTextKey,
|
||||
placeholderText: 'To-do',
|
||||
textNode: widget.textNode,
|
||||
textSpanDecorator: _textSpanDecorator,
|
||||
editorState: widget.editorState,
|
||||
)
|
||||
],
|
||||
@ -121,4 +122,24 @@ class _CheckboxNodeWidgetState extends State<CheckboxNodeWidget>
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
TextSpan _textSpanDecorator(TextSpan textSpan) {
|
||||
return TextSpan(
|
||||
children: textSpan.children
|
||||
?.whereType<TextSpan>()
|
||||
.map(
|
||||
(span) => TextSpan(
|
||||
text: span.text,
|
||||
style: widget.textNode.attributes.check
|
||||
? span.style?.copyWith(
|
||||
color: Colors.grey,
|
||||
decoration: TextDecoration.lineThrough,
|
||||
)
|
||||
: span.style,
|
||||
recognizer: span.recognizer,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user