![](/img/trans.png)
[英]How to position Widgets inside a Widget Stack that has Column Widgets Flutter
[英]How do I position widgets inside a card contained in a row?
目前,我正在尝试创建卡片模板以插入列表视图。 我希望带有图标按钮的列位于最右边。 我似乎找不到一种方法可以说包含图标按钮的列需要向右刷新。
new Expanded(
child: new ListView(
shrinkWrap: true,
padding: const EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0),
children: <Widget>[
new Card(
child: new Row(
children: <Widget>[
new Padding(
padding: const EdgeInsets.fromLTRB(0.0, 0.0, 10.0, 0.0),
),
new Image(
//image: new AssetImage("assets/ic_access_alarm_red_24dp.png"),
image: new AssetImage("assets/pastDue.png"),
height: 50.0,
width: 50.0,
),
new Padding(
padding: const EdgeInsets.fromLTRB(0.0, 0.0, 10.0, 0.0),
),
new Column(
children: <Widget>[
new Text("This is the title"),
new Text("This is the Description"),
new Text("This is the date"),
],
),
new Column(
children: <Widget>[
new IconButton(
icon: new Icon(Icons.note_add),
onPressed: () {
select("AddCalibration");
}
),
new IconButton(
icon: new Icon(Icons.edit),
onPressed: () {
select("EditInstrument");
}
)
],
)
],
)
),
const Text("I am"),
const Text("A ListView"),
],
)
)
谢谢你,vbandrade!
这肯定解决了我的问题。
new Expanded(
child: new ListView(
shrinkWrap: true,
padding: const EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0),
children: <Widget>[
new Card(
child: new ListTile(
leading: new Image(
image: new AssetImage("assets/pastDue.png"),
height: 50.0,
width: 50.0,
),
title: new Column(
children: <Widget>[
new Text("This is the title"),
new Text("This is the Description"),
new Text("This is the date"),
],
),
trailing: new Column(
children: <Widget>[
new IconButton(
icon: new Icon(Icons.note_add),
onPressed: () {
select("AddCalibration");
}),
new IconButton(
icon: new Icon(Icons.edit),
onPressed: () {
select("EditInstrument");
})
],
),
),
),
const Text("I am"),
const Text("A ListView"),
],
))
使用扩展小部件将图标向右推
new Expanded(child: new Container())
所以在您的示例中:new Column(
children: <Widget>[
new Text("This is the title"),
new Text("This is the Description"),
new Text("This is the date"),],
),
new Expanded(child: new Container()),
new Column(
children: <Widget>[
new IconButton(
icon: new Icon(Icons.note_add),
onPressed: () {}),
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.