Dart 如何在颤振中移动边界
我正在使用Flitter中的ListView创建记分板。我想用边界把不同的内容分开。但是,这会给我当前的布局带来问题 带有边框的框装饰如下所示:Dart 如何在颤振中移动边界,dart,flutter,Dart,Flutter,我正在使用Flitter中的ListView创建记分板。我想用边界把不同的内容分开。但是,这会给我当前的布局带来问题 带有边框的框装饰如下所示: return SizedBox( key: ValueKey(record.name), width: double.infinity, height: 80, child: Container( decoration: BoxDecoration( color: Colors.white, border
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,
),),
这里可以看到布局图:
问题在于,边框不是在不同的ListTile之间,而是在我试图显示的图片后面。尝试
ListView。如下图所示分隔开来:
ListView.separated(
itemCount: list.length,
itemBuilder: (BuildContext context, int index) {
return _buildListItem(context, snapshot[index]);
},
separatorBuilder: (BuildContext context, int index) {
return Divider(
height: 24.0,
color: Colors.black26,
);
},
)
因此,不要每次都添加边框,而是使用Divider()
分隔窗口小部件。这很有意义,我以前一直在使用它。然而,在我的代码中,我将在哪里实现这一点?我通过以下方式构建listview: