Bläddra i källkod

Added pedantic to Zefyr and fixed lint warnings

Anatoly Pulyaevskiy 5 år sedan
förälder
incheckning
31853227b4
44 ändrade filer med 188 tillägg och 203 borttagningar
  1. 1
    19
      packages/zefyr/analysis_options.yaml
  2. 1
    1
      packages/zefyr/example/lib/main.dart
  3. 2
    2
      packages/zefyr/example/lib/src/editor_page.dart
  4. 3
    3
      packages/zefyr/example/lib/src/form.dart
  5. 6
    6
      packages/zefyr/example/lib/src/full_page.dart
  6. 1
    1
      packages/zefyr/example/lib/src/images.dart
  7. 3
    3
      packages/zefyr/example/lib/src/view.dart
  8. 1
    1
      packages/zefyr/lib/src/fast_diff.dart
  9. 5
    3
      packages/zefyr/lib/src/widgets/buttons.dart
  10. 4
    4
      packages/zefyr/lib/src/widgets/controller.dart
  11. 3
    3
      packages/zefyr/lib/src/widgets/cursor_timer.dart
  12. 3
    3
      packages/zefyr/lib/src/widgets/editable_box.dart
  13. 6
    5
      packages/zefyr/lib/src/widgets/editable_text.dart
  14. 3
    3
      packages/zefyr/lib/src/widgets/editor.dart
  15. 1
    1
      packages/zefyr/lib/src/widgets/field.dart
  16. 12
    12
      packages/zefyr/lib/src/widgets/horizontal_rule.dart
  17. 1
    1
      packages/zefyr/lib/src/widgets/image.dart
  18. 1
    1
      packages/zefyr/lib/src/widgets/input.dart
  19. 2
    2
      packages/zefyr/lib/src/widgets/quote.dart
  20. 3
    3
      packages/zefyr/lib/src/widgets/render_context.dart
  21. 7
    7
      packages/zefyr/lib/src/widgets/rich_text.dart
  22. 1
    1
      packages/zefyr/lib/src/widgets/scope.dart
  23. 1
    1
      packages/zefyr/lib/src/widgets/selection.dart
  24. 16
    17
      packages/zefyr/lib/src/widgets/theme.dart
  25. 2
    2
      packages/zefyr/lib/src/widgets/toolbar.dart
  26. 8
    8
      packages/zefyr/lib/src/widgets/view.dart
  27. 1
    0
      packages/zefyr/pubspec.yaml
  28. 3
    3
      packages/zefyr/test/painting/caret_painter_test.dart
  29. 1
    1
      packages/zefyr/test/rendering/render_editable_proxy_box_test.dart
  30. 6
    6
      packages/zefyr/test/rendering/render_zefyr_paragraph_test.dart
  31. 4
    4
      packages/zefyr/test/testing.dart
  32. 6
    6
      packages/zefyr/test/util_test.dart
  33. 12
    12
      packages/zefyr/test/widgets/buttons_test.dart
  34. 1
    1
      packages/zefyr/test/widgets/code_test.dart
  35. 18
    18
      packages/zefyr/test/widgets/controller_test.dart
  36. 5
    5
      packages/zefyr/test/widgets/editable_text_test.dart
  37. 5
    5
      packages/zefyr/test/widgets/editor_test.dart
  38. 5
    5
      packages/zefyr/test/widgets/horizontal_rule_test.dart
  39. 5
    5
      packages/zefyr/test/widgets/image_test.dart
  40. 1
    1
      packages/zefyr/test/widgets/list_test.dart
  41. 1
    1
      packages/zefyr/test/widgets/quote_test.dart
  42. 7
    7
      packages/zefyr/test/widgets/render_context_test.dart
  43. 4
    4
      packages/zefyr/test/widgets/rich_text_test.dart
  44. 6
    6
      packages/zefyr/test/widgets/selection_test.dart

+ 1
- 19
packages/zefyr/analysis_options.yaml Visa fil

@@ -1,19 +1 @@
1
-analyzer:
2
-  strong-mode:
3
-    implicit-dynamic: false
4
-
5
-# Lint rules and documentation, see http://dart-lang.github.io/linter/lints
6
-linter:
7
-  rules:
8
-    - avoid_init_to_null
9
-    - cancel_subscriptions
10
-    - close_sinks
11
-    - directives_ordering
12
-    - hash_and_equals
13
-    - iterable_contains_unrelated_type
14
-    - list_remove_unrelated_type
15
-    - prefer_final_fields
16
-    - prefer_is_not_empty
17
-    - test_types_in_equals
18
-    - unrelated_type_equality_checks
19
-    - valid_regexps
1
+include: package:pedantic/analysis_options.yaml

+ 1
- 1
packages/zefyr/example/lib/main.dart Visa fil

@@ -7,7 +7,7 @@ import 'src/full_page.dart';
7 7
 import 'src/view.dart';
8 8
 
9 9
 void main() {
10
-  runApp(new ZefyrApp());
10
+  runApp(ZefyrApp());
11 11
 }
12 12
 
13 13
 class ZefyrApp extends StatelessWidget {

+ 2
- 2
packages/zefyr/example/lib/src/editor_page.dart Visa fil

@@ -20,10 +20,10 @@ class EditorPageState extends State<EditorPage> {
20 20
   @override
21 21
   void initState() {
22 22
     super.initState();
23
-    _focusNode = new FocusNode();
23
+    _focusNode = FocusNode();
24 24
     _loadDocument().then((document) {
25 25
       setState(() {
26
-        _controller = new ZefyrController(document);
26
+        _controller = ZefyrController(document);
27 27
       });
28 28
     });
29 29
   }

+ 3
- 3
packages/zefyr/example/lib/src/form.dart Visa fil

@@ -15,7 +15,7 @@ class FormEmbeddedScreen extends StatefulWidget {
15 15
 
16 16
 class _FormEmbeddedScreenState extends State<FormEmbeddedScreen> {
17 17
   final ZefyrController _controller = ZefyrController(NotusDocument());
18
-  final FocusNode _focusNode = new FocusNode();
18
+  final FocusNode _focusNode = FocusNode();
19 19
 
20 20
   @override
21 21
   Widget build(BuildContext context) {
@@ -45,7 +45,7 @@ class _FormEmbeddedScreenState extends State<FormEmbeddedScreen> {
45 45
   }
46 46
 
47 47
   Widget buildEditor() {
48
-    final theme = new ZefyrThemeData(
48
+    final theme = ZefyrThemeData(
49 49
       toolbarTheme: ZefyrToolbarTheme.fallback(context).copyWith(
50 50
         color: Colors.grey.shade800,
51 51
         toggleColor: Colors.grey.shade900,
@@ -62,7 +62,7 @@ class _FormEmbeddedScreenState extends State<FormEmbeddedScreen> {
62 62
         controller: _controller,
63 63
         focusNode: _focusNode,
64 64
         autofocus: true,
65
-        imageDelegate: new CustomImageDelegate(),
65
+        imageDelegate: CustomImageDelegate(),
66 66
         physics: ClampingScrollPhysics(),
67 67
       ),
68 68
     );

+ 6
- 6
packages/zefyr/example/lib/src/full_page.dart Visa fil

@@ -27,7 +27,7 @@ class ZefyrLogo extends StatelessWidget {
27 27
 
28 28
 class FullPageEditorScreen extends StatefulWidget {
29 29
   @override
30
-  _FullPageEditorScreenState createState() => new _FullPageEditorScreenState();
30
+  _FullPageEditorScreenState createState() => _FullPageEditorScreenState();
31 31
 }
32 32
 
33 33
 final doc =
@@ -44,7 +44,7 @@ Delta getDelta() {
44 44
 class _FullPageEditorScreenState extends State<FullPageEditorScreen> {
45 45
   final ZefyrController _controller =
46 46
       ZefyrController(NotusDocument.fromDelta(getDelta()));
47
-  final FocusNode _focusNode = new FocusNode();
47
+  final FocusNode _focusNode = FocusNode();
48 48
   bool _editing = false;
49 49
   StreamSubscription<NotusChange> _sub;
50 50
 
@@ -64,7 +64,7 @@ class _FullPageEditorScreenState extends State<FullPageEditorScreen> {
64 64
 
65 65
   @override
66 66
   Widget build(BuildContext context) {
67
-    final theme = new ZefyrThemeData(
67
+    final theme = ZefyrThemeData(
68 68
       cursorColor: Colors.blue,
69 69
       toolbarTheme: ZefyrToolbarTheme.fallback(context).copyWith(
70 70
         color: Colors.grey.shade800,
@@ -75,8 +75,8 @@ class _FullPageEditorScreenState extends State<FullPageEditorScreen> {
75 75
     );
76 76
 
77 77
     final done = _editing
78
-        ? [new FlatButton(onPressed: _stopEditing, child: Text('DONE'))]
79
-        : [new FlatButton(onPressed: _startEditing, child: Text('EDIT'))];
78
+        ? [FlatButton(onPressed: _stopEditing, child: Text('DONE'))]
79
+        : [FlatButton(onPressed: _startEditing, child: Text('EDIT'))];
80 80
     return Scaffold(
81 81
       resizeToAvoidBottomPadding: true,
82 82
       appBar: AppBar(
@@ -93,7 +93,7 @@ class _FullPageEditorScreenState extends State<FullPageEditorScreen> {
93 93
             controller: _controller,
94 94
             focusNode: _focusNode,
95 95
             mode: _editing ? ZefyrMode.edit : ZefyrMode.select,
96
-            imageDelegate: new CustomImageDelegate(),
96
+            imageDelegate: CustomImageDelegate(),
97 97
           ),
98 98
         ),
99 99
       ),

+ 1
- 1
packages/zefyr/example/lib/src/images.dart Visa fil

@@ -34,7 +34,7 @@ class CustomImageDelegate implements ZefyrImageDelegate<ImageSource> {
34 34
       // Otherwise assume this is a file stored locally on user's device.
35 35
       final file = File.fromUri(Uri.parse(key));
36 36
       final image = FileImage(file);
37
-      return new Image(image: image);
37
+      return Image(image: image);
38 38
     }
39 39
   }
40 40
 }

+ 3
- 3
packages/zefyr/example/lib/src/view.dart Visa fil

@@ -13,7 +13,7 @@ import 'images.dart';
13 13
 
14 14
 class ViewScreen extends StatefulWidget {
15 15
   @override
16
-  _ViewScreen createState() => new _ViewScreen();
16
+  _ViewScreen createState() => _ViewScreen();
17 17
 }
18 18
 
19 19
 final doc =
@@ -32,7 +32,7 @@ class _ViewScreen extends State<ViewScreen> {
32 32
 
33 33
   @override
34 34
   Widget build(BuildContext context) {
35
-    final theme = new ZefyrThemeData(
35
+    final theme = ZefyrThemeData(
36 36
       toolbarTheme: ZefyrToolbarTheme.fallback(context).copyWith(
37 37
         color: Colors.grey.shade800,
38 38
         toggleColor: Colors.grey.shade900,
@@ -64,7 +64,7 @@ class _ViewScreen extends State<ViewScreen> {
64 64
               padding: const EdgeInsets.all(16.0),
65 65
               child: ZefyrView(
66 66
                 document: doc,
67
-                imageDelegate: new CustomImageDelegate(),
67
+                imageDelegate: CustomImageDelegate(),
68 68
               ),
69 69
             )
70 70
           ],

+ 1
- 1
packages/zefyr/lib/src/fast_diff.dart Visa fil

@@ -19,7 +19,7 @@ DiffResult fastDiff(String oldText, String newText, int cursorPosition) {
19 19
   }
20 20
   final String deleted = (start < end) ? oldText.substring(start, end) : '';
21 21
   final inserted = newText.substring(start, end + delta);
22
-  return new DiffResult(start, deleted, inserted);
22
+  return DiffResult(start, deleted, inserted);
23 23
 }
24 24
 
25 25
 /// A diff between two strings of text.

+ 5
- 3
packages/zefyr/lib/src/widgets/buttons.dart Visa fil

@@ -280,16 +280,18 @@ class _ImageButtonState extends State<ImageButton> {
280 280
     final editor = ZefyrToolbar.of(context).editor;
281 281
     final image =
282 282
         await editor.imageDelegate.pickImage(editor.imageDelegate.cameraSource);
283
-    if (image != null)
283
+    if (image != null) {
284 284
       editor.formatSelection(NotusAttribute.embed.image(image));
285
+    }
285 286
   }
286 287
 
287 288
   void _pickFromGallery() async {
288 289
     final editor = ZefyrToolbar.of(context).editor;
289 290
     final image = await editor.imageDelegate
290 291
         .pickImage(editor.imageDelegate.gallerySource);
291
-    if (image != null)
292
+    if (image != null) {
292 293
       editor.formatSelection(NotusAttribute.embed.image(image));
294
+    }
293 295
   }
294 296
 }
295 297
 
@@ -480,7 +482,7 @@ class _LinkInput extends StatefulWidget {
480 482
   final bool formatError;
481 483
 
482 484
   const _LinkInput(
483
-      {Key key, @required this.controller, this.formatError: false})
485
+      {Key key, @required this.controller, this.formatError = false})
484 486
       : super(key: key);
485 487
 
486 488
   @override

+ 4
- 4
packages/zefyr/lib/src/widgets/controller.dart Visa fil

@@ -8,7 +8,7 @@ import 'package:notus/notus.dart';
8 8
 import 'package:quill_delta/quill_delta.dart';
9 9
 import 'package:zefyr/util.dart';
10 10
 
11
-const TextSelection _kZeroSelection = const TextSelection.collapsed(
11
+const TextSelection _kZeroSelection = TextSelection.collapsed(
12 12
   offset: 0,
13 13
   affinity: TextAffinity.upstream,
14 14
 );
@@ -48,14 +48,14 @@ class ZefyrController extends ChangeNotifier {
48 48
   ///
49 49
   /// [value] and [source] cannot be `null`.
50 50
   void updateSelection(TextSelection value,
51
-      {ChangeSource source: ChangeSource.remote}) {
51
+      {ChangeSource source = ChangeSource.remote}) {
52 52
     _updateSelectionSilent(value, source: source);
53 53
     notifyListeners();
54 54
   }
55 55
 
56 56
   // Updates selection without triggering notifications to listeners.
57 57
   void _updateSelectionSilent(TextSelection value,
58
-      {ChangeSource source: ChangeSource.remote}) {
58
+      {ChangeSource source = ChangeSource.remote}) {
59 59
     assert(value != null && source != null);
60 60
     _selection = value;
61 61
     _lastChangeSource = source;
@@ -76,7 +76,7 @@ class ZefyrController extends ChangeNotifier {
76 76
   ///
77 77
   /// If composing this change fails then this method throws [ComposeError].
78 78
   void compose(Delta change,
79
-      {TextSelection selection, ChangeSource source: ChangeSource.remote}) {
79
+      {TextSelection selection, ChangeSource source = ChangeSource.remote}) {
80 80
     if (change.isNotEmpty) {
81 81
       _document.compose(change, source);
82 82
     }

+ 3
- 3
packages/zefyr/lib/src/widgets/cursor_timer.dart Visa fil

@@ -4,10 +4,10 @@ import 'package:flutter/material.dart';
4 4
 
5 5
 /// Helper class that keeps state relevant to the editing cursor.
6 6
 class CursorTimer {
7
-  static const _kCursorBlinkHalfPeriod = const Duration(milliseconds: 500);
7
+  static const _kCursorBlinkHalfPeriod = Duration(milliseconds: 500);
8 8
 
9 9
   Timer _timer;
10
-  final ValueNotifier<bool> _showCursor = new ValueNotifier<bool>(false);
10
+  final ValueNotifier<bool> _showCursor = ValueNotifier<bool>(false);
11 11
 
12 12
   ValueNotifier<bool> get value => _showCursor;
13 13
 
@@ -18,7 +18,7 @@ class CursorTimer {
18 18
   /// Starts cursor timer.
19 19
   void start() {
20 20
     _showCursor.value = true;
21
-    _timer = new Timer.periodic(_kCursorBlinkHalfPeriod, _cursorTick);
21
+    _timer = Timer.periodic(_kCursorBlinkHalfPeriod, _cursorTick);
22 22
   }
23 23
 
24 24
   /// Stops cursor timer.

+ 3
- 3
packages/zefyr/lib/src/widgets/editable_box.dart Visa fil

@@ -96,19 +96,19 @@ class RenderEditableProxyBox extends RenderBox
96 96
 
97 97
   ContainerNode get node => _node;
98 98
   ContainerNode _node;
99
-  void set node(ContainerNode value) {
99
+  set node(ContainerNode value) {
100 100
     _node = value;
101 101
   }
102 102
 
103 103
   LayerLink get layerLink => _layerLink;
104 104
   LayerLink _layerLink;
105
-  void set layerLink(LayerLink value) {
105
+  set layerLink(LayerLink value) {
106 106
     if (_layerLink == value) return;
107 107
     _layerLink = value;
108 108
   }
109 109
 
110 110
   ZefyrRenderContext _renderContext;
111
-  void set renderContext(ZefyrRenderContext value) {
111
+  set renderContext(ZefyrRenderContext value) {
112 112
     if (_renderContext == value) return;
113 113
     if (attached) _renderContext.removeBox(this);
114 114
     _renderContext = value;

+ 6
- 5
packages/zefyr/lib/src/widgets/editable_text.dart Visa fil

@@ -36,9 +36,9 @@ class ZefyrEditableText extends StatefulWidget {
36 36
     @required this.focusNode,
37 37
     @required this.imageDelegate,
38 38
     this.selectionControls,
39
-    this.autofocus: true,
40
-    this.mode: ZefyrMode.edit,
41
-    this.padding: const EdgeInsets.symmetric(horizontal: 16.0),
39
+    this.autofocus = true,
40
+    this.mode = ZefyrMode.edit,
41
+    this.padding = const EdgeInsets.symmetric(horizontal: 16.0),
42 42
     this.physics,
43 43
   })  : assert(mode != null),
44 44
         assert(controller != null),
@@ -102,10 +102,11 @@ class _ZefyrEditableTextState extends State<ZefyrEditableText>
102 102
   /// focus, the control will then attach to the keyboard and request that the
103 103
   /// keyboard become visible.
104 104
   void requestKeyboard() {
105
-    if (_focusNode.hasFocus)
105
+    if (_focusNode.hasFocus) {
106 106
       _input.openConnection(widget.controller.plainTextEditingValue);
107
-    else
107
+    } else {
108 108
       FocusScope.of(context).requestFocus(_focusNode);
109
+    }
109 110
   }
110 111
 
111 112
   void focusOrUnfocusIfNeeded() {

+ 3
- 3
packages/zefyr/lib/src/widgets/editor.dart Visa fil

@@ -20,9 +20,9 @@ class ZefyrEditor extends StatefulWidget {
20 20
     Key key,
21 21
     @required this.controller,
22 22
     @required this.focusNode,
23
-    this.autofocus: true,
24
-    this.mode: ZefyrMode.edit,
25
-    this.padding: const EdgeInsets.symmetric(horizontal: 16.0),
23
+    this.autofocus = true,
24
+    this.mode = ZefyrMode.edit,
25
+    this.padding = const EdgeInsets.symmetric(horizontal: 16.0),
26 26
     this.toolbarDelegate,
27 27
     this.imageDelegate,
28 28
     this.selectionControls,

+ 1
- 1
packages/zefyr/lib/src/widgets/field.dart Visa fil

@@ -27,7 +27,7 @@ class ZefyrField extends StatefulWidget {
27 27
     this.height,
28 28
     this.controller,
29 29
     this.focusNode,
30
-    this.autofocus: false,
30
+    this.autofocus = false,
31 31
     this.mode,
32 32
     this.toolbarDelegate,
33 33
     this.imageDelegate,

+ 12
- 12
packages/zefyr/lib/src/widgets/horizontal_rule.dart Visa fil

@@ -17,7 +17,7 @@ class ZefyrHorizontalRule extends LeafRenderObjectWidget {
17 17
 
18 18
   @override
19 19
   RenderHorizontalRule createRenderObject(BuildContext context) {
20
-    return new RenderHorizontalRule(node: node);
20
+    return RenderHorizontalRule(node: node);
21 21
   }
22 22
 
23 23
   @override
@@ -57,13 +57,13 @@ class RenderHorizontalRule extends RenderEditableBox {
57 57
     if (local.isCollapsed) {
58 58
       final dx = local.extentOffset == 0 ? 0.0 : size.width;
59 59
       return [
60
-        new ui.TextBox.fromLTRBD(dx, 0.0, dx, size.height, TextDirection.ltr),
60
+        ui.TextBox.fromLTRBD(dx, 0.0, dx, size.height, TextDirection.ltr),
61 61
       ];
62 62
     }
63 63
 
64 64
     return [
65
-      new ui.TextBox.fromLTRBD(0.0, 0.0, 0.0, size.height, TextDirection.ltr),
66
-      new ui.TextBox.fromLTRBD(
65
+      ui.TextBox.fromLTRBD(0.0, 0.0, 0.0, size.height, TextDirection.ltr),
66
+      ui.TextBox.fromLTRBD(
67 67
           size.width, 0.0, size.width, size.height, TextDirection.ltr),
68 68
     ];
69 69
   }
@@ -71,13 +71,13 @@ class RenderHorizontalRule extends RenderEditableBox {
71 71
   @override
72 72
   void performLayout() {
73 73
     assert(constraints.hasBoundedWidth);
74
-    size = new Size(constraints.maxWidth, _kHeight);
74
+    size = Size(constraints.maxWidth, _kHeight);
75 75
   }
76 76
 
77 77
   @override
78 78
   void paint(PaintingContext context, Offset offset) {
79
-    final rect = new Rect.fromLTWH(0.0, 0.0, size.width, _kThickness);
80
-    final paint = new ui.Paint()..color = Colors.grey.shade200;
79
+    final rect = Rect.fromLTWH(0.0, 0.0, size.width, _kThickness);
80
+    final paint = ui.Paint()..color = Colors.grey.shade200;
81 81
     context.canvas.drawRect(rect.shift(offset), paint);
82 82
   }
83 83
 
@@ -88,13 +88,13 @@ class RenderHorizontalRule extends RenderEditableBox {
88 88
     if (offset.dx > size.width / 2) {
89 89
       position++;
90 90
     }
91
-    return new TextPosition(offset: position);
91
+    return TextPosition(offset: position);
92 92
   }
93 93
 
94 94
   @override
95 95
   TextRange getWordBoundary(TextPosition position) {
96 96
     final start = _node.documentOffset;
97
-    return new TextRange(start: start, end: start + 1);
97
+    return TextRange(start: start, end: start + 1);
98 98
   }
99 99
 
100 100
   @override
@@ -103,8 +103,8 @@ class RenderHorizontalRule extends RenderEditableBox {
103 103
     final localSelection = getLocalSelection(selection);
104 104
     assert(localSelection != null);
105 105
     if (!localSelection.isCollapsed) {
106
-      final Paint paint = new Paint()..color = selectionColor;
107
-      final rect = new Rect.fromLTWH(0.0, 0.0, size.width, _kHeight);
106
+      final Paint paint = Paint()..color = selectionColor;
107
+      final rect = Rect.fromLTWH(0.0, 0.0, size.width, _kHeight);
108 108
       context.canvas.drawRect(rect.shift(offset), paint);
109 109
     }
110 110
   }
@@ -114,7 +114,7 @@ class RenderHorizontalRule extends RenderEditableBox {
114 114
     final pos = position.offset - node.documentOffset;
115 115
     Offset caretOffset = Offset.zero;
116 116
     if (pos == 1) {
117
-      caretOffset = caretOffset + new Offset(size.width - 1.0, 0.0);
117
+      caretOffset = caretOffset + Offset(size.width - 1.0, 0.0);
118 118
     }
119 119
     return caretOffset;
120 120
   }

+ 1
- 1
packages/zefyr/lib/src/widgets/image.dart Visa fil

@@ -100,7 +100,7 @@ class RenderEditableImage extends RenderBox
100 100
   @override
101 101
   EmbedNode get node => _node;
102 102
   EmbedNode _node;
103
-  void set node(EmbedNode value) {
103
+  set node(EmbedNode value) {
104 104
     _node = value;
105 105
   }
106 106
 

+ 1
- 1
packages/zefyr/lib/src/widgets/input.dart Visa fil

@@ -13,7 +13,7 @@ class InputConnectionController implements TextInputClient {
13 13
       : assert(onValueChanged != null);
14 14
 
15 15
   //
16
-  // New public members
16
+  // public members
17 17
   //
18 18
 
19 19
   final RemoteValueChanged onValueChanged;

+ 2
- 2
packages/zefyr/lib/src/widgets/quote.dart Visa fil

@@ -36,9 +36,9 @@ class ZefyrQuote extends StatelessWidget {
36 36
 
37 37
     Widget content;
38 38
     if (line.style.contains(NotusAttribute.heading)) {
39
-      content = new ZefyrHeading(node: line, blockStyle: blockStyle);
39
+      content = ZefyrHeading(node: line, blockStyle: blockStyle);
40 40
     } else {
41
-      content = new ZefyrParagraph(node: line, blockStyle: blockStyle);
41
+      content = ZefyrParagraph(node: line, blockStyle: blockStyle);
42 42
     }
43 43
 
44 44
     final row = Row(children: <Widget>[Expanded(child: content)]);

+ 3
- 3
packages/zefyr/lib/src/widgets/render_context.dart Visa fil

@@ -35,8 +35,8 @@ import 'editable_box.dart';
35 35
 /// When a box is detached from rendering pipeline it unregisters
36 36
 /// itself by calling [removeBox].
37 37
 class ZefyrRenderContext extends ChangeNotifier {
38
-  final Set<RenderEditableProxyBox> _dirtyBoxes = new Set();
39
-  final Set<RenderEditableProxyBox> _activeBoxes = new Set();
38
+  final Set<RenderEditableProxyBox> _dirtyBoxes = Set();
39
+  final Set<RenderEditableProxyBox> _activeBoxes = Set();
40 40
 
41 41
   Set<RenderEditableProxyBox> get dirty => _dirtyBoxes;
42 42
   Set<RenderEditableProxyBox> get active => _activeBoxes;
@@ -116,7 +116,7 @@ class ZefyrRenderContext extends ChangeNotifier {
116 116
     box = _activeBoxes.map((p) {
117 117
       final localPoint = p.globalToLocal(point);
118 118
       final distance = localPoint.dy - p.size.height;
119
-      return new MapEntry(distance.abs(), p);
119
+      return MapEntry(distance.abs(), p);
120 120
     }).reduce((a, b) {
121 121
       return (a.key <= b.key) ? a : b;
122 122
     }).value;

+ 7
- 7
packages/zefyr/lib/src/widgets/rich_text.dart Visa fil

@@ -44,11 +44,11 @@ class RenderZefyrParagraph extends RenderParagraph
44 44
   RenderZefyrParagraph(
45 45
     TextSpan text, {
46 46
     @required LineNode node,
47
-    TextAlign textAlign: TextAlign.start,
47
+    TextAlign textAlign = TextAlign.start,
48 48
     @required TextDirection textDirection,
49
-    bool softWrap: true,
50
-    TextOverflow overflow: TextOverflow.clip,
51
-    double textScaleFactor: 1.0,
49
+    bool softWrap = true,
50
+    TextOverflow overflow = TextOverflow.clip,
51
+    double textScaleFactor = 1.0,
52 52
     int maxLines,
53 53
   })  : _node = node,
54 54
         _prototypePainter = TextPainter(
@@ -69,7 +69,7 @@ class RenderZefyrParagraph extends RenderParagraph
69 69
 
70 70
   LineNode get node => _node;
71 71
   LineNode _node;
72
-  void set node(LineNode value) {
72
+  set node(LineNode value) {
73 73
     _node = value;
74 74
   }
75 75
 
@@ -181,7 +181,7 @@ class RenderZefyrParagraph extends RenderParagraph
181 181
   //
182 182
 
183 183
   @override
184
-  void set text(InlineSpan value) {
184
+  set text(InlineSpan value) {
185 185
     _prototypePainter.text = TextSpan(text: '.', style: value.style);
186 186
     _selectionRects = null;
187 187
     super.text = value;
@@ -218,7 +218,7 @@ class RenderZefyrParagraph extends RenderParagraph
218 218
       _selectionRects = null;
219 219
     }
220 220
     _selectionRects ??= getBoxesForSelection(getLocalSelection(selection));
221
-    final Paint paint = new Paint()..color = selectionColor;
221
+    final Paint paint = Paint()..color = selectionColor;
222 222
     for (ui.TextBox box in _selectionRects) {
223 223
       context.canvas.drawRect(box.toRect().shift(offset), paint);
224 224
     }

+ 1
- 1
packages/zefyr/lib/src/widgets/scope.dart Visa fil

@@ -169,7 +169,7 @@ class ZefyrScope extends ChangeNotifier {
169 169
   }
170 170
 
171 171
   void updateSelection(TextSelection value,
172
-      {ChangeSource source: ChangeSource.remote}) {
172
+      {ChangeSource source = ChangeSource.remote}) {
173 173
     assert(isEditable);
174 174
     assert(!_disposed);
175 175
     _controller.updateSelection(value, source: source);

+ 1
- 1
packages/zefyr/lib/src/widgets/selection.dart Visa fil

@@ -109,7 +109,7 @@ class _ZefyrSelectionOverlayState extends State<ZefyrSelectionOverlay>
109 109
     _toolbarController?.stop();
110 110
   }
111 111
 
112
-  static const Duration _kFadeDuration = const Duration(milliseconds: 150);
112
+  static const Duration _kFadeDuration = Duration(milliseconds: 150);
113 113
 
114 114
   @override
115 115
   void initState() {

+ 16
- 17
packages/zefyr/lib/src/widgets/theme.dart Visa fil

@@ -41,7 +41,7 @@ class ZefyrTheme extends InheritedWidget {
41 41
   /// Returns `null` if there is no [ZefyrTheme] in the given build context
42 42
   /// and [nullOk] is set to `true`. If [nullOk] is set to `false` (default)
43 43
   /// then this method asserts.
44
-  static ZefyrThemeData of(BuildContext context, {bool nullOk: false}) {
44
+  static ZefyrThemeData of(BuildContext context, {bool nullOk = false}) {
45 45
     final ZefyrTheme widget = context.inheritFromWidgetOfExactType(ZefyrTheme);
46 46
     if (widget == null && nullOk) return null;
47 47
     assert(widget != null,
@@ -75,23 +75,22 @@ class ZefyrThemeData {
75 75
       color: Colors.grey.shade800,
76 76
     );
77 77
     final padding = const EdgeInsets.only(bottom: 16.0);
78
-    final boldStyle = new TextStyle(fontWeight: FontWeight.bold);
79
-    final italicStyle = new TextStyle(fontStyle: FontStyle.italic);
78
+    final boldStyle = TextStyle(fontWeight: FontWeight.bold);
79
+    final italicStyle = TextStyle(fontStyle: FontStyle.italic);
80 80
     final linkStyle =
81 81
         TextStyle(color: Colors.blue, decoration: TextDecoration.underline);
82 82
 
83
-    return new ZefyrThemeData(
83
+    return ZefyrThemeData(
84 84
       boldStyle: boldStyle,
85 85
       italicStyle: italicStyle,
86 86
       linkStyle: linkStyle,
87
-      paragraphTheme:
88
-          new StyleTheme(textStyle: paragraphStyle, padding: padding),
89
-      headingTheme: new HeadingTheme.fallback(),
90
-      blockTheme: new BlockTheme.fallback(themeData),
87
+      paragraphTheme: StyleTheme(textStyle: paragraphStyle, padding: padding),
88
+      headingTheme: HeadingTheme.fallback(),
89
+      blockTheme: BlockTheme.fallback(themeData),
91 90
       selectionColor: Colors.lightBlueAccent.shade100,
92 91
       cursorColor: Colors.black,
93 92
       indentSize: 16.0,
94
-      toolbarTheme: new ZefyrToolbarTheme.fallback(context),
93
+      toolbarTheme: ZefyrToolbarTheme.fallback(context),
95 94
     );
96 95
   }
97 96
 
@@ -121,7 +120,7 @@ class ZefyrThemeData {
121 120
     double indentSize,
122 121
     ZefyrToolbarTheme toolbarTheme,
123 122
   }) {
124
-    return new ZefyrThemeData(
123
+    return ZefyrThemeData(
125 124
       boldStyle: boldStyle ?? this.boldStyle,
126 125
       italicStyle: italicStyle ?? this.italicStyle,
127 126
       linkStyle: linkStyle ?? this.linkStyle,
@@ -237,15 +236,15 @@ class BlockTheme {
237 236
         break;
238 237
     }
239 238
 
240
-    return new BlockTheme(
241
-      bulletList: new StyleTheme(padding: padding),
242
-      numberList: new StyleTheme(padding: padding),
243
-      quote: new StyleTheme(
244
-        textStyle: new TextStyle(color: Colors.grey.shade700),
239
+    return BlockTheme(
240
+      bulletList: StyleTheme(padding: padding),
241
+      numberList: StyleTheme(padding: padding),
242
+      quote: StyleTheme(
243
+        textStyle: TextStyle(color: Colors.grey.shade700),
245 244
         padding: padding,
246 245
       ),
247
-      code: new StyleTheme(
248
-        textStyle: new TextStyle(
246
+      code: StyleTheme(
247
+        textStyle: TextStyle(
249 248
           color: Colors.blueGrey.shade800,
250 249
           fontFamily: fontFamily,
251 250
           fontSize: 14.0,

+ 2
- 2
packages/zefyr/lib/src/widgets/toolbar.dart Visa fil

@@ -66,7 +66,7 @@ class ZefyrToolbarScaffold extends StatelessWidget {
66 66
     Key key,
67 67
     @required this.body,
68 68
     this.trailing,
69
-    this.autoImplyTrailing: true,
69
+    this.autoImplyTrailing = true,
70 70
   }) : super(key: key);
71 71
 
72 72
   final Widget body;
@@ -102,7 +102,7 @@ class ZefyrToolbar extends StatefulWidget implements PreferredSizeWidget {
102 102
   const ZefyrToolbar({
103 103
     Key key,
104 104
     @required this.editor,
105
-    this.autoHide: true,
105
+    this.autoHide = true,
106 106
     this.delegate,
107 107
   }) : super(key: key);
108 108
 

+ 8
- 8
packages/zefyr/lib/src/widgets/view.dart Visa fil

@@ -86,25 +86,25 @@ class ZefyrViewState extends State<ZefyrView> {
86 86
   Widget _defaultChildBuilder(BuildContext context, Node node) {
87 87
     if (node is LineNode) {
88 88
       if (node.hasEmbed) {
89
-        return new RawZefyrLine(node: node);
89
+        return RawZefyrLine(node: node);
90 90
       } else if (node.style.contains(NotusAttribute.heading)) {
91
-        return new ZefyrHeading(node: node);
91
+        return ZefyrHeading(node: node);
92 92
       }
93
-      return new ZefyrParagraph(node: node);
93
+      return ZefyrParagraph(node: node);
94 94
     }
95 95
 
96 96
     final BlockNode block = node;
97 97
     final blockStyle = block.style.get(NotusAttribute.block);
98 98
     if (blockStyle == NotusAttribute.block.code) {
99
-      return new ZefyrCode(node: block);
99
+      return ZefyrCode(node: block);
100 100
     } else if (blockStyle == NotusAttribute.block.bulletList) {
101
-      return new ZefyrList(node: block);
101
+      return ZefyrList(node: block);
102 102
     } else if (blockStyle == NotusAttribute.block.numberList) {
103
-      return new ZefyrList(node: block);
103
+      return ZefyrList(node: block);
104 104
     } else if (blockStyle == NotusAttribute.block.quote) {
105
-      return new ZefyrQuote(node: block);
105
+      return ZefyrQuote(node: block);
106 106
     }
107 107
 
108
-    throw new UnimplementedError('Block format $blockStyle.');
108
+    throw UnimplementedError('Block format $blockStyle.');
109 109
   }
110 110
 }

+ 1
- 0
packages/zefyr/pubspec.yaml Visa fil

@@ -20,3 +20,4 @@ dependencies:
20 20
 dev_dependencies:
21 21
   flutter_test:
22 22
     sdk: flutter
23
+  pedantic: ^1.0.0

+ 3
- 3
packages/zefyr/test/painting/caret_painter_test.dart Visa fil

@@ -10,14 +10,14 @@ import 'package:zefyr/src/widgets/caret.dart';
10 10
 void main() {
11 11
   group('$CursorPainter', () {
12 12
     test('prototype is null before layout', () {
13
-      var painter = new CursorPainter(Colors.black);
13
+      var painter = CursorPainter(Colors.black);
14 14
       expect(painter.prototype, isNull);
15 15
     });
16 16
 
17 17
     test('prototype is set after layout', () {
18
-      var painter = new CursorPainter(Colors.black);
18
+      var painter = CursorPainter(Colors.black);
19 19
       painter.layout(16.0);
20
-      expect(painter.prototype, new Rect.fromLTWH(0.0, 0.0, 1.0, 14.0));
20
+      expect(painter.prototype, Rect.fromLTWH(0.0, 0.0, 1.0, 14.0));
21 21
     });
22 22
   });
23 23
 }

+ 1
- 1
packages/zefyr/test/rendering/render_editable_proxy_box_test.dart Visa fil

@@ -41,7 +41,7 @@ void main() {
41 41
     });
42 42
 
43 43
     test('it registers with render context', () {
44
-      var owner = new PipelineOwner();
44
+      var owner = PipelineOwner();
45 45
       expect(renderContext.active, isNot(contains(p)));
46 46
       p.attach(owner);
47 47
       expect(renderContext.dirty, contains(p));

+ 6
- 6
packages/zefyr/test/rendering/render_zefyr_paragraph_test.dart Visa fil

@@ -12,17 +12,17 @@ import 'package:zefyr/zefyr.dart';
12 12
 
13 13
 void main() {
14 14
   group('$RenderZefyrParagraph', () {
15
-    final doc = new NotusDocument();
15
+    final doc = NotusDocument();
16 16
     doc.insert(0, 'This House Is A Circus');
17
-    final text = new TextSpan(text: 'This House Is A Circus');
17
+    final text = TextSpan(text: 'This House Is A Circus');
18 18
 
19 19
     ZefyrRenderContext renderContext;
20 20
     RenderZefyrParagraph p;
21 21
 
22 22
     setUp(() {
23 23
       WidgetsFlutterBinding.ensureInitialized();
24
-      renderContext = new ZefyrRenderContext();
25
-      p = new RenderZefyrParagraph(
24
+      renderContext = ZefyrRenderContext();
25
+      p = RenderZefyrParagraph(
26 26
         text,
27 27
         node: doc.root.children.first as LineNode,
28 28
         textDirection: TextDirection.ltr,
@@ -30,11 +30,11 @@ void main() {
30 30
     });
31 31
 
32 32
     test('it registers with viewport', () {
33
-      var owner = new PipelineOwner();
33
+      var owner = PipelineOwner();
34 34
       expect(renderContext.active, isNot(contains(p)));
35 35
       p.attach(owner);
36 36
       expect(renderContext.dirty, contains(p));
37
-      p.layout(new BoxConstraints());
37
+      p.layout(BoxConstraints());
38 38
       expect(renderContext.active, contains(p));
39 39
     }, skip: 'TODO: move to RenderEditableProxyBox');
40 40
   });

+ 4
- 4
packages/zefyr/test/testing.dart Visa fil

@@ -7,7 +7,7 @@ import 'package:quill_delta/quill_delta.dart';
7 7
 import 'package:zefyr/src/widgets/selection.dart';
8 8
 import 'package:zefyr/zefyr.dart';
9 9
 
10
-var delta = new Delta()..insert('This House Is A Circus\n');
10
+var delta = Delta()..insert('This House Is A Circus\n');
11 11
 
12 12
 class EditorSandBox {
13 13
   final WidgetTester tester;
@@ -21,7 +21,7 @@ class EditorSandBox {
21 21
     FocusNode focusNode,
22 22
     NotusDocument document,
23 23
     ZefyrThemeData theme,
24
-    bool autofocus: false,
24
+    bool autofocus = false,
25 25
     ZefyrImageDelegate imageDelegate,
26 26
   }) {
27 27
     focusNode ??= FocusNode();
@@ -57,7 +57,7 @@ class EditorSandBox {
57 57
 
58 58
   Future<void> updateSelection({int base, int extent}) {
59 59
     controller.updateSelection(
60
-      new TextSelection(baseOffset: base, extentOffset: extent),
60
+      TextSelection(baseOffset: base, extentOffset: extent),
61 61
     );
62 62
     return tester.pumpAndSettle();
63 63
   }
@@ -138,7 +138,7 @@ class _ZefyrSandboxState extends State<_ZefyrSandbox> {
138 138
 
139 139
   @override
140 140
   Widget build(BuildContext context) {
141
-    return new ZefyrEditor(
141
+    return ZefyrEditor(
142 142
       controller: widget.controller,
143 143
       focusNode: widget.focusNode,
144 144
       mode: _enabled ? ZefyrMode.edit : ZefyrMode.view,

+ 6
- 6
packages/zefyr/test/util_test.dart Visa fil

@@ -8,10 +8,10 @@ import 'package:zefyr/util.dart';
8 8
 void main() {
9 9
   group('getPositionDelta', () {
10 10
     test('actual has more characters inserted than user', () {
11
-      final user = new Delta()
11
+      final user = Delta()
12 12
         ..retain(7)
13 13
         ..insert('a');
14
-      final actual = new Delta()
14
+      final actual = Delta()
15 15
         ..retain(7)
16 16
         ..insert('\na');
17 17
       final result = getPositionDelta(user, actual);
@@ -19,10 +19,10 @@ void main() {
19 19
     });
20 20
 
21 21
     test('actual has less characters inserted than user', () {
22
-      final user = new Delta()
22
+      final user = Delta()
23 23
         ..retain(7)
24 24
         ..insert('abc');
25
-      final actual = new Delta()
25
+      final actual = Delta()
26 26
         ..retain(7)
27 27
         ..insert('ab');
28 28
       final result = getPositionDelta(user, actual);
@@ -30,10 +30,10 @@ void main() {
30 30
     });
31 31
 
32 32
     test('actual has less characters deleted than user', () {
33
-      final user = new Delta()
33
+      final user = Delta()
34 34
         ..retain(7)
35 35
         ..delete(3);
36
-      final actual = new Delta()
36
+      final actual = Delta()
37 37
         ..retain(7)
38 38
         ..delete(2);
39 39
       final result = getPositionDelta(user, actual);

+ 12
- 12
packages/zefyr/test/widgets/buttons_test.dart Visa fil

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

+ 1
- 1
packages/zefyr/test/widgets/code_test.dart Visa fil

@@ -10,7 +10,7 @@ import '../testing.dart';
10 10
 void main() {
11 11
   group('$ZefyrCode', () {
12 12
     testWidgets('format as code', (tester) async {
13
-      final editor = new EditorSandBox(tester: tester);
13
+      final editor = EditorSandBox(tester: tester);
14 14
       await editor.pumpAndTap();
15 15
       await editor.tapButtonWithIcon(Icons.code);
16 16
 

+ 18
- 18
packages/zefyr/test/widgets/controller_test.dart Visa fil

@@ -11,8 +11,8 @@ void main() {
11 11
     ZefyrController controller;
12 12
 
13 13
     setUp(() {
14
-      var doc = new NotusDocument();
15
-      controller = new ZefyrController(doc);
14
+      var doc = NotusDocument();
15
+      controller = ZefyrController(doc);
16 16
     });
17 17
 
18 18
     test('dispose', () {
@@ -25,9 +25,9 @@ void main() {
25 25
       controller.addListener(() {
26 26
         notified = true;
27 27
       });
28
-      controller.updateSelection(new TextSelection.collapsed(offset: 0));
28
+      controller.updateSelection(TextSelection.collapsed(offset: 0));
29 29
       expect(notified, isTrue);
30
-      expect(controller.selection, new TextSelection.collapsed(offset: 0));
30
+      expect(controller.selection, TextSelection.collapsed(offset: 0));
31 31
       expect(controller.lastChangeSource, ChangeSource.remote);
32 32
     });
33 33
 
@@ -36,12 +36,12 @@ void main() {
36 36
       controller.addListener(() {
37 37
         notified = true;
38 38
       });
39
-      var selection = new TextSelection.collapsed(offset: 5);
40
-      var change = new Delta()..insert('Words');
39
+      var selection = TextSelection.collapsed(offset: 5);
40
+      var change = Delta()..insert('Words');
41 41
       controller.compose(change, selection: selection);
42 42
       expect(notified, isTrue);
43 43
       expect(controller.selection, selection);
44
-      expect(controller.document.toDelta(), new Delta()..insert('Words\n'));
44
+      expect(controller.document.toDelta(), Delta()..insert('Words\n'));
45 45
       expect(controller.lastChangeSource, ChangeSource.remote);
46 46
     });
47 47
 
@@ -50,16 +50,16 @@ void main() {
50 50
       controller.addListener(() {
51 51
         notified = true;
52 52
       });
53
-      var selection = new TextSelection.collapsed(offset: 5);
54
-      var change = new Delta()..insert('Words');
53
+      var selection = TextSelection.collapsed(offset: 5);
54
+      var change = Delta()..insert('Words');
55 55
       controller.compose(change, selection: selection);
56
-      var change2 = new Delta()..insert('More ');
56
+      var change2 = Delta()..insert('More ');
57 57
       controller.compose(change2);
58 58
       expect(notified, isTrue);
59
-      var expectedSelection = new TextSelection.collapsed(offset: 10);
59
+      var expectedSelection = TextSelection.collapsed(offset: 10);
60 60
       expect(controller.selection, expectedSelection);
61 61
       expect(
62
-          controller.document.toDelta(), new Delta()..insert('More Words\n'));
62
+          controller.document.toDelta(), Delta()..insert('More Words\n'));
63 63
       expect(controller.lastChangeSource, ChangeSource.remote);
64 64
     });
65 65
 
@@ -68,11 +68,11 @@ void main() {
68 68
       controller.addListener(() {
69 69
         notified = true;
70 70
       });
71
-      var selection = new TextSelection.collapsed(offset: 5);
71
+      var selection = TextSelection.collapsed(offset: 5);
72 72
       controller.replaceText(0, 0, 'Words', selection: selection);
73 73
       expect(notified, isTrue);
74 74
       expect(controller.selection, selection);
75
-      expect(controller.document.toDelta(), new Delta()..insert('Words\n'));
75
+      expect(controller.document.toDelta(), Delta()..insert('Words\n'));
76 76
       expect(controller.lastChangeSource, ChangeSource.local);
77 77
     });
78 78
 
@@ -86,7 +86,7 @@ void main() {
86 86
       expect(notified, isTrue);
87 87
       expect(
88 88
         controller.document.toDelta(),
89
-        new Delta()
89
+        Delta()
90 90
           ..insert('Words', NotusAttribute.bold.toJson())
91 91
           ..insert('\n'),
92 92
       );
@@ -98,13 +98,13 @@ void main() {
98 98
       controller.addListener(() {
99 99
         notified = true;
100 100
       });
101
-      var selection = new TextSelection(baseOffset: 0, extentOffset: 5);
101
+      var selection = TextSelection(baseOffset: 0, extentOffset: 5);
102 102
       controller.replaceText(0, 0, 'Words', selection: selection);
103 103
       controller.formatSelection(NotusAttribute.bold);
104 104
       expect(notified, isTrue);
105 105
       expect(
106 106
         controller.document.toDelta(),
107
-        new Delta()
107
+        Delta()
108 108
           ..insert('Words', NotusAttribute.bold.toJson())
109 109
           ..insert('\n'),
110 110
       );
@@ -112,7 +112,7 @@ void main() {
112 112
     });
113 113
 
114 114
     test('getSelectionStyle', () {
115
-      var selection = new TextSelection.collapsed(offset: 3);
115
+      var selection = TextSelection.collapsed(offset: 3);
116 116
       controller.replaceText(0, 0, 'Words', selection: selection);
117 117
       controller.formatText(0, 5, NotusAttribute.bold);
118 118
       var result = controller.getSelectionStyle();

+ 5
- 5
packages/zefyr/test/widgets/editable_text_test.dart Visa fil

@@ -10,7 +10,7 @@ import '../testing.dart';
10 10
 void main() {
11 11
   group('$ZefyrEditableText', () {
12 12
     testWidgets('user input', (tester) async {
13
-      final editor = new EditorSandBox(tester: tester);
13
+      final editor = EditorSandBox(tester: tester);
14 14
       await editor.pumpAndTap();
15 15
       final currentValue = editor.document.toPlainText();
16 16
       await enterText(tester, 'Added $currentValue');
@@ -18,13 +18,13 @@ void main() {
18 18
     });
19 19
 
20 20
     testWidgets('autofocus', (tester) async {
21
-      final editor = new EditorSandBox(tester: tester, autofocus: true);
21
+      final editor = EditorSandBox(tester: tester, autofocus: true);
22 22
       await editor.pump();
23 23
       expect(editor.focusNode.hasFocus, isTrue);
24 24
     });
25 25
 
26 26
     testWidgets('no autofocus', (tester) async {
27
-      final editor = new EditorSandBox(tester: tester);
27
+      final editor = EditorSandBox(tester: tester);
28 28
       await editor.pump();
29 29
       expect(editor.focusNode.hasFocus, isFalse);
30 30
     });
@@ -34,9 +34,9 @@ void main() {
34 34
 Future<Null> enterText(WidgetTester tester, String text) async {
35 35
   return TestAsyncUtils.guard(() async {
36 36
     tester.testTextInput.updateEditingValue(
37
-      new TextEditingValue(
37
+      TextEditingValue(
38 38
         text: text,
39
-        selection: new TextSelection.collapsed(offset: 6),
39
+        selection: TextSelection.collapsed(offset: 6),
40 40
       ),
41 41
     );
42 42
     await tester.idle();

+ 5
- 5
packages/zefyr/test/widgets/editor_test.dart Visa fil

@@ -12,16 +12,16 @@ import '../testing.dart';
12 12
 void main() {
13 13
   group('$ZefyrEditor', () {
14 14
     testWidgets('allows merging theme data', (tester) async {
15
-      var delta = new Delta()
15
+      var delta = Delta()
16 16
         ..insert(
17 17
           'Website',
18 18
           NotusAttribute.link.fromString('https://github.com').toJson(),
19 19
         )
20 20
         ..insert('\n');
21
-      var doc = new NotusDocument.fromDelta(delta);
21
+      var doc = NotusDocument.fromDelta(delta);
22 22
       var theme = ZefyrThemeData(linkStyle: TextStyle(color: Colors.red));
23 23
       var editor =
24
-          new EditorSandBox(tester: tester, document: doc, theme: theme);
24
+          EditorSandBox(tester: tester, document: doc, theme: theme);
25 25
       await editor.pumpAndTap();
26 26
       // TODO: figure out why this extra pump is needed here
27 27
       await tester.pumpAndSettle();
@@ -30,7 +30,7 @@ void main() {
30 30
     });
31 31
 
32 32
     testWidgets('collapses selection when unfocused', (tester) async {
33
-      final editor = new EditorSandBox(tester: tester);
33
+      final editor = EditorSandBox(tester: tester);
34 34
       await editor.pumpAndTap();
35 35
       await editor.updateSelection(base: 0, extent: 3);
36 36
       expect(editor.findSelectionHandle(), findsNWidgets(2));
@@ -40,7 +40,7 @@ void main() {
40 40
     });
41 41
 
42 42
     testWidgets('toggle enabled state', (tester) async {
43
-      final editor = new EditorSandBox(tester: tester);
43
+      final editor = EditorSandBox(tester: tester);
44 44
       await editor.pumpAndTap();
45 45
       await editor.updateSelection(base: 0, extent: 3);
46 46
       await editor.disable();

+ 5
- 5
packages/zefyr/test/widgets/horizontal_rule_test.dart Visa fil

@@ -10,7 +10,7 @@ import '../testing.dart';
10 10
 void main() {
11 11
   group('$ZefyrHorizontalRule', () {
12 12
     testWidgets('format as horizontal rule', (tester) async {
13
-      final editor = new EditorSandBox(tester: tester);
13
+      final editor = EditorSandBox(tester: tester);
14 14
       await editor.pumpAndTap();
15 15
       await editor.tapButtonWithIcon(Icons.remove);
16 16
 
@@ -20,7 +20,7 @@ void main() {
20 20
 
21 21
     testWidgets('tap left side of horizontal rule puts caret before it',
22 22
         (tester) async {
23
-      final editor = new EditorSandBox(tester: tester);
23
+      final editor = EditorSandBox(tester: tester);
24 24
       await editor.pumpAndTap();
25 25
       await editor.tapButtonWithIcon(Icons.remove);
26 26
       await editor.updateSelection(base: 0, extent: 0);
@@ -34,13 +34,13 @@ void main() {
34 34
 
35 35
     testWidgets('tap right side of horizontal rule puts caret after it',
36 36
         (tester) async {
37
-      final editor = new EditorSandBox(tester: tester);
37
+      final editor = EditorSandBox(tester: tester);
38 38
       await editor.pumpAndTap();
39 39
       await editor.tapButtonWithIcon(Icons.remove);
40 40
       await editor.updateSelection(base: 0, extent: 0);
41 41
 
42 42
       final hr = find.byType(ZefyrHorizontalRule);
43
-      final offset = tester.getBottomRight(hr) - new Offset(1.0, 1.0);
43
+      final offset = tester.getBottomRight(hr) - Offset(1.0, 1.0);
44 44
       await tester.tapAt(offset);
45 45
       LineNode line = editor.document.root.children.last;
46 46
       EmbedNode embed = line.children.single;
@@ -50,7 +50,7 @@ void main() {
50 50
 
51 51
     testWidgets('selects on long press',
52 52
         (tester) async {
53
-      final editor = new EditorSandBox(tester: tester);
53
+      final editor = EditorSandBox(tester: tester);
54 54
       await editor.pumpAndTap();
55 55
       await editor.tapButtonWithIcon(Icons.remove);
56 56
       await editor.updateSelection(base: 0, extent: 0);

+ 5
- 5
packages/zefyr/test/widgets/image_test.dart Visa fil

@@ -12,7 +12,7 @@ import '../testing.dart';
12 12
 void main() {
13 13
   group('$ZefyrImage', () {
14 14
     testWidgets('embed image', (tester) async {
15
-      final editor = new EditorSandBox(
15
+      final editor = EditorSandBox(
16 16
         tester: tester,
17 17
         imageDelegate: _TestImageDelegate(),
18 18
       );
@@ -31,7 +31,7 @@ void main() {
31 31
 
32 32
     testWidgets('tap on left side of image puts caret before it',
33 33
         (tester) async {
34
-      final editor = new EditorSandBox(
34
+      final editor = EditorSandBox(
35 35
         tester: tester,
36 36
         imageDelegate: _TestImageDelegate(),
37 37
       );
@@ -48,7 +48,7 @@ void main() {
48 48
     });
49 49
 
50 50
     testWidgets('tap right side of image puts caret after it', (tester) async {
51
-      final editor = new EditorSandBox(
51
+      final editor = EditorSandBox(
52 52
         tester: tester,
53 53
         imageDelegate: _TestImageDelegate(),
54 54
       );
@@ -58,7 +58,7 @@ void main() {
58 58
       await editor.updateSelection(base: 0, extent: 0);
59 59
 
60 60
       final img = find.byType(ZefyrImage);
61
-      final offset = tester.getBottomRight(img) - new Offset(1.0, 1.0);
61
+      final offset = tester.getBottomRight(img) - Offset(1.0, 1.0);
62 62
       await tester.tapAt(offset);
63 63
       LineNode line = editor.document.root.children.last;
64 64
       EmbedNode embed = line.children.single;
@@ -67,7 +67,7 @@ void main() {
67 67
     });
68 68
 
69 69
     testWidgets('selects on long press', (tester) async {
70
-      final editor = new EditorSandBox(
70
+      final editor = EditorSandBox(
71 71
         tester: tester,
72 72
         imageDelegate: _TestImageDelegate(),
73 73
       );

+ 1
- 1
packages/zefyr/test/widgets/list_test.dart Visa fil

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

+ 1
- 1
packages/zefyr/test/widgets/quote_test.dart Visa fil

@@ -10,7 +10,7 @@ import '../testing.dart';
10 10
 void main() {
11 11
   group('$ZefyrQuote', () {
12 12
     testWidgets('format as quote', (tester) async {
13
-      final editor = new EditorSandBox(tester: tester);
13
+      final editor = EditorSandBox(tester: tester);
14 14
       await editor.pumpAndTap();
15 15
       await editor.tapButtonWithIcon(Icons.format_quote);
16 16
 

+ 7
- 7
packages/zefyr/test/widgets/render_context_test.dart Visa fil

@@ -13,7 +13,7 @@ void main() {
13 13
 
14 14
     setUp(() {
15 15
       WidgetsFlutterBinding.ensureInitialized();
16
-      context = new ZefyrRenderContext();
16
+      context = ZefyrRenderContext();
17 17
     });
18 18
 
19 19
     test('adds to dirty list first', () {
@@ -53,7 +53,7 @@ void main() {
53 53
 
54 54
     testWidgets('notifyListeners is delayed to next frame', (tester) async {
55 55
       var focusNode = FocusNode();
56
-      var controller = ZefyrController(new NotusDocument());
56
+      var controller = ZefyrController(NotusDocument());
57 57
       var widget = MaterialApp(
58 58
         home: ZefyrScaffold(
59 59
           child: ZefyrEditor(
@@ -71,14 +71,14 @@ void main() {
71 71
 }
72 72
 
73 73
 RenderEditableProxyBox createParagraph(ZefyrRenderContext viewport) {
74
-  final doc = new NotusDocument();
74
+  final doc = NotusDocument();
75 75
   doc.insert(0, 'This House Is A Circus');
76 76
   final LineNode node = doc.root.children.first;
77
-  final link = new LayerLink();
78
-  final showCursor = new ValueNotifier<bool>(true);
79
-  final selection = new TextSelection.collapsed(offset: 0);
77
+  final link = LayerLink();
78
+  final showCursor = ValueNotifier<bool>(true);
79
+  final selection = TextSelection.collapsed(offset: 0);
80 80
   final selectionColor = Colors.blue;
81
-  return new RenderEditableProxyBox(
81
+  return RenderEditableProxyBox(
82 82
     node: node,
83 83
     layerLink: link,
84 84
     renderContext: viewport,

+ 4
- 4
packages/zefyr/test/widgets/rich_text_test.dart Visa fil

@@ -10,15 +10,15 @@ import 'package:zefyr/zefyr.dart';
10 10
 
11 11
 void main() {
12 12
   group('$ZefyrRichText', () {
13
-    final doc = new NotusDocument();
13
+    final doc = NotusDocument();
14 14
     doc.insert(0, 'This House Is A Circus');
15
-    final text = new TextSpan(text: 'This House Is A Circus');
15
+    final text = TextSpan(text: 'This House Is A Circus');
16 16
 
17 17
     Widget widget;
18 18
     setUp(() {
19
-      widget = new Directionality(
19
+      widget = Directionality(
20 20
         textDirection: TextDirection.ltr,
21
-        child: new ZefyrRichText(
21
+        child: ZefyrRichText(
22 22
           node: doc.root.children.first as LineNode,
23 23
           text: text,
24 24
         ),

+ 6
- 6
packages/zefyr/test/widgets/selection_test.dart Visa fil

@@ -11,7 +11,7 @@ import '../testing.dart';
11 11
 void main() {
12 12
   group('$ZefyrSelectionOverlay', () {
13 13
     testWidgets('double tap caret shows toolbar', (tester) async {
14
-      final editor = new EditorSandBox(tester: tester);
14
+      final editor = EditorSandBox(tester: tester);
15 15
       await editor.pumpAndTap();
16 16
 
17 17
       RenderZefyrParagraph renderObject =
@@ -26,7 +26,7 @@ void main() {
26 26
     });
27 27
 
28 28
     testWidgets('hides when editor lost focus', (tester) async {
29
-      final editor = new EditorSandBox(tester: tester);
29
+      final editor = EditorSandBox(tester: tester);
30 30
       await editor.pumpAndTap();
31 31
       await editor.updateSelection(base: 0, extent: 5);
32 32
       expect(editor.findSelectionHandle(), findsNWidgets(2));
@@ -35,10 +35,10 @@ void main() {
35 35
     });
36 36
 
37 37
     testWidgets('tap on padding area finds closest paragraph', (tester) async {
38
-      final editor = new EditorSandBox(tester: tester);
38
+      final editor = EditorSandBox(tester: tester);
39 39
       await editor.pumpAndTap();
40 40
       editor.controller
41
-          .updateSelection(new TextSelection.collapsed(offset: 10));
41
+          .updateSelection(TextSelection.collapsed(offset: 10));
42 42
       await tester.pumpAndSettle();
43 43
       expect(editor.controller.selection.extentOffset, 10);
44 44
 
@@ -53,10 +53,10 @@ void main() {
53 53
     });
54 54
 
55 55
     testWidgets('tap on empty space finds closest paragraph', (tester) async {
56
-      final editor = new EditorSandBox(tester: tester);
56
+      final editor = EditorSandBox(tester: tester);
57 57
       await editor.pumpAndTap();
58 58
       editor.controller.replaceText(10, 1, '\n',
59
-          selection: new TextSelection.collapsed(offset: 0));
59
+          selection: TextSelection.collapsed(offset: 0));
60 60
       await tester.pumpAndSettle();
61 61
       expect(editor.controller.document.toPlainText(),
62 62
           'This House\nIs A Circus\n');