Reputation: 1853
I'm trying to create a page which contains multiple sections and each section is generated using ListView.builder(). Here the page problem I'm facing is that , the page is not being scrolled unless the touch is not focused on the widget generated with ListView.
Widget _widget1(BuildContext context){
return ListView.builder(
....
.....
);
}
Widget _widget2(BuildContext context){
return ListView.builder(
....
.....
);
}
Widget _widget3(BuildContext context){
return ListView.builder(
....
.....
);
}
body: Container(
child: ListView(
scrollDirection: Axis.vertical,
physics: PageScrollPhysics(),
shrinkWrap: true,
children: <Widget>[
Container(
height: 140.0,
child: _offersBanner(context)
),
_widget1(context),
_widget2(context),
_widget3(context)
],
)
)
Upvotes: 2
Views: 3485
Reputation: 4027
try this, please add below code inside ListView.builder
shrinkWrap: true,
physics: ClampingScrollPhysics(),
Upvotes: 4
Reputation: 12934
Do you want four scrolling lists or just one combined list?
I guess you need the latter.
Widget _widget1(BuildContext context){
return Column(
....
.....
);
}
Widget _widget2(BuildContext context){
return Column(
....
.....
);
}
Widget _widget3(BuildContext context){
return Column(
....
.....
);
}
body: Container(
child: ListView(
scrollDirection: Axis.vertical,
physics: PageScrollPhysics(),
shrinkWrap: true,
children: <Widget>[
Container(
height: 140.0,
child: _offersBanner(context)
),
_widget1(context),
_widget2(context),
_widget3(context)
],
)
)
Upvotes: 3