gpt4 book ai didi

list - flutter - 在 ListView 生成器中滚动 ListView

转载 作者:IT王子 更新时间:2023-10-29 07:07:59 27 4
gpt4 key购买 nike

我有一个“过滤器”,下面是一个足球比赛列表。我用一个ListView包裹'Filter and 'listview builder'(这样blablabla下的重载写法就解决了)。但是当你正常滚动时会有一些奇怪的东西。滚动到不起作用的列表。只有“发光效果”,但我从上面的“滤镜菜单”滚动,滚动有效。如何让滚动条正常运行?

see image

我的代码片段:

Widget _buildListView(FixtureModel model, BuildContext context) {
return Container(
child: model.getFixturesCount() == 0
? Center(child: Text('No fixtures found'))
: ListView(
shrinkWrap: true,
children: <Widget>[
Column(
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
padding: EdgeInsets.only(left: 10.0),
child: InkWell(
onTap: () => _onTap(context),
child: Container(
margin:
EdgeInsets.only(top: 5.0, bottom: 5.0),
child: Row(
children: <Widget>[
Container(
padding: EdgeInsets.only(left: 5.0),
child:
Icon(FontAwesomeIcons.github)),
Container(
padding: EdgeInsets.only(left: 15.0),
child: Text(
'Liga Premier Inggris',
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.w500),
),
),
Container(
padding: EdgeInsets.only(
left: 5.0, top: 2.0),
child: Icon(Icons.arrow_drop_down,
size: 17.0))
],
)),
)),
Container(
padding: EdgeInsets.only(top: 3.0),
child: Text(
'4',
style:
TextStyle(fontSize: 13.0, color: Colors.grey),
),
),
IconButton(
iconSize: 20.0,
icon: Icon(
FontAwesomeIcons.calendarAlt,
color: Colors.blue,
),
onPressed: () {})
],
),
Divider(
height: 0.0,
),
Container(
padding: EdgeInsets.only(top: 2.0),
child: ListView.builder(
shrinkWrap: true,
itemCount: model.fixtureList == null
? 0
: model.getFixturesCount(),
itemBuilder: (context, int i) {
var fixture = model.fixtureList[i];

return FixtureListItem(fixture: fixture);
},
))
],
)
],
));
}

最佳答案

在你的 ListView 添加:

shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),

要从 ListView 中移除过滤器:移除物理:NeverScrollableScrollPhysics(),然后在 ListView 中

body: Column(
children: <Widget>[
Filter(),
Expanded(
child: ListView()
),
]
)

关于list - flutter - 在 ListView 生成器中滚动 ListView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53147429/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com