From 3c64a08c6a436799f3eae3ada87a0168dc482d32 Mon Sep 17 00:00:00 2001 From: X Code Date: Sun, 12 Mar 2023 05:59:59 -0700 Subject: [PATCH] Reformat code --- lib/src/models/rules/insert.dart | 10 ++++----- lib/src/widgets/default_styles.dart | 21 ++++++------------- lib/src/widgets/raw_editor.dart | 3 +-- .../widgets/toolbar/link_style_button.dart | 10 ++++----- 4 files changed, 17 insertions(+), 27 deletions(-) diff --git a/lib/src/models/rules/insert.dart b/lib/src/models/rules/insert.dart index 93cf4742..8ef6c196 100644 --- a/lib/src/models/rules/insert.dart +++ b/lib/src/models/rules/insert.dart @@ -83,9 +83,8 @@ class PreserveBlockStyleOnInsertRule extends InsertRule { // Look for the next newline. final nextNewLine = _getNextNewLine(itr); - final lineStyle = - Style.fromJson( - nextNewLine.operation?.attributes ?? {}); + final lineStyle = Style.fromJson( + nextNewLine.operation?.attributes ?? {}); final blockStyle = lineStyle.getBlocksExceptHeader(); // Are we currently in a block? If not then ignore. @@ -189,8 +188,9 @@ class AutoExitBlockRule extends InsertRule { final nextNewLine = _getNextNewLine(itr); if (nextNewLine.operation != null && nextNewLine.operation!.attributes != null && - Style.fromJson(nextNewLine.operation!.attributes).getBlockExceptHeader() - == blockStyle) { + Style.fromJson(nextNewLine.operation!.attributes) + .getBlockExceptHeader() == + blockStyle) { // We are not at the end of this block, ignore. return null; } diff --git a/lib/src/widgets/default_styles.dart b/lib/src/widgets/default_styles.dart index 08acb154..f9fef5d0 100644 --- a/lib/src/widgets/default_styles.dart +++ b/lib/src/widgets/default_styles.dart @@ -241,11 +241,8 @@ class DefaultStyles { const VerticalSpacing(8, 0), const VerticalSpacing(0, 0), null), - paragraph: DefaultTextBlockStyle( - baseStyle, - const VerticalSpacing(0, 0), - const VerticalSpacing(0, 0), - null), + paragraph: DefaultTextBlockStyle(baseStyle, const VerticalSpacing(0, 0), + const VerticalSpacing(0, 0), null), bold: const TextStyle(fontWeight: FontWeight.bold), italic: const TextStyle(fontStyle: FontStyle.italic), small: const TextStyle(fontSize: 12), @@ -304,16 +301,10 @@ class DefaultStyles { )), indent: DefaultTextBlockStyle( baseStyle, baseSpacing, const VerticalSpacing(0, 6), null), - align: DefaultTextBlockStyle( - baseStyle, - const VerticalSpacing(0, 0), - const VerticalSpacing(0, 0), - null), - leading: DefaultTextBlockStyle( - baseStyle, - const VerticalSpacing(0, 0), - const VerticalSpacing(0, 0), - null), + align: DefaultTextBlockStyle(baseStyle, const VerticalSpacing(0, 0), + const VerticalSpacing(0, 0), null), + leading: DefaultTextBlockStyle(baseStyle, const VerticalSpacing(0, 0), + const VerticalSpacing(0, 0), null), sizeSmall: const TextStyle(fontSize: 10), sizeLarge: const TextStyle(fontSize: 18), sizeHuge: const TextStyle(fontSize: 22)); diff --git a/lib/src/widgets/raw_editor.dart b/lib/src/widgets/raw_editor.dart index f78b18c3..6220cbea 100644 --- a/lib/src/widgets/raw_editor.dart +++ b/lib/src/widgets/raw_editor.dart @@ -1281,8 +1281,7 @@ class RawEditorState extends EditorState final index = textEditingValue.selection.baseOffset; final length = textEditingValue.selection.extentOffset - index; final copied = controller.copiedImageUrl!; - controller.replaceText( - index, length, BlockEmbed.image(copied.url), null); + controller.replaceText(index, length, BlockEmbed.image(copied.url), null); if (copied.styleString.isNotEmpty) { controller.formatText(getEmbedNode(controller, index + 1).offset, 1, StyleAttribute(copied.styleString)); diff --git a/lib/src/widgets/toolbar/link_style_button.dart b/lib/src/widgets/toolbar/link_style_button.dart index 80086608..f48a15e4 100644 --- a/lib/src/widgets/toolbar/link_style_button.dart +++ b/lib/src/widgets/toolbar/link_style_button.dart @@ -134,8 +134,8 @@ class _LinkStyleButtonState extends State { } } widget.controller.replaceText(index, length, value.text, null); - widget.controller.formatText( - index, value.text.length, LinkAttribute(value.link)); + widget.controller + .formatText(index, value.text.length, LinkAttribute(value.link)); } } @@ -242,9 +242,9 @@ class _LinkDialogState extends State<_LinkDialog> { class _TextLink { _TextLink( - this.text, - this.link, - ); + this.text, + this.link, + ); final String text; final String link;