Преглед на файлове

Merged in changes from beta channel, resolved conflicts

Anatoly Pulyaevskiy преди 6 години
родител
ревизия
8ecb5970b2

+ 5
- 0
packages/zefyr/CHANGELOG.md Целия файл

@@ -11,6 +11,11 @@
11 11
 * Breaking change: removed `ZefyrEditor.of` and `ZefyrEditableText.of` static methods.
12 12
   Use `ZefyrScope.of` instead.
13 13
 
14
+## 0.3.1
15
+
16
+- Fixed autofocus not being triggered when set to `true` for the first time.
17
+- Allow customizing cursor color via ZefyrTheme.
18
+
14 19
 ## 0.3.0
15 20
 
16 21
 This version introduces new widget `ZefyrScaffold` which allows embedding Zefyr in custom

+ 1
- 1
packages/zefyr/example/lib/src/form.dart Целия файл

@@ -56,7 +56,7 @@ class _FormEmbeddedScreenState extends State<FormEmbeddedScreen> {
56 56
         decoration: InputDecoration(labelText: 'Description'),
57 57
         controller: _controller,
58 58
         focusNode: _focusNode,
59
-        autofocus: false,
59
+        autofocus: true,
60 60
         imageDelegate: new CustomImageDelegate(),
61 61
         physics: ClampingScrollPhysics(),
62 62
       ),

+ 1
- 0
packages/zefyr/example/lib/src/full_page.dart Целия файл

@@ -59,6 +59,7 @@ class _FullPageEditorScreenState extends State<FullPageEditorScreen> {
59 59
   @override
60 60
   Widget build(BuildContext context) {
61 61
     final theme = new ZefyrThemeData(
62
+      cursorColor: Colors.blue,
62 63
       toolbarTheme: ZefyrToolbarTheme.fallback(context).copyWith(
63 64
         color: Colors.grey.shade800,
64 65
         toggleColor: Colors.grey.shade900,

+ 14
- 2
packages/zefyr/lib/src/widgets/caret.dart Целия файл

@@ -5,7 +5,8 @@ import 'dart:ui';
5 5
 
6 6
 import 'package:flutter/material.dart';
7 7
 
8
-class CaretPainter {
8
+/// Helper class responsible for cursor layout and painting.
9
+class CursorPainter {
9 10
   static const double _kCaretHeightOffset = 2.0; // pixels
10 11
   static const double _kCaretWidth = 1.0; // pixels
11 12
 
@@ -14,16 +15,27 @@ class CaretPainter {
14 15
         0.0, 0.0, _kCaretWidth, lineHeight - _kCaretHeightOffset);
15 16
   }
16 17
 
18
+  CursorPainter(Color color)
19
+      : assert(color != null),
20
+        _color = color;
21
+
17 22
   Rect _prototype;
18 23
 
19 24
   Rect get prototype => _prototype;
20 25
 
26
+  Color _color;
27
+  Color get color => _color;
28
+  set color(Color value) {
29
+    assert(value != null);
30
+    _color = value;
31
+  }
32
+
21 33
   void layout(double lineHeight) {
22 34
     _prototype = buildPrototype(lineHeight);
23 35
   }
24 36
 
25 37
   void paint(Canvas canvas, Offset offset) {
26
-    final Paint paint = new Paint()..color = Colors.black;
38
+    final Paint paint = new Paint()..color = _color;
27 39
     final Rect caretRect = _prototype.shift(offset);
28 40
     canvas.drawRect(caretRect, paint);
29 41
   }

+ 1
- 0
packages/zefyr/lib/src/widgets/common.dart Целия файл

@@ -69,6 +69,7 @@ class _RawZefyrLineState extends State<RawZefyrLine> {
69 69
         showCursor: scope.showCursor,
70 70
         selection: scope.selection,
71 71
         selectionColor: theme.selectionColor,
72
+        cursorColor: theme.cursorColor,
72 73
       );
73 74
       content = CompositedTransformTarget(link: _link, child: content);
74 75
     }

+ 21
- 8
packages/zefyr/lib/src/widgets/editable_box.dart Целия файл

@@ -20,6 +20,7 @@ class EditableBox extends SingleChildRenderObjectWidget {
20 20
     @required this.showCursor,
21 21
     @required this.selection,
22 22
     @required this.selectionColor,
23
+    @required this.cursorColor,
23 24
   }) : super(child: child);
24 25
 
25 26
   final ContainerNode node;
@@ -28,6 +29,7 @@ class EditableBox extends SingleChildRenderObjectWidget {
28 29
   final ValueNotifier<bool> showCursor;
29 30
   final TextSelection selection;
30 31
   final Color selectionColor;
32
+  final Color cursorColor;
31 33
 
32 34
   @override
33 35
   RenderEditableProxyBox createRenderObject(BuildContext context) {
@@ -38,6 +40,7 @@ class EditableBox extends SingleChildRenderObjectWidget {
38 40
       showCursor: showCursor,
39 41
       selection: selection,
40 42
       selectionColor: selectionColor,
43
+      cursorColor: cursorColor,
41 44
     );
42 45
   }
43 46
 
@@ -50,7 +53,8 @@ class EditableBox extends SingleChildRenderObjectWidget {
50 53
       ..renderContext = renderContext
51 54
       ..showCursor = showCursor
52 55
       ..selection = selection
53
-      ..selectionColor = selectionColor;
56
+      ..selectionColor = selectionColor
57
+      ..cursorColor = cursorColor;
54 58
   }
55 59
 }
56 60
 
@@ -67,6 +71,7 @@ class RenderEditableProxyBox extends RenderBox
67 71
     @required ValueNotifier<bool> showCursor,
68 72
     @required TextSelection selection,
69 73
     @required Color selectionColor,
74
+    @required Color cursorColor,
70 75
   })  : _node = node,
71 76
         _layerLink = layerLink,
72 77
         _renderContext = renderContext,
@@ -75,6 +80,16 @@ class RenderEditableProxyBox extends RenderBox
75 80
         _selectionColor = selectionColor,
76 81
         super() {
77 82
     this.child = child;
83
+    _cursorPainter = CursorPainter(cursorColor);
84
+  }
85
+
86
+  CursorPainter _cursorPainter;
87
+
88
+  set cursorColor(Color value) {
89
+    if (_cursorPainter.color != value) {
90
+      _cursorPainter.color = value;
91
+      markNeedsPaint();
92
+    }
78 93
   }
79 94
 
80 95
   bool _isDirty = true;
@@ -182,7 +197,7 @@ class RenderEditableProxyBox extends RenderBox
182 197
   @mustCallSuper
183 198
   void performLayout() {
184 199
     super.performLayout();
185
-    _caretPainter.layout(preferredLineHeight);
200
+    _cursorPainter.layout(preferredLineHeight);
186 201
     // Indicate to render context that this object can be used by other
187 202
     // layers (selection overlay, for instance).
188 203
     _isDirty = false;
@@ -207,16 +222,14 @@ class RenderEditableProxyBox extends RenderBox
207 222
       paintSelection(context, offset, selection, selectionColor);
208 223
     }
209 224
     if (isCaretVisible) {
210
-      _paintCaret(context, offset);
225
+      _paintCursor(context, offset);
211 226
     }
212 227
   }
213 228
 
214
-  final CaretPainter _caretPainter = new CaretPainter();
215
-
216
-  void _paintCaret(PaintingContext context, Offset offset) {
229
+  void _paintCursor(PaintingContext context, Offset offset) {
217 230
     Offset caretOffset =
218
-        getOffsetForCaret(_selection.extent, _caretPainter.prototype);
219
-    _caretPainter.paint(context.canvas, caretOffset + offset);
231
+        getOffsetForCaret(_selection.extent, _cursorPainter.prototype);
232
+    _cursorPainter.paint(context.canvas, caretOffset + offset);
220 233
   }
221 234
 
222 235
   @override

+ 13
- 8
packages/zefyr/lib/src/widgets/editable_text.dart Целия файл

@@ -82,6 +82,17 @@ class _ZefyrEditableTextState extends State<ZefyrEditableText>
82 82
       FocusScope.of(context).requestFocus(focusNode);
83 83
   }
84 84
 
85
+  void focusOrUnfocusIfNeeded() {
86
+    if (!_didAutoFocus && widget.autofocus && widget.enabled) {
87
+      FocusScope.of(context).autofocus(focusNode);
88
+      _didAutoFocus = true;
89
+    }
90
+    if (!widget.enabled && focusNode.hasFocus) {
91
+      _didAutoFocus = false;
92
+      focusNode.unfocus();
93
+    }
94
+  }
95
+
85 96
   //
86 97
   // Overridden members of State
87 98
   //
@@ -125,14 +136,7 @@ class _ZefyrEditableTextState extends State<ZefyrEditableText>
125 136
   void didUpdateWidget(ZefyrEditableText oldWidget) {
126 137
     super.didUpdateWidget(oldWidget);
127 138
     _updateSubscriptions(oldWidget);
128
-    if (!_didAutoFocus && widget.autofocus && widget.enabled) {
129
-      FocusScope.of(context).autofocus(focusNode);
130
-      _didAutoFocus = true;
131
-    }
132
-    if (!widget.enabled && focusNode.hasFocus) {
133
-      _didAutoFocus = false;
134
-      focusNode.unfocus();
135
-    }
139
+    focusOrUnfocusIfNeeded();
136 140
   }
137 141
 
138 142
   @override
@@ -149,6 +153,7 @@ class _ZefyrEditableTextState extends State<ZefyrEditableText>
149 153
       _cursorTimer = scope.cursorTimer;
150 154
       _cursorTimer.startOrStop(focusNode, selection);
151 155
     }
156
+    focusOrUnfocusIfNeeded();
152 157
   }
153 158
 
154 159
   @override

+ 1
- 1
packages/zefyr/lib/src/widgets/rich_text.dart Целия файл

@@ -128,7 +128,7 @@ class RenderZefyrParagraph extends RenderParagraph
128 128
   List<ui.TextBox> getEndpointsForSelection(TextSelection selection) {
129 129
     TextSelection local = getLocalSelection(selection);
130 130
     if (local.isCollapsed) {
131
-      final caret = CaretPainter.buildPrototype(preferredLineHeight);
131
+      final caret = CursorPainter.buildPrototype(preferredLineHeight);
132 132
       final offset = getOffsetForCaret(local.extent, caret);
133 133
       return [
134 134
         new ui.TextBox.fromLTRBD(

+ 6
- 0
packages/zefyr/lib/src/widgets/theme.dart Целия файл

@@ -60,6 +60,7 @@ class ZefyrThemeData {
60 60
   final HeadingTheme headingTheme;
61 61
   final BlockTheme blockTheme;
62 62
   final Color selectionColor;
63
+  final Color cursorColor;
63 64
 
64 65
   /// Size of indentation for blocks.
65 66
   final double indentSize;
@@ -88,6 +89,7 @@ class ZefyrThemeData {
88 89
       headingTheme: new HeadingTheme.fallback(),
89 90
       blockTheme: new BlockTheme.fallback(),
90 91
       selectionColor: Colors.lightBlueAccent.shade100,
92
+      cursorColor: Colors.black,
91 93
       indentSize: 16.0,
92 94
       toolbarTheme: new ZefyrToolbarTheme.fallback(context),
93 95
     );
@@ -101,6 +103,7 @@ class ZefyrThemeData {
101 103
     this.headingTheme,
102 104
     this.blockTheme,
103 105
     this.selectionColor,
106
+    this.cursorColor,
104 107
     this.indentSize,
105 108
     this.toolbarTheme,
106 109
   });
@@ -114,6 +117,7 @@ class ZefyrThemeData {
114 117
     HeadingTheme headingTheme,
115 118
     BlockTheme blockTheme,
116 119
     Color selectionColor,
120
+    Color cursorColor,
117 121
     double indentSize,
118 122
     ZefyrToolbarTheme toolbarTheme,
119 123
   }) {
@@ -125,6 +129,7 @@ class ZefyrThemeData {
125 129
       headingTheme: headingTheme ?? this.headingTheme,
126 130
       blockTheme: blockTheme ?? this.blockTheme,
127 131
       selectionColor: selectionColor ?? this.selectionColor,
132
+      cursorColor: cursorColor ?? this.cursorColor,
128 133
       indentSize: indentSize ?? this.indentSize,
129 134
       toolbarTheme: toolbarTheme ?? this.toolbarTheme,
130 135
     );
@@ -139,6 +144,7 @@ class ZefyrThemeData {
139 144
       headingTheme: other.headingTheme,
140 145
       blockTheme: other.blockTheme,
141 146
       selectionColor: other.selectionColor,
147
+      cursorColor: other.cursorColor,
142 148
       indentSize: other.indentSize,
143 149
       toolbarTheme: other.toolbarTheme,
144 150
     );

+ 1
- 1
packages/zefyr/pubspec.yaml Целия файл

@@ -1,6 +1,6 @@
1 1
 name: zefyr
2 2
 description: Clean, minimalistic and collaboration-ready rich text editor for Flutter.
3
-version: 0.3.0
3
+version: 0.3.1
4 4
 author: Anatoly Pulyaevskiy <anatoly.pulyaevskiy@gmail.com>
5 5
 homepage: https://github.com/memspace/zefyr
6 6
 

+ 4
- 3
packages/zefyr/test/painting/caret_painter_test.dart Целия файл

@@ -3,18 +3,19 @@
3 3
 // BSD-style license that can be found in the LICENSE file.
4 4
 import 'dart:ui';
5 5
 
6
+import 'package:flutter/material.dart';
6 7
 import 'package:flutter_test/flutter_test.dart';
7 8
 import 'package:zefyr/src/widgets/caret.dart';
8 9
 
9 10
 void main() {
10
-  group('$CaretPainter', () {
11
+  group('$CursorPainter', () {
11 12
     test('prototype is null before layout', () {
12
-      var painter = new CaretPainter();
13
+      var painter = new CursorPainter(Colors.black);
13 14
       expect(painter.prototype, isNull);
14 15
     });
15 16
 
16 17
     test('prototype is set after layout', () {
17
-      var painter = new CaretPainter();
18
+      var painter = new CursorPainter(Colors.black);
18 19
       painter.layout(16.0);
19 20
       expect(painter.prototype, new Rect.fromLTWH(0.0, 0.0, 1.0, 14.0));
20 21
     });

+ 1
- 0
packages/zefyr/test/rendering/render_editable_proxy_box_test.dart Целия файл

@@ -36,6 +36,7 @@ void main() {
36 36
         showCursor: ValueNotifier<bool>(true),
37 37
         selection: TextSelection.collapsed(offset: 0),
38 38
         selectionColor: Color(0),
39
+        cursorColor: Color(0),
39 40
       );
40 41
     });
41 42
 

+ 20
- 3
packages/zefyr/test/testing.dart Целия файл

@@ -21,12 +21,18 @@ class EditorSandBox {
21 21
     FocusNode focusNode,
22 22
     NotusDocument document,
23 23
     ZefyrThemeData theme,
24
+    bool autofocus: false,
24 25
   }) {
25 26
     focusNode ??= FocusNode();
26 27
     document ??= NotusDocument.fromDelta(delta);
27 28
     var controller = ZefyrController(document);
28 29
 
29
-    Widget widget = _ZefyrSandbox(controller: controller, focusNode: focusNode);
30
+    Widget widget = _ZefyrSandbox(
31
+      controller: controller,
32
+      focusNode: focusNode,
33
+      autofocus: autofocus,
34
+    );
35
+
30 36
     if (theme != null) {
31 37
       widget = ZefyrTheme(data: theme, child: widget);
32 38
     }
@@ -60,13 +66,21 @@ class EditorSandBox {
60 66
     return tester.pumpAndSettle();
61 67
   }
62 68
 
63
-  Future<void> tapEditor() async {
69
+  Future<void> pump() async {
64 70
     await tester.pumpWidget(widget);
71
+  }
72
+
73
+  Future<void> tap() async {
65 74
     await tester.tap(find.byType(ZefyrParagraph).first);
66 75
     await tester.pumpAndSettle();
67 76
     expect(focusNode.hasFocus, isTrue);
68 77
   }
69 78
 
79
+  Future<void> pumpAndTap() async {
80
+    await pump();
81
+    await tap();
82
+  }
83
+
70 84
   Future<void> tapHideKeyboardButton() async {
71 85
     await tapButtonWithIcon(Icons.keyboard_hide);
72 86
   }
@@ -101,10 +115,12 @@ class EditorSandBox {
101 115
 }
102 116
 
103 117
 class _ZefyrSandbox extends StatefulWidget {
104
-  const _ZefyrSandbox({Key key, this.controller, this.focusNode})
118
+  const _ZefyrSandbox(
119
+      {Key key, this.controller, this.focusNode, this.autofocus})
105 120
       : super(key: key);
106 121
   final ZefyrController controller;
107 122
   final FocusNode focusNode;
123
+  final bool autofocus;
108 124
 
109 125
   @override
110 126
   _ZefyrSandboxState createState() => _ZefyrSandboxState();
@@ -119,6 +135,7 @@ class _ZefyrSandboxState extends State<_ZefyrSandbox> {
119 135
       controller: widget.controller,
120 136
       focusNode: widget.focusNode,
121 137
       enabled: _enabled,
138
+      autofocus: widget.autofocus,
122 139
     );
123 140
   }
124 141
 

+ 12
- 12
packages/zefyr/test/widgets/buttons_test.dart Целия файл

@@ -13,7 +13,7 @@ void main() {
13 13
   group('$ZefyrButton', () {
14 14
     testWidgets('toggle style', (tester) async {
15 15
       final editor = new EditorSandBox(tester: tester);
16
-      await editor.tapEditor();
16
+      await editor.pumpAndTap();
17 17
       await editor.updateSelection(base: 5, extent: 10);
18 18
       await editor.tapButtonWithIcon(Icons.format_bold);
19 19
 
@@ -31,7 +31,7 @@ void main() {
31 31
     testWidgets('toggle state for different styles of the same attribute',
32 32
         (tester) async {
33 33
       final editor = new EditorSandBox(tester: tester);
34
-      await editor.tapEditor();
34
+      await editor.pumpAndTap();
35 35
 
36 36
       await editor.tapButtonWithIcon(Icons.format_list_bulleted);
37 37
       expect(editor.document.root.children.first, isInstanceOf<BlockNode>());
@@ -46,7 +46,7 @@ void main() {
46 46
   group('$HeadingButton', () {
47 47
     testWidgets('toggle menu', (tester) async {
48 48
       final editor = new EditorSandBox(tester: tester);
49
-      await editor.tapEditor();
49
+      await editor.pumpAndTap();
50 50
       await editor.tapButtonWithIcon(Icons.format_size);
51 51
 
52 52
       expect(find.text('H1'), findsOneWidget);
@@ -60,7 +60,7 @@ void main() {
60 60
 
61 61
     testWidgets('toggle styles', (tester) async {
62 62
       final editor = new EditorSandBox(tester: tester);
63
-      await editor.tapEditor();
63
+      await editor.pumpAndTap();
64 64
       await editor.tapButtonWithIcon(Icons.format_size);
65 65
       await editor.tapButtonWithText('H3');
66 66
       LineNode line = editor.document.root.children.first;
@@ -71,7 +71,7 @@ void main() {
71 71
 
72 72
     testWidgets('close overlay', (tester) async {
73 73
       final editor = new EditorSandBox(tester: tester);
74
-      await editor.tapEditor();
74
+      await editor.pumpAndTap();
75 75
       await editor.tapButtonWithIcon(Icons.format_size);
76 76
       expect(find.text('H1'), findsOneWidget);
77 77
       await editor.tapButtonWithIcon(Icons.close);
@@ -82,7 +82,7 @@ void main() {
82 82
   group('$LinkButton', () {
83 83
     testWidgets('disabled when selection is collapsed', (tester) async {
84 84
       final editor = new EditorSandBox(tester: tester);
85
-      await editor.tapEditor();
85
+      await editor.pumpAndTap();
86 86
       await editor.tapButtonWithIcon(Icons.link);
87 87
       expect(find.byIcon(Icons.link_off), findsNothing);
88 88
     });
@@ -90,7 +90,7 @@ void main() {
90 90
     testWidgets('enabled and toggles menu with non-empty selection',
91 91
         (tester) async {
92 92
       final editor = new EditorSandBox(tester: tester);
93
-      await editor.tapEditor();
93
+      await editor.pumpAndTap();
94 94
       await editor.updateSelection(base: 5, extent: 10);
95 95
       await editor.tapButtonWithIcon(Icons.link);
96 96
       expect(find.byIcon(Icons.link_off), findsOneWidget);
@@ -98,7 +98,7 @@ void main() {
98 98
 
99 99
     testWidgets('auto cancels edit on selection update', (tester) async {
100 100
       final editor = new EditorSandBox(tester: tester);
101
-      await editor.tapEditor();
101
+      await editor.pumpAndTap();
102 102
       await editor.updateSelection(base: 5, extent: 10);
103 103
       await editor.tapButtonWithIcon(Icons.link);
104 104
       await tester
@@ -111,7 +111,7 @@ void main() {
111 111
 
112 112
     testWidgets('editing link', (tester) async {
113 113
       final editor = new EditorSandBox(tester: tester);
114
-      await editor.tapEditor();
114
+      await editor.pumpAndTap();
115 115
       await editor.updateSelection(base: 5, extent: 10);
116 116
 
117 117
       await editor.tapButtonWithIcon(Icons.link);
@@ -160,7 +160,7 @@ void main() {
160 160
 
161 161
     testWidgets('toggle overlay', (tester) async {
162 162
       final editor = new EditorSandBox(tester: tester);
163
-      await editor.tapEditor();
163
+      await editor.pumpAndTap();
164 164
       await editor.tapButtonWithIcon(Icons.photo);
165 165
 
166 166
       expect(find.byIcon(Icons.photo_camera), findsOneWidget);
@@ -170,7 +170,7 @@ void main() {
170 170
 
171 171
     testWidgets('pick from camera', (tester) async {
172 172
       final editor = new EditorSandBox(tester: tester);
173
-      await editor.tapEditor();
173
+      await editor.pumpAndTap();
174 174
       await editor.tapButtonWithIcon(Icons.photo);
175 175
       await editor.tapButtonWithIcon(Icons.photo_camera);
176 176
       expect(log, hasLength(1));
@@ -189,7 +189,7 @@ void main() {
189 189
 
190 190
     testWidgets('pick from gallery', (tester) async {
191 191
       final editor = new EditorSandBox(tester: tester);
192
-      await editor.tapEditor();
192
+      await editor.pumpAndTap();
193 193
       await editor.tapButtonWithIcon(Icons.photo);
194 194
       await editor.tapButtonWithIcon(Icons.photo_library);
195 195
       expect(log, hasLength(1));

+ 1
- 1
packages/zefyr/test/widgets/code_test.dart Целия файл

@@ -11,7 +11,7 @@ void main() {
11 11
   group('$ZefyrCode', () {
12 12
     testWidgets('format as code', (tester) async {
13 13
       final editor = new EditorSandBox(tester: tester);
14
-      await editor.tapEditor();
14
+      await editor.pumpAndTap();
15 15
       await editor.tapButtonWithIcon(Icons.code);
16 16
 
17 17
       BlockNode block = editor.document.root.children.first;

+ 13
- 1
packages/zefyr/test/widgets/editable_text_test.dart Целия файл

@@ -11,11 +11,23 @@ void main() {
11 11
   group('$ZefyrEditableText', () {
12 12
     testWidgets('user input', (tester) async {
13 13
       final editor = new EditorSandBox(tester: tester);
14
-      await editor.tapEditor();
14
+      await editor.pumpAndTap();
15 15
       final currentValue = editor.document.toPlainText();
16 16
       await enterText(tester, 'Added $currentValue');
17 17
       expect(editor.document.toPlainText(), 'Added This House Is A Circus\n');
18 18
     });
19
+
20
+    testWidgets('autofocus', (tester) async {
21
+      final editor = new EditorSandBox(tester: tester, autofocus: true);
22
+      await editor.pump();
23
+      expect(editor.focusNode.hasFocus, isTrue);
24
+    });
25
+
26
+    testWidgets('no autofocus', (tester) async {
27
+      final editor = new EditorSandBox(tester: tester);
28
+      await editor.pump();
29
+      expect(editor.focusNode.hasFocus, isFalse);
30
+    });
19 31
   });
20 32
 }
21 33
 

+ 3
- 3
packages/zefyr/test/widgets/editor_test.dart Целия файл

@@ -22,7 +22,7 @@ void main() {
22 22
       var theme = ZefyrThemeData(linkStyle: TextStyle(color: Colors.red));
23 23
       var editor =
24 24
           new EditorSandBox(tester: tester, document: doc, theme: theme);
25
-      await editor.tapEditor();
25
+      await editor.pumpAndTap();
26 26
       // TODO: figure out why this extra pump is needed here
27 27
       await tester.pumpAndSettle();
28 28
       ZefyrRichText p = tester.widget(find.byType(ZefyrRichText).first);
@@ -31,7 +31,7 @@ void main() {
31 31
 
32 32
     testWidgets('collapses selection when unfocused', (tester) async {
33 33
       final editor = new EditorSandBox(tester: tester);
34
-      await editor.tapEditor();
34
+      await editor.pumpAndTap();
35 35
       await editor.updateSelection(base: 0, extent: 3);
36 36
       expect(editor.findSelectionHandle(), findsNWidgets(2));
37 37
       await editor.tapHideKeyboardButton();
@@ -41,7 +41,7 @@ void main() {
41 41
 
42 42
     testWidgets('toggle enabled state', (tester) async {
43 43
       final editor = new EditorSandBox(tester: tester);
44
-      await editor.tapEditor();
44
+      await editor.pumpAndTap();
45 45
       await editor.updateSelection(base: 0, extent: 3);
46 46
       await editor.disable();
47 47
       ZefyrEditor widget = tester.widget(find.byType(ZefyrEditor));

+ 4
- 4
packages/zefyr/test/widgets/horizontal_rule_test.dart Целия файл

@@ -11,7 +11,7 @@ void main() {
11 11
   group('$ZefyrHorizontalRule', () {
12 12
     testWidgets('format as horizontal rule', (tester) async {
13 13
       final editor = new EditorSandBox(tester: tester);
14
-      await editor.tapEditor();
14
+      await editor.pumpAndTap();
15 15
       await editor.tapButtonWithIcon(Icons.remove);
16 16
 
17 17
       LineNode line = editor.document.root.children.last;
@@ -21,7 +21,7 @@ void main() {
21 21
     testWidgets('tap left side of horizontal rule puts caret before it',
22 22
         (tester) async {
23 23
       final editor = new EditorSandBox(tester: tester);
24
-      await editor.tapEditor();
24
+      await editor.pumpAndTap();
25 25
       await editor.tapButtonWithIcon(Icons.remove);
26 26
       await editor.updateSelection(base: 0, extent: 0);
27 27
 
@@ -35,7 +35,7 @@ void main() {
35 35
     testWidgets('tap right side of horizontal rule puts caret after it',
36 36
         (tester) async {
37 37
       final editor = new EditorSandBox(tester: tester);
38
-      await editor.tapEditor();
38
+      await editor.pumpAndTap();
39 39
       await editor.tapButtonWithIcon(Icons.remove);
40 40
       await editor.updateSelection(base: 0, extent: 0);
41 41
 
@@ -51,7 +51,7 @@ void main() {
51 51
     testWidgets('selects on long press',
52 52
         (tester) async {
53 53
       final editor = new EditorSandBox(tester: tester);
54
-      await editor.tapEditor();
54
+      await editor.pumpAndTap();
55 55
       await editor.tapButtonWithIcon(Icons.remove);
56 56
       await editor.updateSelection(base: 0, extent: 0);
57 57
 

+ 4
- 4
packages/zefyr/test/widgets/image_test.dart Целия файл

@@ -47,7 +47,7 @@ void main() {
47 47
 
48 48
     testWidgets('embed image', (tester) async {
49 49
       final editor = new EditorSandBox(tester: tester);
50
-      await editor.tapEditor();
50
+      await editor.pumpAndTap();
51 51
       await editor.tapButtonWithIcon(Icons.photo);
52 52
       await editor.tapButtonWithIcon(Icons.photo_camera);
53 53
       LineNode line = editor.document.root.children.last;
@@ -63,7 +63,7 @@ void main() {
63 63
     testWidgets('tap on left side of image puts caret before it',
64 64
         (tester) async {
65 65
       final editor = new EditorSandBox(tester: tester);
66
-      await editor.tapEditor();
66
+      await editor.pumpAndTap();
67 67
       await editor.tapButtonWithIcon(Icons.photo);
68 68
       await editor.tapButtonWithIcon(Icons.photo_camera);
69 69
       await editor.updateSelection(base: 0, extent: 0);
@@ -78,7 +78,7 @@ void main() {
78 78
     testWidgets('tap right side of image puts caret after it',
79 79
         (tester) async {
80 80
       final editor = new EditorSandBox(tester: tester);
81
-      await editor.tapEditor();
81
+      await editor.pumpAndTap();
82 82
       await editor.tapButtonWithIcon(Icons.photo);
83 83
       await editor.tapButtonWithIcon(Icons.photo_camera);
84 84
       await editor.updateSelection(base: 0, extent: 0);
@@ -94,7 +94,7 @@ void main() {
94 94
 
95 95
     testWidgets('selects on long press', (tester) async {
96 96
       final editor = new EditorSandBox(tester: tester);
97
-      await editor.tapEditor();
97
+      await editor.pumpAndTap();
98 98
       await editor.tapButtonWithIcon(Icons.photo);
99 99
       await editor.tapButtonWithIcon(Icons.photo_camera);
100 100
       await editor.updateSelection(base: 0, extent: 0);

+ 1
- 1
packages/zefyr/test/widgets/list_test.dart Целия файл

@@ -11,7 +11,7 @@ void main() {
11 11
   group('$ZefyrList', () {
12 12
     testWidgets('format as list', (tester) async {
13 13
       final editor = new EditorSandBox(tester: tester);
14
-      await editor.tapEditor();
14
+      await editor.pumpAndTap();
15 15
       await editor.tapButtonWithIcon(Icons.format_list_bulleted);
16 16
       BlockNode block = editor.document.root.children.first;
17 17
       expect(block.style.get(NotusAttribute.block),

+ 1
- 1
packages/zefyr/test/widgets/quote_test.dart Целия файл

@@ -11,7 +11,7 @@ void main() {
11 11
   group('$ZefyrQuote', () {
12 12
     testWidgets('format as quote', (tester) async {
13 13
       final editor = new EditorSandBox(tester: tester);
14
-      await editor.tapEditor();
14
+      await editor.pumpAndTap();
15 15
       await editor.tapButtonWithIcon(Icons.format_quote);
16 16
 
17 17
       BlockNode block = editor.document.root.children.first;

+ 1
- 0
packages/zefyr/test/widgets/render_context_test.dart Целия файл

@@ -85,5 +85,6 @@ RenderEditableProxyBox createParagraph(ZefyrRenderContext viewport) {
85 85
     showCursor: showCursor,
86 86
     selection: selection,
87 87
     selectionColor: selectionColor,
88
+    cursorColor: Color(0),
88 89
   );
89 90
 }

+ 4
- 4
packages/zefyr/test/widgets/selection_test.dart Целия файл

@@ -12,7 +12,7 @@ void main() {
12 12
   group('$ZefyrSelectionOverlay', () {
13 13
     testWidgets('double tap caret shows toolbar', (tester) async {
14 14
       final editor = new EditorSandBox(tester: tester);
15
-      await editor.tapEditor();
15
+      await editor.pumpAndTap();
16 16
 
17 17
       RenderZefyrParagraph renderObject =
18 18
           tester.firstRenderObject(find.byType(ZefyrRichText));
@@ -27,7 +27,7 @@ void main() {
27 27
 
28 28
     testWidgets('hides when editor lost focus', (tester) async {
29 29
       final editor = new EditorSandBox(tester: tester);
30
-      await editor.tapEditor();
30
+      await editor.pumpAndTap();
31 31
       await editor.updateSelection(base: 0, extent: 5);
32 32
       expect(editor.findSelectionHandle(), findsNWidgets(2));
33 33
       await editor.unfocus();
@@ -36,7 +36,7 @@ void main() {
36 36
 
37 37
     testWidgets('tap on padding area finds closest paragraph', (tester) async {
38 38
       final editor = new EditorSandBox(tester: tester);
39
-      await editor.tapEditor();
39
+      await editor.pumpAndTap();
40 40
       editor.controller
41 41
           .updateSelection(new TextSelection.collapsed(offset: 10));
42 42
       await tester.pumpAndSettle();
@@ -54,7 +54,7 @@ void main() {
54 54
 
55 55
     testWidgets('tap on empty space finds closest paragraph', (tester) async {
56 56
       final editor = new EditorSandBox(tester: tester);
57
-      await editor.tapEditor();
57
+      await editor.pumpAndTap();
58 58
       editor.controller.replaceText(10, 1, '\n',
59 59
           selection: new TextSelection.collapsed(offset: 0));
60 60
       await tester.pumpAndSettle();