@@ -124,8 +124,8 @@ void main() {
124
124
125
125
// Starts out scrolled all the way to the bottom,
126
126
// even though it must have taken several rounds of layout to find that.
127
- check (controller.position.pixels )
128
- .equals (itemHeight * numItems * (numItems + 1 )/ 2 );
127
+ check (controller.position)
128
+ .pixels. equals (itemHeight * numItems * (numItems + 1 )/ 2 );
129
129
check (tester.getRect (find.text ('item ${numItems -1 }' , skipOffstage: false )))
130
130
.bottom.equals (600 );
131
131
});
@@ -198,30 +198,30 @@ void main() {
198
198
await prepare (tester, topHeight: 300 , bottomHeight: 600 );
199
199
await tester.drag (findBottom, Offset (0 , 300 ));
200
200
await tester.pump ();
201
- check (position.extentAfter) .equals (300 );
201
+ check (position) .extentAfter.equals (300 );
202
202
203
203
// Start scrolling to end, from just a short distance up.
204
204
position.scrollToEnd ();
205
205
await tester.pump ();
206
- check (position.extentAfter) .equals (300 );
207
- check (position.activity) .isA <ScrollToEndActivity >();
206
+ check (position) .extentAfter.equals (300 );
207
+ check (position) .activity.isA <ScrollToEndActivity >();
208
208
209
209
// The scrolling moves at a stately pace; …
210
210
await tester.pump (Duration (milliseconds: 100 ));
211
- check (position.extentAfter) .equals (200 );
211
+ check (position) .extentAfter.equals (200 );
212
212
213
213
await tester.pump (Duration (milliseconds: 100 ));
214
- check (position.extentAfter) .equals (100 );
214
+ check (position) .extentAfter.equals (100 );
215
215
216
216
// … then upon reaching the end, …
217
217
await tester.pump (Duration (milliseconds: 100 ));
218
- check (position.extentAfter) .equals (0 );
218
+ check (position) .extentAfter.equals (0 );
219
219
220
220
// … goes idle on the next frame, …
221
221
await tester.pump (Duration (milliseconds: 1 ));
222
- check (position.activity) .isA <IdleScrollActivity >();
222
+ check (position) .activity.isA <IdleScrollActivity >();
223
223
// … without moving any farther.
224
- check (position.extentAfter) .equals (0 );
224
+ check (position) .extentAfter.equals (0 );
225
225
});
226
226
227
227
testWidgets ('long -> bounded speed' , (tester) async {
@@ -231,12 +231,12 @@ void main() {
231
231
await prepare (tester, topHeight: distance + 1000 , bottomHeight: 300 );
232
232
await tester.drag (findBottom, Offset (0 , distance));
233
233
await tester.pump ();
234
- check (position.extentAfter) .equals (distance);
234
+ check (position) .extentAfter.equals (distance);
235
235
236
236
// Start scrolling to end.
237
237
position.scrollToEnd ();
238
238
await tester.pump ();
239
- check (position.activity) .isA <ScrollToEndActivity >();
239
+ check (position) .activity.isA <ScrollToEndActivity >();
240
240
241
241
// Let it scroll, plotting the trajectory.
242
242
final log = < double > [];
@@ -249,12 +249,12 @@ void main() {
249
249
(i) => distance - referenceSpeed * i));
250
250
251
251
// Having reached the end, …
252
- check (position.extentAfter) .equals (0 );
252
+ check (position) .extentAfter.equals (0 );
253
253
// … it goes idle on the next frame, …
254
254
await tester.pump (Duration (milliseconds: 1 ));
255
- check (position.activity) .isA <IdleScrollActivity >();
255
+ check (position) .activity.isA <IdleScrollActivity >();
256
256
// … without moving any farther.
257
- check (position.extentAfter) .equals (0 );
257
+ check (position) .extentAfter.equals (0 );
258
258
});
259
259
260
260
testWidgets ('starting from overscroll, just drift' , (tester) async {
@@ -266,33 +266,33 @@ void main() {
266
266
await tester.pump ();
267
267
final offset1 = position.pixels - position.maxScrollExtent;
268
268
check (offset1).isGreaterThan (100 / 2 );
269
- check (position.activity) .isA <BallisticScrollActivity >();
269
+ check (position) .activity.isA <BallisticScrollActivity >();
270
270
271
271
// Start drifting back into range.
272
272
await tester.pump (Duration (milliseconds: 10 ));
273
273
final offset2 = position.pixels - position.maxScrollExtent;
274
274
check (offset2)..isGreaterThan (0.0 )..isLessThan (offset1);
275
- check (position.activity) .isA <BallisticScrollActivity >()
275
+ check (position) .activity.isA <BallisticScrollActivity >()
276
276
.velocity.isLessThan (0 );
277
277
278
278
// Invoke `scrollToEnd`. The motion should stop…
279
279
position.scrollToEnd ();
280
280
await tester.pump ();
281
281
check (position.pixels - position.maxScrollExtent).equals (offset2);
282
- check (position.activity) .isA <BallisticScrollActivity >()
282
+ check (position) .activity.isA <BallisticScrollActivity >()
283
283
.velocity.equals (0 );
284
284
285
285
// … and resume drifting from there…
286
286
await tester.pump (Duration (milliseconds: 10 ));
287
287
final offset3 = position.pixels - position.maxScrollExtent;
288
288
check (offset3)..isGreaterThan (0.0 )..isLessThan (offset2);
289
- check (position.activity) .isA <BallisticScrollActivity >()
289
+ check (position) .activity.isA <BallisticScrollActivity >()
290
290
.velocity.isLessThan (0 );
291
291
292
292
// … to eventually return to being in range.
293
293
await tester.pump (Duration (seconds: 1 ));
294
294
check (position.pixels - position.maxScrollExtent).equals (0 );
295
- check (position.activity) .isA <IdleScrollActivity >();
295
+ check (position) .activity.isA <IdleScrollActivity >();
296
296
297
297
debugDefaultTargetPlatformOverride = null ;
298
298
});
@@ -305,17 +305,17 @@ void main() {
305
305
306
306
position.jumpTo (398 );
307
307
await tester.pump ();
308
- check (position.extentAfter) .equals (2 );
308
+ check (position) .extentAfter.equals (2 );
309
309
310
310
position.scrollToEnd ();
311
311
await tester.pump ();
312
- check (position.extentAfter) .equals (2 );
312
+ check (position) .extentAfter.equals (2 );
313
313
314
314
// Reach the end in just 150ms, not 300ms.
315
315
await tester.pump (Duration (milliseconds: 75 ));
316
- check (position.extentAfter) .equals (1 );
316
+ check (position) .extentAfter.equals (1 );
317
317
await tester.pump (Duration (milliseconds: 75 ));
318
- check (position.extentAfter) .equals (0 );
318
+ check (position) .extentAfter.equals (0 );
319
319
});
320
320
321
321
testWidgets ('on overscroll, stop' , (tester) async {
@@ -325,7 +325,7 @@ void main() {
325
325
// Scroll up…
326
326
position.jumpTo (400 );
327
327
await tester.pump ();
328
- check (position.extentAfter) .equals (600 );
328
+ check (position) .extentAfter.equals (600 );
329
329
330
330
// … then invoke `scrollToEnd`…
331
331
position.scrollToEnd ();
@@ -334,7 +334,7 @@ void main() {
334
334
// … but have the bottom sliver turn out to be shorter than it was.
335
335
await prepare (tester, topHeight: 400 , bottomHeight: 600 ,
336
336
reuseController: true );
337
- check (position.extentAfter) .equals (200 );
337
+ check (position) .extentAfter.equals (200 );
338
338
339
339
// Let the scrolling animation proceed until it hits the end.
340
340
int steps = 0 ;
@@ -348,10 +348,10 @@ void main() {
348
348
check (position.pixels - position.maxScrollExtent).equals (0 );
349
349
350
350
// … and the animation is done. Nothing further happens.
351
- check (position.activity) .isA <IdleScrollActivity >();
351
+ check (position) .activity.isA <IdleScrollActivity >();
352
352
await tester.pump (Duration (milliseconds: 11 ));
353
353
check (position.pixels - position.maxScrollExtent).equals (0 );
354
- check (position.activity) .isA <IdleScrollActivity >();
354
+ check (position) .activity.isA <IdleScrollActivity >();
355
355
356
356
debugDefaultTargetPlatformOverride = null ;
357
357
});
@@ -362,7 +362,7 @@ void main() {
362
362
// Scroll up…
363
363
position.jumpTo (0 );
364
364
await tester.pump ();
365
- check (position.extentAfter) .equals (3000 );
365
+ check (position) .extentAfter.equals (3000 );
366
366
367
367
// … then invoke `scrollToEnd`…
368
368
position.scrollToEnd ();
@@ -371,7 +371,7 @@ void main() {
371
371
// … but have the bottom sliver turn out to be longer than it was.
372
372
await prepare (tester, topHeight: 1000 , bottomHeight: 6000 ,
373
373
reuseController: true );
374
- check (position.extentAfter) .equals (6000 );
374
+ check (position) .extentAfter.equals (6000 );
375
375
376
376
// Let the scrolling animation go until it stops.
377
377
int steps = 0 ;
0 commit comments