1
1
import 'dart:async' ;
2
- import 'dart:convert' ;
3
2
import 'dart:io' ;
4
3
import 'dart:ui' ;
5
4
6
5
import 'package:file_picker/file_picker.dart' ;
7
- import 'package:filesystem_picker/filesystem_picker.dart' ;
8
6
import 'package:flutter/foundation.dart' ;
9
7
import 'package:flutter/material.dart' ;
10
- import 'package:flutter/services.dart' ;
11
8
import 'package:flutter_quill/extensions.dart' ;
12
9
import 'package:flutter_quill/flutter_quill.dart' hide Text;
13
10
import 'package:flutter_quill_extensions/flutter_quill_extensions.dart' ;
14
11
import 'package:path/path.dart' ;
15
12
import 'package:path_provider/path_provider.dart' ;
16
- import 'package:mime/mime.dart' ;
17
13
18
14
import 'web_embeds.dart' ;
19
15
@@ -24,6 +20,8 @@ enum _SelectionType {
24
20
}
25
21
26
22
class HomePage extends StatefulWidget {
23
+ const HomePage ({super .key});
24
+
27
25
@override
28
26
_HomePageState createState () => _HomePageState ();
29
27
}
@@ -74,7 +72,7 @@ class _HomePageState extends State<HomePage> {
74
72
),
75
73
),
76
74
icon: const Icon (Icons .text_fields_rounded),
77
- )
75
+ ),
78
76
],
79
77
),
80
78
body: _buildWelcomeEditor (context),
@@ -148,15 +146,16 @@ class _HomePageState extends State<HomePage> {
148
146
},
149
147
customStyles: DefaultStyles (
150
148
h1: DefaultTextBlockStyle (
151
- const TextStyle (
152
- fontSize: 32 ,
153
- color: Colors .black,
154
- height: 1.15 ,
155
- fontWeight: FontWeight .w300,
156
- ),
157
- const VerticalSpacing (16 , 0 ),
158
- const VerticalSpacing (0 , 0 ),
159
- null ),
149
+ const TextStyle (
150
+ fontSize: 32 ,
151
+ color: Colors .black,
152
+ height: 1.15 ,
153
+ fontWeight: FontWeight .w300,
154
+ ),
155
+ const VerticalSpacing (16 , 0 ),
156
+ const VerticalSpacing (0 , 0 ),
157
+ null ,
158
+ ),
160
159
sizeSmall: const TextStyle (fontSize: 9 ),
161
160
subscript: const TextStyle (
162
161
fontFamily: 'SF-UI-Display' ,
@@ -171,32 +170,34 @@ class _HomePageState extends State<HomePage> {
171
170
);
172
171
if (kIsWeb) {
173
172
quillEditor = QuillEditor (
174
- controller: _controller! ,
175
- scrollController: ScrollController (),
176
- scrollable: true ,
177
- focusNode: _focusNode,
178
- autoFocus: false ,
179
- readOnly: false ,
180
- placeholder: 'Add content' ,
181
- expands: false ,
182
- padding: EdgeInsets .zero,
183
- onTapUp: (details, p1) {
184
- return _onTripleClickSelection ();
185
- },
186
- customStyles: DefaultStyles (
187
- h1: DefaultTextBlockStyle (
188
- const TextStyle (
189
- fontSize: 32 ,
190
- color: Colors .black,
191
- height: 1.15 ,
192
- fontWeight: FontWeight .w300,
193
- ),
194
- const VerticalSpacing (16 , 0 ),
195
- const VerticalSpacing (0 , 0 ),
196
- null ),
197
- sizeSmall: const TextStyle (fontSize: 9 ),
173
+ controller: _controller! ,
174
+ scrollController: ScrollController (),
175
+ scrollable: true ,
176
+ focusNode: _focusNode,
177
+ autoFocus: false ,
178
+ readOnly: false ,
179
+ placeholder: 'Add content' ,
180
+ expands: false ,
181
+ padding: EdgeInsets .zero,
182
+ onTapUp: (details, p1) {
183
+ return _onTripleClickSelection ();
184
+ },
185
+ customStyles: DefaultStyles (
186
+ h1: DefaultTextBlockStyle (
187
+ const TextStyle (
188
+ fontSize: 32 ,
189
+ color: Colors .black,
190
+ height: 1.15 ,
191
+ fontWeight: FontWeight .w300,
192
+ ),
193
+ const VerticalSpacing (16 , 0 ),
194
+ const VerticalSpacing (0 , 0 ),
195
+ null ,
198
196
),
199
- embedBuilders: [...defaultEmbedBuildersWeb]);
197
+ sizeSmall: const TextStyle (fontSize: 9 ),
198
+ ),
199
+ embedBuilders: [...defaultEmbedBuildersWeb],
200
+ );
200
201
}
201
202
202
203
const toolbarIconSize = 18.0 ;
@@ -274,7 +275,7 @@ class _HomePageState extends State<HomePage> {
274
275
child: quillEditor,
275
276
),
276
277
),
277
- Container (child: toolbar)
278
+ Container (child: toolbar),
278
279
],
279
280
),
280
281
);
@@ -284,6 +285,7 @@ class _HomePageState extends State<HomePage> {
284
285
// You can also upload the picked image to any server (eg : AWS s3
285
286
// or Firebase) and then return the uploaded image URL.
286
287
Future <String > _onImagePickCallback (File file) async {
288
+ //return "https://d3vhc53cl8e8km.cloudfront.net/artists/220/e16cb080-cb30-11ec-b991-0ee6b8365494.jpg";
287
289
if (! kIsWeb) {
288
290
// Copies the picked file from temporary cache to applications directory
289
291
final appDocDir = await getApplicationDocumentsDirectory ();
0 commit comments