Skip to content

Commit 5df7411

Browse files
committed
test [nfc]: Organize Flutter checks-extensions by library
1 parent a0de83f commit 5df7411

File tree

1 file changed

+101
-69
lines changed

1 file changed

+101
-69
lines changed

test/flutter_checks.dart

Lines changed: 101 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import 'package:flutter/material.dart';
77
import 'package:flutter/rendering.dart';
88
import 'package:flutter/services.dart';
99

10+
////////////////////////////////////////////////////////////////
11+
// From the Flutter engine, i.e. from dart:ui.
12+
//
13+
1014
extension PaintChecks on Subject<Paint> {
1115
Subject<Shader?> get shader => has((x) => x.shader, 'shader');
1216
}
@@ -26,15 +30,89 @@ extension RectChecks on Subject<Rect> {
2630
// TODO others
2731
}
2832

33+
extension FontVariationChecks on Subject<FontVariation> {
34+
Subject<String> get axis => has((x) => x.axis, 'axis');
35+
Subject<double> get value => has((x) => x.value, 'value');
36+
}
37+
38+
extension SizeChecks on Subject<Size> {
39+
Subject<double> get width => has((x) => x.width, 'width');
40+
Subject<double> get height => has((x) => x.height, 'height');
41+
}
42+
43+
////////////////////////////////////////////////////////////////
44+
// From 'package:flutter/foundation.dart'.
45+
//
46+
47+
extension ValueListenableChecks<T> on Subject<ValueListenable<T>> {
48+
Subject<T> get value => has((c) => c.value, 'value');
49+
}
50+
51+
////////////////////////////////////////////////////////////////
52+
// From 'package:flutter/services.dart'.
53+
//
54+
55+
extension ClipboardDataChecks on Subject<ClipboardData> {
56+
Subject<String?> get text => has((d) => d.text, 'text');
57+
}
58+
59+
extension TextEditingValueChecks on Subject<TextEditingValue> {
60+
Subject<String> get text => has((x) => x.text, 'text');
61+
Subject<TextSelection> get selection => has((x) => x.selection, 'selection');
62+
Subject<TextRange> get composing => has((x) => x.composing, 'composing');
63+
}
64+
65+
////////////////////////////////////////////////////////////////
66+
// From 'package:flutter/animation.dart'.
67+
//
68+
2969
extension AnimationChecks<T> on Subject<Animation<T>> {
3070
Subject<AnimationStatus> get status => has((d) => d.status, 'status');
3171
Subject<T> get value => has((d) => d.value, 'value');
3272
}
3373

34-
extension ClipboardDataChecks on Subject<ClipboardData> {
35-
Subject<String?> get text => has((d) => d.text, 'text');
74+
////////////////////////////////////////////////////////////////
75+
// From 'package:flutter/painting.dart'.
76+
//
77+
78+
extension TextStyleChecks on Subject<TextStyle> {
79+
Subject<bool> get inherit => has((t) => t.inherit, 'inherit');
80+
Subject<Color?> get color => has((t) => t.color, 'color');
81+
Subject<double?> get fontSize => has((t) => t.fontSize, 'fontSize');
82+
Subject<FontWeight?> get fontWeight => has((t) => t.fontWeight, 'fontWeight');
83+
Subject<double?> get letterSpacing => has((t) => t.letterSpacing, 'letterSpacing');
84+
Subject<List<FontVariation>?> get fontVariations => has((t) => t.fontVariations, 'fontVariations');
85+
Subject<String?> get fontFamily => has((t) => t.fontFamily, 'fontFamily');
86+
Subject<List<String>?> get fontFamilyFallback => has((t) => t.fontFamilyFallback, 'fontFamilyFallback');
87+
88+
// TODO others
89+
}
90+
91+
extension InlineSpanChecks on Subject<InlineSpan> {
92+
Subject<TextStyle?> get style => has((x) => x.style, 'style');
93+
}
94+
95+
extension BoxDecorationChecks on Subject<BoxDecoration> {
96+
Subject<Color?> get color => has((x) => x.color, 'color');
97+
}
98+
99+
////////////////////////////////////////////////////////////////
100+
// From 'package:flutter/rendering.dart'.
101+
//
102+
103+
extension RenderBoxChecks on Subject<RenderBox> {
104+
Subject<Size> get size => has((x) => x.size, 'size');
36105
}
37106

107+
extension RenderParagraphChecks on Subject<RenderParagraph> {
108+
Subject<InlineSpan> get text => has((x) => x.text, 'text');
109+
Subject<bool> get didExceedMaxLines => has((x) => x.didExceedMaxLines, 'didExceedMaxLines');
110+
}
111+
112+
////////////////////////////////////////////////////////////////
113+
// From 'package:flutter/widgets.dart'.
114+
//
115+
38116
extension ColoredBoxChecks on Subject<ColoredBox> {
39117
Subject<Color?> get color => has((d) => d.color, 'color');
40118
}
@@ -45,10 +123,6 @@ extension GlobalKeyChecks<T extends State<StatefulWidget>> on Subject<GlobalKey<
45123
Subject<T?> get currentState => has((k) => k.currentState, 'currentState');
46124
}
47125

48-
extension RenderBoxChecks on Subject<RenderBox> {
49-
Subject<Size> get size => has((x) => x.size, 'size');
50-
}
51-
52126
extension IconChecks on Subject<Icon> {
53127
Subject<IconData?> get icon => has((i) => i.icon, 'icon');
54128
Subject<Color?> get color => has((i) => i.color, 'color');
@@ -70,47 +144,41 @@ extension RouteSettingsChecks<T> on Subject<RouteSettings> {
70144
Subject<Object?> get arguments => has((s) => s.arguments, 'arguments');
71145
}
72146

73-
extension ValueListenableChecks<T> on Subject<ValueListenable<T>> {
74-
Subject<T> get value => has((c) => c.value, 'value');
75-
}
76-
77147
extension TextChecks on Subject<Text> {
78148
Subject<String?> get data => has((t) => t.data, 'data');
79149
Subject<TextStyle?> get style => has((t) => t.style, 'style');
80150
}
81151

82-
extension TextEditingValueChecks on Subject<TextEditingValue> {
83-
Subject<String> get text => has((x) => x.text, 'text');
84-
Subject<TextSelection> get selection => has((x) => x.selection, 'selection');
85-
Subject<TextRange> get composing => has((x) => x.composing, 'composing');
86-
}
87-
88152
extension TextEditingControllerChecks on Subject<TextEditingController> {
89153
Subject<String?> get text => has((t) => t.text, 'text');
90154
}
91155

92-
extension TextFieldChecks on Subject<TextField> {
93-
Subject<TextCapitalization?> get textCapitalization => has((t) => t.textCapitalization, 'textCapitalization');
94-
Subject<InputDecoration?> get decoration => has((t) => t.decoration, 'decoration');
95-
Subject<TextEditingController?> get controller => has((t) => t.controller, 'controller');
156+
extension ElementChecks on Subject<Element> {
157+
Subject<Size?> get size => has((t) => t.size, 'size');
158+
// TODO more
96159
}
97160

98-
extension TextStyleChecks on Subject<TextStyle> {
99-
Subject<bool> get inherit => has((t) => t.inherit, 'inherit');
100-
Subject<Color?> get color => has((t) => t.color, 'color');
101-
Subject<double?> get fontSize => has((t) => t.fontSize, 'fontSize');
102-
Subject<FontWeight?> get fontWeight => has((t) => t.fontWeight, 'fontWeight');
103-
Subject<double?> get letterSpacing => has((t) => t.letterSpacing, 'letterSpacing');
104-
Subject<List<FontVariation>?> get fontVariations => has((t) => t.fontVariations, 'fontVariations');
105-
Subject<String?> get fontFamily => has((t) => t.fontFamily, 'fontFamily');
106-
Subject<List<String>?> get fontFamilyFallback => has((t) => t.fontFamilyFallback, 'fontFamilyFallback');
161+
extension MediaQueryDataChecks on Subject<MediaQueryData> {
162+
Subject<TextScaler> get textScaler => has((x) => x.textScaler, 'textScaler');
163+
// TODO more
164+
}
107165

108-
// TODO others
166+
extension TableRowChecks on Subject<TableRow> {
167+
Subject<Decoration?> get decoration => has((x) => x.decoration, 'decoration');
109168
}
110169

111-
extension FontVariationChecks on Subject<FontVariation> {
112-
Subject<String> get axis => has((x) => x.axis, 'axis');
113-
Subject<double> get value => has((x) => x.value, 'value');
170+
extension TableChecks on Subject<Table> {
171+
Subject<List<TableRow>> get children => has((x) => x.children, 'children');
172+
}
173+
174+
////////////////////////////////////////////////////////////////
175+
// From 'package:flutter/material.dart'.
176+
//
177+
178+
extension TextFieldChecks on Subject<TextField> {
179+
Subject<TextCapitalization?> get textCapitalization => has((t) => t.textCapitalization, 'textCapitalization');
180+
Subject<InputDecoration?> get decoration => has((t) => t.decoration, 'decoration');
181+
Subject<TextEditingController?> get controller => has((t) => t.controller, 'controller');
114182
}
115183

116184
extension TextThemeChecks on Subject<TextTheme> {
@@ -139,30 +207,6 @@ extension TypographyChecks on Subject<Typography> {
139207
Subject<TextTheme> get tall => has((t) => t.tall, 'tall');
140208
}
141209

142-
extension InlineSpanChecks on Subject<InlineSpan> {
143-
Subject<TextStyle?> get style => has((x) => x.style, 'style');
144-
}
145-
146-
extension RenderParagraphChecks on Subject<RenderParagraph> {
147-
Subject<InlineSpan> get text => has((x) => x.text, 'text');
148-
Subject<bool> get didExceedMaxLines => has((x) => x.didExceedMaxLines, 'didExceedMaxLines');
149-
}
150-
151-
extension SizeChecks on Subject<Size> {
152-
Subject<double> get width => has((x) => x.width, 'width');
153-
Subject<double> get height => has((x) => x.height, 'height');
154-
}
155-
156-
extension ElementChecks on Subject<Element> {
157-
Subject<Size?> get size => has((t) => t.size, 'size');
158-
// TODO more
159-
}
160-
161-
extension MediaQueryDataChecks on Subject<MediaQueryData> {
162-
Subject<TextScaler> get textScaler => has((x) => x.textScaler, 'textScaler');
163-
// TODO more
164-
}
165-
166210
extension MaterialChecks on Subject<Material> {
167211
Subject<Color?> get color => has((x) => x.color, 'color');
168212
// TODO more
@@ -184,18 +228,6 @@ extension ThemeDataChecks on Subject<ThemeData> {
184228
Subject<Brightness> get brightness => has((x) => x.brightness, 'brightness');
185229
}
186230

187-
extension BoxDecorationChecks on Subject<BoxDecoration> {
188-
Subject<Color?> get color => has((x) => x.color, 'color');
189-
}
190-
191-
extension TableRowChecks on Subject<TableRow> {
192-
Subject<Decoration?> get decoration => has((x) => x.decoration, 'decoration');
193-
}
194-
195-
extension TableChecks on Subject<Table> {
196-
Subject<List<TableRow>> get children => has((x) => x.children, 'children');
197-
}
198-
199231
extension IconButtonChecks on Subject<IconButton> {
200232
Subject<bool?> get isSelected => has((x) => x.isSelected, 'isSelected');
201233
}

0 commit comments

Comments
 (0)