我在Flutter中使用ListView创建记分板。我想通过边界分开不同的竞争者。但是,这给我当前的布局带来了问题。
带有边框的BoxDecoration外观如下:
return SizedBox(
key: ValueKey(record.name),
width: double.infinity,
height: 80,
child: Container(
decoration: BoxDecoration(
color: Colors.white,
border: Border(
bottom: BorderSide(width: 1.0, color: Color(0xFFFF000000)),
),
),
child: ListTile(
leading: new CircleAvatar(
radius: 35.0,
backgroundImage: NetworkImage("https://i.imgur.com/XvoqJ6C.png"),
backgroundColor: Colors.transparent,
),
title: Text(record.name + ": " + record.score.toString(), style:
new TextStyle(
fontSize: 20,
),),
在这里可以看到布局图:
这个问题,可以看出,边界不在不同的列表对象之间,而是在我要显示的图片后面。
答案 0 :(得分:1)
像这样尝试ratio
:
size
因此,不要每次都添加边框,而是使用ListView.separated