From 3253a3c0f8e8ef3a055e7018124f9224b31d85c4 Mon Sep 17 00:00:00 2001 From: X Code Date: Mon, 31 Jan 2022 00:19:54 -0800 Subject: [PATCH] Code cleanup --- lib/src/widgets/controller.dart | 2 +- lib/src/widgets/raw_editor.dart | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/src/widgets/controller.dart b/lib/src/widgets/controller.dart index 9c32c05d..a6a57f86 100644 --- a/lib/src/widgets/controller.dart +++ b/lib/src/widgets/controller.dart @@ -327,6 +327,6 @@ class QuillController extends ChangeNotifier { extentOffset: math.min(selection.extentOffset, end)); } - // To notify toolbar buttons directly with attributes + // Notify toolbar buttons directly with attributes Map toolbarButtonToggler = {}; } diff --git a/lib/src/widgets/raw_editor.dart b/lib/src/widgets/raw_editor.dart index 8e2ffead..f9dcbde4 100644 --- a/lib/src/widgets/raw_editor.dart +++ b/lib/src/widgets/raw_editor.dart @@ -406,7 +406,6 @@ class RawEditorState extends EditorState if (!widget.readOnly) { _disableScrollControllerAnimateOnce = true; final attribute = value ? Attribute.checked : Attribute.unchecked; - widget.controller.formatText(offset, 0, attribute); // Checkbox tapping causes controller.selection to go to offset 0 // Stop toggling those two toolbar buttons @@ -415,6 +414,8 @@ class RawEditorState extends EditorState Attribute.header.key: Attribute.header }; + widget.controller.formatText(offset, 0, attribute); + // Go back from offset 0 to current selection SchedulerBinding.instance!.addPostFrameCallback((_) { widget.controller.updateSelection(