|
@@ -5,6 +5,7 @@ import 'editor.dart';
|
5
|
5
|
import 'image.dart';
|
6
|
6
|
import 'mode.dart';
|
7
|
7
|
import 'toolbar.dart';
|
|
8
|
+import 'link.dart';
|
8
|
9
|
|
9
|
10
|
/// Zefyr editor with material design decorations.
|
10
|
11
|
class ZefyrField extends StatefulWidget {
|
|
@@ -13,13 +14,16 @@ class ZefyrField extends StatefulWidget {
|
13
|
14
|
|
14
|
15
|
/// Height of this editor field.
|
15
|
16
|
final double height;
|
|
17
|
+ final EdgeInsets padding;
|
16
|
18
|
final ZefyrController controller;
|
17
|
19
|
final FocusNode focusNode;
|
18
|
20
|
final bool autofocus;
|
19
|
21
|
final ZefyrMode mode;
|
20
|
22
|
final ZefyrToolbarDelegate toolbarDelegate;
|
21
|
23
|
final ZefyrImageDelegate imageDelegate;
|
|
24
|
+ final ZefyrLinkDelegate linkDelegate;
|
22
|
25
|
final ScrollPhysics physics;
|
|
26
|
+ final void Function() onSave;
|
23
|
27
|
|
24
|
28
|
/// The appearance of the keyboard.
|
25
|
29
|
///
|
|
@@ -31,6 +35,7 @@ class ZefyrField extends StatefulWidget {
|
31
|
35
|
const ZefyrField({
|
32
|
36
|
Key key,
|
33
|
37
|
this.decoration,
|
|
38
|
+ this.padding,
|
34
|
39
|
this.height,
|
35
|
40
|
this.controller,
|
36
|
41
|
this.focusNode,
|
|
@@ -38,8 +43,10 @@ class ZefyrField extends StatefulWidget {
|
38
|
43
|
this.mode,
|
39
|
44
|
this.toolbarDelegate,
|
40
|
45
|
this.imageDelegate,
|
|
46
|
+ this.linkDelegate,
|
41
|
47
|
this.physics,
|
42
|
48
|
this.keyboardAppearance,
|
|
49
|
+ this.onSave,
|
43
|
50
|
}) : super(key: key);
|
44
|
51
|
|
45
|
52
|
@override
|
|
@@ -51,7 +58,7 @@ class _ZefyrFieldState extends State<ZefyrField> {
|
51
|
58
|
@override
|
52
|
59
|
Widget build(BuildContext context) {
|
53
|
60
|
Widget child = ZefyrEditor(
|
54
|
|
- padding: EdgeInsets.symmetric(vertical: 6.0),
|
|
61
|
+ padding: widget.padding ?? EdgeInsets.zero,
|
55
|
62
|
controller: widget.controller,
|
56
|
63
|
focusNode: widget.focusNode,
|
57
|
64
|
autofocus: widget.autofocus,
|
|
@@ -68,7 +75,6 @@ class _ZefyrFieldState extends State<ZefyrField> {
|
68
|
75
|
child: child,
|
69
|
76
|
);
|
70
|
77
|
}
|
71
|
|
-
|
72
|
78
|
return AnimatedBuilder(
|
73
|
79
|
animation:
|
74
|
80
|
Listenable.merge(<Listenable>[widget.focusNode, widget.controller]),
|