lucky1213 5 lat temu
rodzic
commit
3171262d30
1 zmienionych plików z 8 dodań i 2 usunięć
  1. 8
    2
      packages/zefyr/lib/src/widgets/field.dart

+ 8
- 2
packages/zefyr/lib/src/widgets/field.dart Wyświetl plik

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