@@ -31,6 +31,7 @@ void main() {
31
31
scrimColor: Color (0x00000098 ),
32
32
elevation: 5.0 ,
33
33
shape: RoundedRectangleBorder (borderRadius: BorderRadius .all (Radius .circular (2.0 ))),
34
+ width: 200.0 ,
34
35
).debugFillProperties (builder);
35
36
36
37
final List <String > description = builder.properties
@@ -43,6 +44,7 @@ void main() {
43
44
'scrimColor: Color(0x00000098)' ,
44
45
'elevation: 5.0' ,
45
46
'shape: RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.circular(2.0))' ,
47
+ 'width: 200.0' ,
46
48
]);
47
49
});
48
50
@@ -63,13 +65,15 @@ void main() {
63
65
expect (_drawerMaterial (tester).elevation, 16.0 );
64
66
expect (_drawerMaterial (tester).shape, null );
65
67
expect (_scrim (tester).color, Colors .black54);
68
+ expect (_drawerRenderBox (tester).size.width, 304.0 );
66
69
});
67
70
68
71
testWidgets ('DrawerThemeData values are used when no Drawer properties are specified' , (WidgetTester tester) async {
69
72
const Color backgroundColor = Color (0x00000001 );
70
73
const Color scrimColor = Color (0x00000002 );
71
74
const double elevation = 7.0 ;
72
75
const RoundedRectangleBorder shape = RoundedRectangleBorder (borderRadius: BorderRadius .all (Radius .circular (16.0 )));
76
+ const double width = 200.0 ;
73
77
74
78
final GlobalKey <ScaffoldState > scaffoldKey = GlobalKey <ScaffoldState >();
75
79
await tester.pumpWidget (
@@ -80,6 +84,7 @@ void main() {
80
84
scrimColor: scrimColor,
81
85
elevation: elevation,
82
86
shape: shape,
87
+ width: width,
83
88
),
84
89
),
85
90
home: Scaffold (
@@ -95,13 +100,15 @@ void main() {
95
100
expect (_drawerMaterial (tester).elevation, elevation);
96
101
expect (_drawerMaterial (tester).shape, shape);
97
102
expect (_scrim (tester).color, scrimColor);
103
+ expect (_drawerRenderBox (tester).size.width, width);
98
104
});
99
105
100
106
testWidgets ('Drawer values take priority over DrawerThemeData values when both properties are specified' , (WidgetTester tester) async {
101
107
const Color backgroundColor = Color (0x00000001 );
102
108
const Color scrimColor = Color (0x00000002 );
103
109
const double elevation = 7.0 ;
104
110
const RoundedRectangleBorder shape = RoundedRectangleBorder (borderRadius: BorderRadius .all (Radius .circular (16.0 )));
111
+ const double width = 200.0 ;
105
112
106
113
final GlobalKey <ScaffoldState > scaffoldKey = GlobalKey <ScaffoldState >();
107
114
await tester.pumpWidget (
@@ -112,6 +119,7 @@ void main() {
112
119
scrimColor: Color (0x00000004 ),
113
120
elevation: 13.0 ,
114
121
shape: RoundedRectangleBorder (borderRadius: BorderRadius .all (Radius .circular (29.0 ))),
122
+ width: 400.0 ,
115
123
),
116
124
),
117
125
home: Scaffold (
@@ -121,6 +129,7 @@ void main() {
121
129
backgroundColor: backgroundColor,
122
130
elevation: elevation,
123
131
shape: shape,
132
+ width: width,
124
133
),
125
134
),
126
135
),
@@ -132,13 +141,15 @@ void main() {
132
141
expect (_drawerMaterial (tester).elevation, elevation);
133
142
expect (_drawerMaterial (tester).shape, shape);
134
143
expect (_scrim (tester).color, scrimColor);
144
+ expect (_drawerRenderBox (tester).size.width, width);
135
145
});
136
146
137
147
testWidgets ('DrawerTheme values take priority over ThemeData.drawerTheme values when both properties are specified' , (WidgetTester tester) async {
138
148
const Color backgroundColor = Color (0x00000001 );
139
149
const Color scrimColor = Color (0x00000002 );
140
150
const double elevation = 7.0 ;
141
151
const RoundedRectangleBorder shape = RoundedRectangleBorder (borderRadius: BorderRadius .all (Radius .circular (16.0 )));
152
+ const double width = 200.0 ;
142
153
143
154
final GlobalKey <ScaffoldState > scaffoldKey = GlobalKey <ScaffoldState >();
144
155
await tester.pumpWidget (
@@ -149,6 +160,7 @@ void main() {
149
160
scrimColor: Color (0x00000004 ),
150
161
elevation: 13.0 ,
151
162
shape: RoundedRectangleBorder (borderRadius: BorderRadius .all (Radius .circular (29.0 ))),
163
+ width: 400.0
152
164
),
153
165
),
154
166
home: DrawerTheme (
@@ -157,6 +169,7 @@ void main() {
157
169
scrimColor: scrimColor,
158
170
elevation: elevation,
159
171
shape: shape,
172
+ width: width,
160
173
),
161
174
child: Scaffold (
162
175
key: scaffoldKey,
@@ -172,6 +185,7 @@ void main() {
172
185
expect (_drawerMaterial (tester).elevation, elevation);
173
186
expect (_drawerMaterial (tester).shape, shape);
174
187
expect (_scrim (tester).color, scrimColor);
188
+ expect (_drawerRenderBox (tester).size.width, width);
175
189
});
176
190
}
177
191
@@ -200,3 +214,8 @@ Container _scrim(WidgetTester tester) {
200
214
),
201
215
);
202
216
}
217
+
218
+ // The RenderBox representing the Drawer.
219
+ RenderBox _drawerRenderBox (WidgetTester tester) {
220
+ return tester.renderObject (find.byType (Drawer ));
221
+ }
0 commit comments