Make QuillController.document mutable. (#973)

pull/974/head
Benjamin Quinn 3 years ago committed by GitHub
parent eceeb1805f
commit 27d9ac3bdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      lib/src/widgets/controller.dart

@ -17,14 +17,15 @@ typedef DeleteCallback = void Function(int cursorPosition, bool forward);
class QuillController extends ChangeNotifier {
QuillController({
required this.document,
required Document document,
required TextSelection selection,
bool keepStyleOnNewLine = false,
this.onReplaceText,
this.onDelete,
this.onSelectionCompleted,
this.onSelectionChanged,
}) : _selection = selection,
}) : _document = document,
_selection = selection,
_keepStyleOnNewLine = keepStyleOnNewLine;
factory QuillController.basic() {
@ -35,7 +36,12 @@ class QuillController extends ChangeNotifier {
}
/// Document managed by this controller.
final Document document;
Document _document;
Document get document => _document;
set document(doc) {
_document = doc;
notifyListeners();
}
/// Tells whether to keep or reset the [toggledStyle]
/// when user adds a new line.

Loading…
Cancel
Save