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),
),
],
);
}
设置physics: ScrollPhysics()
ListView
和CustomScrollView
physics: ScrollPhysics()
应该可以工作。
使用NestedScrollView
而不是CustomScrollView
你可以在这里得到完整的扩展和示例代码NestedScrollView Flutter Doc
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.