Description
Unless I'm missing something, I don't believe it's possible to achieve scrolling on both a ListView
(or SingleChildScrollView
) and a PageView
when the ListView
is within the PageView
and they both scroll in the same direction.
Consider the following simple example app with a vertical scrolling ListView
within a vertical PageView
:
void main() => runApp(App());
class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(),
body: PageView(
scrollDirection: Axis.vertical,
children: <Widget>[
ListView.builder(
itemCount: 20,
itemBuilder: (BuildContext context, int index) => ListTile(title: Text('Item $index'))
),
Text('Page 2')
],
)
)
);
}
}
There is no way to get the PageView
to scroll pages. I think expected behavior should be that when the ListView
is scrolled to the bottom, the PageView
should then handle the gesture. If I remember correctly, I believe it works like this with Android's RecyclerView
and ViewPager
.
I've played around with ScrollPhysics
, ScrollBehavior
, and NotificationListener
such as listening for OverscrollNotification
and then disabling scrolling for ListView
, but I could not find a solution that worked well.