Skip to content

Commit

Permalink
Update simple toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
Ellet committed Dec 8, 2023
1 parent 6896b30 commit a1e73a5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
1 change: 1 addition & 0 deletions doc/todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 7 additions & 3 deletions lib/src/widgets/quill/text_line.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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}'));
}
Expand Down
20 changes: 10 additions & 10 deletions lib/src/widgets/toolbar/simple_toolbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 ??
Expand Down

0 comments on commit a1e73a5

Please sign in to comment.