【发布时间】:2018-09-01 16:54:40
【问题描述】:
我希望我的卡片按钮像 Reddit 应用程序一样组合在一起。怎么能这样做?
在主行之外有一个 Container 并且 Container' 的填充高度为 15.0 。 Row 的小部件如何响应地适应 15.0 的高度。
这是我的代码;
@override
Widget build(BuildContext context) {
return new SafeArea(
top: false,
bottom: false,
child: new Card(
child: new Column(
children: <Widget>[
new Container(
padding: EdgeInsets.fromLTRB(5.0, 15.0, 5.0, 3.0),
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
new Container(
color: Colors.blueGrey,
child: new Row(
children: <Widget>[
new Icon(Icons.arrow_drop_up),
new Text('Vote'),
new Icon(Icons.arrow_drop_down),
],
),
),
new Container(
color: Colors.blueGrey,
child: new Row(
children: <Widget>[
new Icon(Icons.mode_comment),
new Text('Comment'),
],
),
),
new Container(
color: Colors.blueGrey,
child: new Row(
children: <Widget>[
new Icon(Icons.share),
new Text('Share'),
],
),
),
],
),
)
],
),
),
);
}
【问题讨论】:
-
如果您不想在两者之间使用空格,请不要使用
mainAxisAlignment: MainAxisAlignment.spaceBetween,。也许你想要拉伸。