Unverified Commit 8cf15ee2 authored by Per Classon's avatar Per Classon Committed by GitHub

Rebuild SliverAppBar when forceElevated changes (#59162)

parent 319a61fd
...@@ -860,7 +860,8 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate { ...@@ -860,7 +860,8 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
|| pinned != oldDelegate.pinned || pinned != oldDelegate.pinned
|| floating != oldDelegate.floating || floating != oldDelegate.floating
|| snapConfiguration != oldDelegate.snapConfiguration || snapConfiguration != oldDelegate.snapConfiguration
|| stretchConfiguration != oldDelegate.stretchConfiguration; || stretchConfiguration != oldDelegate.stretchConfiguration
|| forceElevated != oldDelegate.forceElevated;
} }
@override @override
......
...@@ -891,6 +891,31 @@ void main() { ...@@ -891,6 +891,31 @@ void main() {
expect(tabBarHeight(tester), initialTabBarHeight); expect(tabBarHeight(tester), initialTabBarHeight);
}); });
testWidgets('SliverAppBar rebuilds when forceElevated changes', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/59158.
Widget buildSliverAppBar(bool forceElevated) {
return MaterialApp(
home: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
title: const Text('Title'),
forceElevated: forceElevated,
),
],
),
);
}
final Finder appBarFinder = find.byType(AppBar);
AppBar getAppBarWidget(Finder finder) => tester.widget<AppBar>(finder);
await tester.pumpWidget(buildSliverAppBar(false));
expect(getAppBarWidget(appBarFinder).elevation, 0.0);
await tester.pumpWidget(buildSliverAppBar(true));
expect(getAppBarWidget(appBarFinder).elevation, 4.0);
});
testWidgets('AppBar dimensions, with and without bottom, primary', (WidgetTester tester) async { testWidgets('AppBar dimensions, with and without bottom, primary', (WidgetTester tester) async {
const MediaQueryData topPadding100 = MediaQueryData(padding: EdgeInsets.only(top: 100.0)); const MediaQueryData topPadding100 = MediaQueryData(padding: EdgeInsets.only(top: 100.0));
......
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