Reputation: 157
I have one page in my flutter app that is basically a big list with multiple nested lists. No matter what type of widgets I use, the screen won't scroll properly. It does the scroll where it bounces to the top and doesn't let the user scroll all the way down. How can I get this to be scrollable?
Here is the code from the main page:
body: CustomScrollView(
physics: new AlwaysScrollableScrollPhysics(),
slivers: <Widget>[
SliverList(
delegate: SliverChildListDelegate([
Container(
margin: EdgeInsets.all(8),
child:
Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
new AlertItems(ptid: ptid),
])),
Container(
child:
Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
new OpenAppts(ptid: ptid),
])),
Container(
child:
Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
new OpenLabs(ptid: ptid),
])),
])),
],
),
And then the included AlertItems (as an example) looks like this:
return ListView.builder(
padding: const EdgeInsets.all(15.0),
shrinkWrap: true,
itemCount: snapshot.data.total,
itemBuilder: (context, index) {
newDate = DateTime.parse(
snapshot.data.entry[index].resource.date);
if (index == 0) {
return new Column(
children: <Widget>[
ListTile(
leading: Icon(
Icons.announcement,
color: Colors.orange[400],
),
title: Text(
snapshot.data.total.toString() +
' Open Items ',
style: TextStyle(fontSize: 20)),
),
Divider(height: 5.0),
ListTile(
title: Text(
formatDate(newDate, [m, '/', d, '/', yyyy])),
subtitle: Text(snapshot.data.entry[index].resource
.messageSubject ??
'No Subject'),
leading: Image(
image: AssetImage('images/messaging.png'),
height: 30,
),
contentPadding: EdgeInsets.only(left: 50.0),
),
],
);
}
Upvotes: 1
Views: 2102
Reputation: 1670
Setting physics: ScrollPhysics()
for both the ListView
and the CustomScrollView
should work.
Upvotes: 2
Reputation: 1588
use NestedScrollView
rather than CustomScrollView
you can get full expanation and example code here NestedScrollView Flutter Doc
Upvotes: 0