chore: format checkbox_text

This commit is contained in:
Lucas.Xu 2022-08-17 21:14:38 +08:00
parent 0b2355abae
commit 95879111f9

View File

@ -65,42 +65,45 @@ class _CheckboxNodeWidgetState extends State<CheckboxNodeWidget>
final check = widget.textNode.attributes.check; final check = widget.textNode.attributes.check;
final topPadding = RichTextStyle.fromTextNode(widget.textNode).topPadding; final topPadding = RichTextStyle.fromTextNode(widget.textNode).topPadding;
return SizedBox( return SizedBox(
width: defaultMaxTextNodeWidth, width: defaultMaxTextNodeWidth,
child: Padding( child: Padding(
padding: EdgeInsets.only(bottom: defaultLinePadding), padding: EdgeInsets.only(bottom: defaultLinePadding),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
GestureDetector( GestureDetector(
key: iconKey, key: iconKey,
child: FlowySvg( child: FlowySvg(
size: Size.square(_iconSize), size: Size.square(_iconSize),
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: topPadding, right: _iconRightPadding), top: topPadding,
name: check ? 'check' : 'uncheck', right: _iconRightPadding,
), ),
onTap: () { name: check ? 'check' : 'uncheck',
debugPrint('[Checkbox] onTap...');
TransactionBuilder(widget.editorState)
..updateNode(widget.textNode, {
StyleKey.checkbox: !check,
})
..commit();
},
), ),
Expanded( onTap: () {
child: FlowyRichText( debugPrint('[Checkbox] onTap...');
key: _richTextKey, TransactionBuilder(widget.editorState)
placeholderText: 'To-do', ..updateNode(widget.textNode, {
textNode: widget.textNode, StyleKey.checkbox: !check,
textSpanDecorator: _textSpanDecorator, })
placeholderTextSpanDecorator: _textSpanDecorator, ..commit();
editorState: widget.editorState, },
), ),
Expanded(
child: FlowyRichText(
key: _richTextKey,
placeholderText: 'To-do',
textNode: widget.textNode,
textSpanDecorator: _textSpanDecorator,
placeholderTextSpanDecorator: _textSpanDecorator,
editorState: widget.editorState,
), ),
], ),
), ],
)); ),
),
);
} }
Widget _buildWithChildren(BuildContext context) { Widget _buildWithChildren(BuildContext context) {