Minimum reproducible code:
final _controller = ScrollController();
@override
Widget build() {
return NestedScrollView(
headerSliverBuilder: (_, __) => [SliverAppBar(expandedHeight: 300)],
body: ListView.builder(
controller: _controller, // Removing this solves the issue.
itemCount: 100,
itemBuilder: (_, i) => Text('$i'),
),
);
}
If I scroll my ListView, the SliverAppBar doesn't scroll but if I remove the controller property then it does scroll.
So, how can I use the controller and make the SliverAppBar to scroll with the ListView (i.e. the standard behavior)?
Note: I don't want to use the CustomScrollView as my tree hierarchy won't let me make use of it that well.