From 0191655f5e3f0ab5cc1044701db08ec06e8448fa Mon Sep 17 00:00:00 2001 From: Andriy Trubchanin Date: Tue, 7 Dec 2021 16:37:51 +0200 Subject: [PATCH] move cursor helpers --- lib/src/widgets/controller.dart | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/src/widgets/controller.dart b/lib/src/widgets/controller.dart index bb092646..c6a45cdf 100644 --- a/lib/src/widgets/controller.dart +++ b/lib/src/widgets/controller.dart @@ -218,6 +218,16 @@ class QuillController extends ChangeNotifier { formatText(selection.start, selection.end - selection.start, attribute); } + void moveCursorToStart() { + updateSelection(TextSelection.collapsed(offset: 0), ChangeSource.LOCAL); + } + + void moveCursorToEnd() { + updateSelection( + TextSelection.collapsed(offset: plainTextEditingValue.text.length), + ChangeSource.LOCAL); + } + void updateSelection(TextSelection textSelection, ChangeSource source) { _updateSelection(textSelection, source); notifyListeners();