Update example

pull/13/head
singerdmx 4 years ago
parent c4d6edc60e
commit e34e0c7660
  1. 25
      example/main.dart
  2. 6
      lib/widgets/editor.dart

@ -18,20 +18,23 @@ class _HomePageState extends State<HomePage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body: Column( body: Column(
children: [ children: [
QuillToolbar.basic( QuillToolbar.basic(
controller: _controller, uploadFileCallback: _uploadImageCallBack), controller: _controller, uploadFileCallback: _uploadImageCallBack),
Expanded( Expanded(
child: Container( child: Container(
child: QuillEditor.basic(_controller), child: QuillEditor.basic(
), controller: _controller,
) readOnly: false, // change to true to be view only mode
], ),
)); ),
)
],
));
} }
Future<String> _uploadImageCallBack(File file) async { Future<String> _uploadImageCallBack(File file) async {
// call upload file API and return file's absolute url // call upload file API and return file's absolute url
return new Completer<String>().future; return new Completer<String>().future;
} }
} }

@ -137,15 +137,15 @@ class QuillEditor extends StatefulWidget {
assert(readOnly != null), assert(readOnly != null),
assert(embedBuilder != null); assert(embedBuilder != null);
factory QuillEditor.basic(QuillController controller) { factory QuillEditor.basic(
{@required QuillController controller, bool readOnly}) {
return QuillEditor( return QuillEditor(
controller: controller, controller: controller,
scrollController: ScrollController(), scrollController: ScrollController(),
scrollable: true, scrollable: true,
focusNode: FocusNode(), focusNode: FocusNode(),
autoFocus: true, autoFocus: true,
readOnly: false, readOnly: readOnly,
// change to true to be view only mode
enableInteractiveSelection: true, enableInteractiveSelection: true,
expands: false, expands: false,
padding: EdgeInsets.zero); padding: EdgeInsets.zero);

Loading…
Cancel
Save