Skip to content

Commit 0bbb43e

Browse files
committed
sticky_header test: Record taps on _Item widgets too
This will be useful in a test we'll add for an upcoming change.
1 parent f66ffac commit 0bbb43e

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

test/widgets/sticky_header_test.dart

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,8 @@ Future<void> _checkSequence(
309309
..every((it) => it.isA<_Header>());
310310
await tester.tapAt(headerInset(extent - 1));
311311
await tester.tapAt(headerInset(extent - (expectedHeaderInsetExtent - 1)));
312-
check(_TapLogged.takeTapLog()).isEmpty();
312+
check(_TapLogged.takeTapLog())..length.equals(2)
313+
..every((it) => it.isA<_Item>());
313314
}
314315

315316
Future<void> jumpAndCheck(double position) async {
@@ -388,7 +389,7 @@ class _Header extends StatelessWidget implements _TapLogged {
388389
}
389390
}
390391

391-
class _Item extends StatelessWidget {
392+
class _Item extends StatelessWidget implements _TapLogged {
392393
const _Item(this.index, {required this.height});
393394

394395
final int index;
@@ -399,10 +400,17 @@ class _Item extends StatelessWidget {
399400
return SizedBox(
400401
height: height,
401402
width: height,
402-
child: Text("Item $index"));
403+
child: GestureDetector(
404+
onTap: () => _TapLogged._tapLog.add(this),
405+
child: Text("Item $index")));
403406
}
404-
}
405407

408+
@override
409+
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
410+
super.debugFillProperties(properties);
411+
properties.add(IntProperty('index', index));
412+
}
413+
}
406414

407415
/// Sets [DeviceGestureSettings.touchSlop] for the child subtree
408416
/// to the given value, by inserting a [MediaQuery].

0 commit comments

Comments
 (0)