@@ -126,11 +126,13 @@ class ExampleVerticalDouble extends StatelessWidget {
126
126
required this .title,
127
127
// this.reverse = false,
128
128
required this .headerPlacement,
129
+ required this .topSliverGrowsUpward,
129
130
});
130
131
131
132
final String title;
132
133
// final bool reverse;
133
134
final HeaderPlacement headerPlacement;
135
+ final bool topSliverGrowsUpward;
134
136
135
137
@override
136
138
Widget build (BuildContext context) {
@@ -144,14 +146,9 @@ class ExampleVerticalDouble extends StatelessWidget {
144
146
HeaderPlacement .scrollingEnd => true ,
145
147
};
146
148
147
- // Choose the "center" sliver so that the sliver which might need to paint
148
- // a header overflowing the other header is the sliver that paints last.
149
- final centerKey = headerAtBottom ?
149
+ final centerKey = topSliverGrowsUpward ?
150
150
const ValueKey ('bottom' ) : const ValueKey ('top' );
151
151
152
- // This is a side effect of our choice of centerKey.
153
- final topSliverGrowsUpward = headerAtBottom;
154
-
155
152
return Scaffold (
156
153
appBar: AppBar (title: Text (title)),
157
154
body: CustomScrollView (
@@ -345,11 +342,19 @@ class MainPage extends StatelessWidget {
345
342
title: 'Double slivers, headers at top' ,
346
343
page: ExampleVerticalDouble (
347
344
title: 'Double slivers, headers at top' ,
345
+ topSliverGrowsUpward: false ,
346
+ headerPlacement: HeaderPlacement .scrollingStart)),
347
+ _buildButton (context,
348
+ title: 'Split slivers, headers at top' ,
349
+ page: ExampleVerticalDouble (
350
+ title: 'Split slivers, headers at top' ,
351
+ topSliverGrowsUpward: true ,
348
352
headerPlacement: HeaderPlacement .scrollingStart)),
349
353
_buildButton (context,
350
- title: 'Double slivers, headers at bottom' ,
354
+ title: 'Split slivers, headers at bottom' ,
351
355
page: ExampleVerticalDouble (
352
- title: 'Double slivers, headers at bottom' ,
356
+ title: 'Split slivers, headers at bottom' ,
357
+ topSliverGrowsUpward: true ,
353
358
headerPlacement: HeaderPlacement .scrollingEnd)),
354
359
];
355
360
return Scaffold (
0 commit comments