|
@@ -26,7 +26,7 @@ class EditorSandBox {
|
26
|
26
|
document ??= NotusDocument.fromDelta(delta);
|
27
|
27
|
var controller = ZefyrController(document);
|
28
|
28
|
|
29
|
|
- Widget widget = ZefyrEditor(controller: controller, focusNode: focusNode);
|
|
29
|
+ Widget widget = _ZefyrSandbox(controller: controller, focusNode: focusNode);
|
30
|
30
|
if (theme != null) {
|
31
|
31
|
widget = ZefyrTheme(data: theme, child: widget);
|
32
|
32
|
}
|
|
@@ -52,6 +52,12 @@ class EditorSandBox {
|
52
|
52
|
return tester.pumpAndSettle();
|
53
|
53
|
}
|
54
|
54
|
|
|
55
|
+ Future<void> disable() {
|
|
56
|
+ _ZefyrSandboxState state = tester.state(find.byType(_ZefyrSandbox));
|
|
57
|
+ state.disable();
|
|
58
|
+ return tester.pumpAndSettle();
|
|
59
|
+ }
|
|
60
|
+
|
55
|
61
|
Future<void> tapEditor() async {
|
56
|
62
|
await tester.pumpWidget(widget);
|
57
|
63
|
await tester.tap(find.byType(ZefyrParagraph).first);
|
|
@@ -91,3 +97,32 @@ class EditorSandBox {
|
91
|
97
|
matching: find.byType(Positioned));
|
92
|
98
|
}
|
93
|
99
|
}
|
|
100
|
+
|
|
101
|
+class _ZefyrSandbox extends StatefulWidget {
|
|
102
|
+ const _ZefyrSandbox({Key key, this.controller, this.focusNode})
|
|
103
|
+ : super(key: key);
|
|
104
|
+ final ZefyrController controller;
|
|
105
|
+ final FocusNode focusNode;
|
|
106
|
+
|
|
107
|
+ @override
|
|
108
|
+ _ZefyrSandboxState createState() => _ZefyrSandboxState();
|
|
109
|
+}
|
|
110
|
+
|
|
111
|
+class _ZefyrSandboxState extends State<_ZefyrSandbox> {
|
|
112
|
+ bool _enabled = true;
|
|
113
|
+
|
|
114
|
+ @override
|
|
115
|
+ Widget build(BuildContext context) {
|
|
116
|
+ return new ZefyrEditor(
|
|
117
|
+ controller: widget.controller,
|
|
118
|
+ focusNode: widget.focusNode,
|
|
119
|
+ enabled: _enabled,
|
|
120
|
+ );
|
|
121
|
+ }
|
|
122
|
+
|
|
123
|
+ void disable() {
|
|
124
|
+ setState(() {
|
|
125
|
+ _enabled = false;
|
|
126
|
+ });
|
|
127
|
+ }
|
|
128
|
+}
|