Search code examples
flutterdartflutter-sliverappbar

Flutter: SliverAppBar disable scrolling


I have SliverAppBar in my app with expandedHeight: 200,. Below it i have ListView that display content dynamically and can have different length. If ListView has 7 or more item its works perfecly, but if its below 7 items SliverAppBar still scrolls and has a lot of black space(screenshot). How can i disable SliverAppBar scroll property? I tried to use physics: NeverScrollableScrollPhysics(), in ListView itself, it didn't help.

enter image description here


Solution

  • Assuming you have a the SliverAppBar in a CustomScrollView or similar, you'll need to set the physics to NeverScrollableScrollPhysics() there as well.