PageView scroll under SliverAppBar

Viewed 67

In material 3 the AppBar changes elevation and color when there is something scrolled under it.

It works fine using CustomScrollView with a SliverList or ListView scrolling under a SliverAppBar.

The issue is when I try to use PageView instead. It works fine using a SliverFillRemaining over the PageView but the appBar won’t notice when the page is scrolled.

I tried many ways, using NestedScrollView and CustomScrollView with no success.

The only way I could achieve that was using the PageView onPageChanged to check the page and calling back the setState of my homePage to change the color and elevation programmatically but at the cost of rebuilding almost the whole tree when it reaches or leaves the 1st page.

Any insights would be appreciated.

0 Answers
Related