Closed as not planned
Description
The PR #1843 moved the readOnly
from the editor config to the controller as a breaking change, so to change it:
_controller.readOnly = true;
instead of:
QuillEditor.basic(
config: const QuillEditorConfig(
readOnly: true,
),
)
The setState
is required:
IconButton(
icon: Icon(_controller.readOnly ? Icons.edit : Icons.lock),
tooltip: 'Toggle read-only',
onPressed: () {
setState(() {
_controller.readOnly = !_controller.readOnly;
});
},
)
FlutterQuillReadOnly.mov
I figure that this approach might not be efficient enough, is a bit confusing, and can cause performance issues (need more consideration and investigation).
Since the QuillController
now depends on readOnly
(PRs after #1843 used it), we will need to store it as an internal property that will be set when the controller is connected to the QuillEditor
(such code definitely needs tests), see related lines.