Fixed issue for SliverAppBar collapsedHeight (#72300)
This commit is contained in:
committed by
GitHub
parent
849784e262
commit
2e8faec09a
@@ -1464,7 +1464,7 @@ class SliverAppBar extends StatefulWidget {
|
||||
assert(toolbarHeight != null),
|
||||
assert(floating || !snap, 'The "snap" argument only makes sense for floating app bars.'),
|
||||
assert(stretchTriggerOffset > 0.0),
|
||||
assert(collapsedHeight == null || collapsedHeight > toolbarHeight, 'The "collapsedHeight" argument has to be larger than [toolbarHeight].'),
|
||||
assert(collapsedHeight == null || collapsedHeight >= toolbarHeight, 'The "collapsedHeight" argument has to be larger than or equal to [toolbarHeight].'),
|
||||
super(key: key);
|
||||
|
||||
/// {@macro flutter.material.appbar.leading}
|
||||
|
||||
@@ -2198,6 +2198,25 @@ void main() {
|
||||
expect(appBarHeight(tester), collapsedHeight + initialTabBarHeight);
|
||||
});
|
||||
|
||||
testWidgets('SliverAppBar collapsedHeight', (WidgetTester tester) async {
|
||||
const double collapsedHeight = 56.0;
|
||||
|
||||
await tester.pumpWidget(buildSliverAppBarApp(
|
||||
floating: false,
|
||||
pinned: false,
|
||||
collapsedHeight: collapsedHeight
|
||||
));
|
||||
|
||||
final ScrollController controller = primaryScrollController(tester);
|
||||
final double initialTabBarHeight = tabBarHeight(tester);
|
||||
|
||||
// Scroll the not-pinned appbar out of view, to its collapsed height.
|
||||
controller.jumpTo(300.0);
|
||||
await tester.pump();
|
||||
expect(find.byType(SliverAppBar), findsNothing);
|
||||
expect(appBarHeight(tester), collapsedHeight + initialTabBarHeight);
|
||||
});
|
||||
|
||||
testWidgets('AppBar respects leadingWidth', (WidgetTester tester) async {
|
||||
const Key key = Key('leading');
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
|
||||
Reference in New Issue
Block a user