Flutter handles that automatically when you use Scaffold and CupertinoPageScaffold.
So... end of the tip?
No. There's a catch:
If you have a customScrollController, you must wrap the Scaffold (or CupertinoPageScaffold) with a PrimaryScrollController and provide that controller down the widget tree:
PrimaryScrollController( controller: _scrollController, // pass here child: Scaffold( appBar: const MyAppBar(), body: NestedScrollView( controller: _scrollController, // also pass to the scrollable headerSliverBuilder: (context, innerScrolled) { return [ ... ]; }, body: ... ), ),);
This is basically saying to the Scaffold: "Hey! Thanks for helping. Uhm, I uh, brought my own ScrollController this time, and providing it above you so you can use when you need too. Thanks for your understanding! ☺️"