Update simple toolbar

pull/1578/head
Ellet 1 year ago
parent 6896b3075a
commit a1e73a52c8
No known key found for this signature in database
GPG Key ID: C488CC70BBCEF0D1
  1. 1
      doc/todo.md
  2. 10
      lib/src/widgets/quill/text_line.dart
  3. 20
      lib/src/widgets/toolbar/simple_toolbar.dart

@ -34,6 +34,7 @@ This is a todo list page that added recently and will be updated soon.
- Fix the bugs of the font family and font size
- Try to update Quill Html Converter
- When pasting a HTML text from cliboard by not using the context menu builder, the new logic won't work
- Add strike-through in checkbox text when the checkpoint is checked
### Bugs

@ -164,7 +164,8 @@ class _TextLineState extends State<TextLine> {
}
}
final textSpan = _getTextSpanForWholeLine();
final strutStyle = StrutStyle.fromTextStyle(textSpan.style!);
final strutStyle =
StrutStyle.fromTextStyle(textSpan.style ?? const TextStyle());
final textAlign = _getTextAlign();
final child = RichText(
key: _richTextKey,
@ -247,8 +248,11 @@ class _TextLineState extends State<TextLine> {
return TextAlign.start;
}
TextSpan _buildTextSpan(DefaultStyles defaultStyles, LinkedList<Node> nodes,
TextStyle lineStyle) {
TextSpan _buildTextSpan(
DefaultStyles defaultStyles,
LinkedList<Node> nodes,
TextStyle lineStyle,
) {
if (nodes.isEmpty && kIsWeb) {
nodes = LinkedList<Node>()..add(leaf.QuillText('\u{200B}'));
}

@ -133,6 +133,16 @@ class QuillSimpleToolbar extends StatelessWidget
),
spacerWidget,
],
if (configurations.showStrikeThrough) ...[
QuillToolbarToggleStyleButton(
attribute: Attribute.strikeThrough,
options: toolbarConfigurations.buttonOptions.strikeThrough,
controller:
toolbarConfigurations.buttonOptions.strikeThrough.controller ??
globalController,
),
spacerWidget,
],
if (configurations.showInlineCode) ...[
QuillToolbarToggleStyleButton(
attribute: Attribute.inlineCode,
@ -172,16 +182,6 @@ class QuillSimpleToolbar extends StatelessWidget
),
spacerWidget,
],
if (configurations.showStrikeThrough) ...[
QuillToolbarToggleStyleButton(
attribute: Attribute.strikeThrough,
options: toolbarConfigurations.buttonOptions.strikeThrough,
controller:
toolbarConfigurations.buttonOptions.strikeThrough.controller ??
globalController,
),
spacerWidget,
],
if (configurations.showColorButton) ...[
QuillToolbarColorButton(
controller: toolbarConfigurations.buttonOptions.color.controller ??

Loading…
Cancel
Save