我如何保留一个RaisedButton
从扩大到填补Expanded
包含它?我想创建三列,其宽度与可用空间成比例,但我希望每列中的子项为其自然大小,而不消耗其父项的整个宽度Expanded
.
Widget _controls(BuildContext cx) {
return Row(
children: [
Expanded(
flex: 1,
child: player.isOnFirstItem
? Container()
: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () => control.gotoPreviousItem(),
),
),
Expanded(
flex: 4,
child: player.isComplete()
? Text(player.currentItem.status) // I'll be adding more here
: RaisedButton(
child: Text(player.currentItem.actionText),
onPressed: () => player.currentItem.action(),
),
),
Expanded(
flex: 1,
child: player.isOnLastItem
? Container()
: IconButton(
icon: Icon(Icons.arrow_forward),
onPressed: () => player.gotoNextItem(),
),
),
],
);
The RaisedButton
当我进一步将其嵌套在 a 中时,也会填充弹性空间Container
。我不知道哪些属性可能会阻止这种情况。
在四处寻找答案时,似乎每个人都在试图实现相反的目标。