diff --git a/example/main.dart b/example/main.dart index c9c826af..b79b35e5 100644 --- a/example/main.dart +++ b/example/main.dart @@ -18,20 +18,23 @@ class _HomePageState extends State { Widget build(BuildContext context) { return Scaffold( body: Column( - children: [ - QuillToolbar.basic( - controller: _controller, uploadFileCallback: _uploadImageCallBack), - Expanded( - child: Container( - child: QuillEditor.basic(_controller), - ), - ) - ], - )); + children: [ + QuillToolbar.basic( + controller: _controller, uploadFileCallback: _uploadImageCallBack), + Expanded( + child: Container( + child: QuillEditor.basic( + controller: _controller, + readOnly: false, // change to true to be view only mode + ), + ), + ) + ], + )); } Future _uploadImageCallBack(File file) async { // call upload file API and return file's absolute url return new Completer().future; } -} \ No newline at end of file +} diff --git a/lib/widgets/editor.dart b/lib/widgets/editor.dart index 55d7895f..83015607 100644 --- a/lib/widgets/editor.dart +++ b/lib/widgets/editor.dart @@ -137,15 +137,15 @@ class QuillEditor extends StatefulWidget { assert(readOnly != null), assert(embedBuilder != null); - factory QuillEditor.basic(QuillController controller) { + factory QuillEditor.basic( + {@required QuillController controller, bool readOnly}) { return QuillEditor( controller: controller, scrollController: ScrollController(), scrollable: true, focusNode: FocusNode(), autoFocus: true, - readOnly: false, - // change to true to be view only mode + readOnly: readOnly, enableInteractiveSelection: true, expands: false, padding: EdgeInsets.zero);