added selection change callback (#683)

pull/697/head
Andy Trand 3 years ago committed by GitHub
parent 5772b51d86
commit c7be3a31a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      lib/src/widgets/controller.dart

@ -23,6 +23,7 @@ class QuillController extends ChangeNotifier {
this.onReplaceText,
this.onDelete,
this.onSelectionCompleted,
this.onSelectionChanged,
}) : _selection = selection,
_keepStyleOnNewLine = keepStyleOnNewLine;
@ -52,6 +53,7 @@ class QuillController extends ChangeNotifier {
DeleteCallback? onDelete;
void Function()? onSelectionCompleted;
void Function(TextSelection textSelection)? onSelectionChanged;
/// Store any styles attribute that got toggled by the tap of a button
/// and that has not been applied yet.
@ -328,6 +330,7 @@ class QuillController extends ChangeNotifier {
baseOffset: math.min(selection.baseOffset, end),
extentOffset: math.min(selection.extentOffset, end));
toggledStyle = Style();
onSelectionChanged?.call(textSelection);
}
/// Given offset, find its leaf node in document

Loading…
Cancel
Save