|
|
|
@ -1,7 +1,6 @@ |
|
|
|
|
import 'dart:convert'; |
|
|
|
|
import 'dart:io'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
|
import 'package:flutter/services.dart'; |
|
|
|
|
import 'package:flutter_quill/models/documents/document.dart'; |
|
|
|
@ -10,7 +9,6 @@ import 'package:flutter_quill/widgets/controller.dart'; |
|
|
|
|
import 'package:flutter_quill/widgets/default_styles.dart'; |
|
|
|
|
import 'package:flutter_quill/widgets/editor.dart'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class HomePage extends StatefulWidget { |
|
|
|
|
@override |
|
|
|
|
_HomePageState createState() => _HomePageState(); |
|
|
|
@ -34,12 +32,14 @@ class _HomePageState extends State<HomePage> { |
|
|
|
|
final result = await rootBundle.loadString('assets/welcome.note'); |
|
|
|
|
final doc = Document.fromJson(jsonDecode(result)); |
|
|
|
|
setState(() { |
|
|
|
|
_controller = QuillController(document: doc, selection: TextSelection.collapsed(offset: 0)); |
|
|
|
|
_controller = QuillController( |
|
|
|
|
document: doc, selection: TextSelection.collapsed(offset: 0)); |
|
|
|
|
}); |
|
|
|
|
} catch (error) { |
|
|
|
|
final doc = Document()..insert(0, 'Empty asset'); |
|
|
|
|
setState(() { |
|
|
|
|
_controller = QuillController(document: doc, selection: TextSelection.collapsed(offset: 0)); |
|
|
|
|
_controller = QuillController( |
|
|
|
|
document: doc, selection: TextSelection.collapsed(offset: 0)); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -58,8 +58,7 @@ class _HomePageState extends State<HomePage> { |
|
|
|
|
title: Text( |
|
|
|
|
'Flutter Quill', |
|
|
|
|
), |
|
|
|
|
actions: [ |
|
|
|
|
], |
|
|
|
|
actions: [], |
|
|
|
|
), |
|
|
|
|
body: _buildWelcomeEditor(context), |
|
|
|
|
); |
|
|
|
@ -83,6 +82,7 @@ class _HomePageState extends State<HomePage> { |
|
|
|
|
embedBuilder: _embedBuilder, |
|
|
|
|
enableInteractiveSelection: true, |
|
|
|
|
expands: false, |
|
|
|
|
padding: EdgeInsets.zero, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
@ -104,5 +104,4 @@ class _HomePageState extends State<HomePage> { |
|
|
|
|
'builder of QuillEditor. You must pass your own builder function to ' |
|
|
|
|
'embedBuilder property of QuillEditor or QuillField widgets.'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|