@@ -97,7 +97,7 @@ void main() {
97
97
expect (box3.localToGlobal (Offset .zero).dy, greaterThan (510.0 ));
98
98
await expectLater (
99
99
find.byType (CustomScrollView ),
100
- matchesGoldenFile ('overscroll_stretch.vertical.top .png' ),
100
+ matchesGoldenFile ('overscroll_stretch.vertical.start.stretched .png' ),
101
101
);
102
102
103
103
await gesture.up ();
@@ -110,7 +110,11 @@ void main() {
110
110
111
111
// Jump to end of the list
112
112
controller.jumpTo (controller.position.maxScrollExtent);
113
+ await tester.pumpAndSettle ();
113
114
expect (controller.offset, 150.0 );
115
+ expect (box1.localToGlobal (Offset .zero).dy, - 150.0 );
116
+ expect (box2.localToGlobal (Offset .zero).dy, 100.0 );
117
+ expect (box3.localToGlobal (Offset .zero).dy, 350.0 );
114
118
await expectLater (
115
119
find.byType (CustomScrollView ),
116
120
matchesGoldenFile ('overscroll_stretch.vertical.end.png' ),
@@ -125,8 +129,16 @@ void main() {
125
129
expect (box3.localToGlobal (Offset .zero).dy, lessThan (350.0 ));
126
130
await expectLater (
127
131
find.byType (CustomScrollView ),
128
- matchesGoldenFile ('overscroll_stretch.vertical.bottom .png' ),
132
+ matchesGoldenFile ('overscroll_stretch.vertical.end.stretched .png' ),
129
133
);
134
+
135
+ await gesture.up ();
136
+ await tester.pumpAndSettle ();
137
+
138
+ // Stretch released back
139
+ expect (box1.localToGlobal (Offset .zero).dy, - 150.0 );
140
+ expect (box2.localToGlobal (Offset .zero).dy, 100.0 );
141
+ expect (box3.localToGlobal (Offset .zero).dy, 350.0 );
130
142
});
131
143
132
144
testWidgets ('Stretch overscroll works in reverse - vertical' , (WidgetTester tester) async {
@@ -162,7 +174,7 @@ void main() {
162
174
);
163
175
});
164
176
165
- testWidgets ('Stretch overscroll horizontally ' , (WidgetTester tester) async {
177
+ testWidgets ('Stretch overscroll works in reverse - horizontal ' , (WidgetTester tester) async {
166
178
final Key box1Key = UniqueKey ();
167
179
final Key box2Key = UniqueKey ();
168
180
final Key box3Key = UniqueKey ();
@@ -235,7 +247,7 @@ void main() {
235
247
expect (box3.localToGlobal (Offset .zero).dx, greaterThan (610.0 ));
236
248
await expectLater (
237
249
find.byType (CustomScrollView ),
238
- matchesGoldenFile ('overscroll_stretch.horizontal.left .png' ),
250
+ matchesGoldenFile ('overscroll_stretch.horizontal.start.stretched .png' ),
239
251
);
240
252
241
253
await gesture.up ();
@@ -248,7 +260,11 @@ void main() {
248
260
249
261
// Jump to end of the list
250
262
controller.jumpTo (controller.position.maxScrollExtent);
263
+ await tester.pumpAndSettle ();
251
264
expect (controller.offset, 100.0 );
265
+ expect (box1.localToGlobal (Offset .zero).dx, - 100.0 );
266
+ expect (box2.localToGlobal (Offset .zero).dx, 200.0 );
267
+ expect (box3.localToGlobal (Offset .zero).dx, 500.0 );
252
268
await expectLater (
253
269
find.byType (CustomScrollView ),
254
270
matchesGoldenFile ('overscroll_stretch.horizontal.end.png' ),
@@ -263,8 +279,16 @@ void main() {
263
279
expect (box3.localToGlobal (Offset .zero).dx, lessThan (500.0 ));
264
280
await expectLater (
265
281
find.byType (CustomScrollView ),
266
- matchesGoldenFile ('overscroll_stretch.horizontal.right .png' ),
282
+ matchesGoldenFile ('overscroll_stretch.horizontal.end.stretched .png' ),
267
283
);
284
+
285
+ await gesture.up ();
286
+ await tester.pumpAndSettle ();
287
+
288
+ // Stretch released back
289
+ expect (box1.localToGlobal (Offset .zero).dx, - 100.0 );
290
+ expect (box2.localToGlobal (Offset .zero).dx, 200.0 );
291
+ expect (box3.localToGlobal (Offset .zero).dx, 500.0 );
268
292
});
269
293
270
294
testWidgets ('Disallow stretching overscroll' , (WidgetTester tester) async {
0 commit comments