@@ -2012,17 +2012,17 @@ void main() {
20122012 ) async {
20132013 final semantics = SemanticsTester (tester); // enables semantics tree generation
20142014
2015- const kItemHeight = 100.0 ;
2016- const kExpandedAppBarHeight = 56.0 ;
2015+ const itemHeight = 100.0 ;
2016+ const expandedAppBarHeight = 56.0 ;
20172017
20182018 final containers = List <Widget >.generate (
20192019 80 ,
20202020 (int i) => MergeSemantics (
2021- child: SizedBox (height: kItemHeight , child: Text ('container $i ' )),
2021+ child: SizedBox (height: itemHeight , child: Text ('container $i ' )),
20222022 ),
20232023 );
20242024
2025- final scrollController = ScrollController (initialScrollOffset: kItemHeight / 2 );
2025+ final scrollController = ScrollController (initialScrollOffset: itemHeight / 2 );
20262026 addTearDown (scrollController.dispose);
20272027
20282028 await tester.pumpWidget (
@@ -2044,7 +2044,7 @@ void main() {
20442044 slivers: < Widget > [
20452045 const SliverAppBar (
20462046 pinned: true ,
2047- expandedHeight: kExpandedAppBarHeight ,
2047+ expandedHeight: expandedAppBarHeight ,
20482048 flexibleSpace: FlexibleSpaceBar (title: Text ('App Bar' )),
20492049 ),
20502050 SliverList .list (children: containers),
@@ -2057,7 +2057,7 @@ void main() {
20572057 ),
20582058 );
20592059
2060- expect (scrollController.offset, kItemHeight / 2 );
2060+ expect (scrollController.offset, itemHeight / 2 );
20612061
20622062 final int firstContainerId = tester
20632063 .renderObject (find.byWidget (containers.first))
@@ -2067,9 +2067,8 @@ void main() {
20672067 firstContainerId,
20682068 SemanticsAction .showOnScreen,
20692069 );
2070- await tester.pump ();
2071- await tester.pump (const Duration (seconds: 5 ));
2072- expect (tester.getTopLeft (find.byWidget (containers.first)).dy, kExpandedAppBarHeight);
2070+ await tester.pumpAndSettle ();
2071+ expect (tester.getTopLeft (find.byWidget (containers.first)).dy, expandedAppBarHeight);
20732072
20742073 semantics.dispose ();
20752074 });
@@ -2079,20 +2078,20 @@ void main() {
20792078 ) async {
20802079 final semantics = SemanticsTester (tester); // enables semantics tree generation
20812080
2082- const kItemHeight = 72.0 ;
2083- const kInitialScrollOffset = 250.0 ;
2084- const kExpandedAppBarHeight = 256.0 ;
2081+ const itemHeight = 72.0 ;
2082+ const initialScrollOffset = 250.0 ;
2083+ const expandedAppBarHeight = 256.0 ;
20852084
20862085 final children = < Widget > [];
20872086 final slivers = List <Widget >.generate (30 , (int i) {
20882087 final Widget child = MergeSemantics (
2089- child: SizedBox (height: kItemHeight , child: Text ('Item $i ' )),
2088+ child: SizedBox (height: itemHeight , child: Text ('Item $i ' )),
20902089 );
20912090 children.add (child);
20922091 return SliverToBoxAdapter (child: child);
20932092 });
20942093
2095- final scrollController = ScrollController (initialScrollOffset: kInitialScrollOffset );
2094+ final scrollController = ScrollController (initialScrollOffset: initialScrollOffset );
20962095 addTearDown (scrollController.dispose);
20972096
20982097 await tester.pumpWidget (
@@ -2114,7 +2113,7 @@ void main() {
21142113 slivers: < Widget > [
21152114 const SliverAppBar (
21162115 pinned: true ,
2117- expandedHeight: kExpandedAppBarHeight ,
2116+ expandedHeight: expandedAppBarHeight ,
21182117 flexibleSpace: FlexibleSpaceBar (title: Text ('App Bar' )),
21192118 ),
21202119 ...slivers,
@@ -2127,12 +2126,11 @@ void main() {
21272126 ),
21282127 );
21292128
2130- expect (scrollController.offset, kInitialScrollOffset );
2129+ expect (scrollController.offset, initialScrollOffset );
21312130
21322131 final int id0 = tester.renderObject (find.byWidget (children[0 ])).debugSemantics! .id;
21332132 tester.binding.pipelineOwner.semanticsOwner! .performAction (id0, SemanticsAction .showOnScreen);
2134- await tester.pump ();
2135- await tester.pump (const Duration (seconds: 5 ));
2133+ await tester.pumpAndSettle ();
21362134 expect (tester.getTopLeft (find.byWidget (children[0 ])).dy, kToolbarHeight);
21372135
21382136 semantics.dispose ();
0 commit comments