From 9f689306956f202e759f4c850a90db89c0d164fb Mon Sep 17 00:00:00 2001 From: Andy Trand Date: Tue, 7 Dec 2021 17:57:09 +0200 Subject: [PATCH] move cursor helpers (#507) --- 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 8e6a3a92..db211d1d 100644 --- a/lib/src/widgets/controller.dart +++ b/lib/src/widgets/controller.dart @@ -225,6 +225,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();