Unverified Commit 2e8faec0 authored by Ritvij Kumar Sharma's avatar Ritvij Kumar Sharma Committed by GitHub

Fixed issue for SliverAppBar collapsedHeight (#72300)

parent 849784e2
......@@ -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(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment