我对 Flutter 和 Dart 还很陌生,我似乎找不到关于这个特定主题的任何提示。我想把 3RadioListTiles
in a Row
像这样:
Row(
children: [
Expanded(
child:RadioListTile<GoalSelection>(
title: Text(
'Net',
style: Theme.of(context).textTheme.body1,
),
value: GoalSelection.net,
groupValue: _goalSelection,
onChanged: (GoalSelection value) {
setState(() {
_goalSelection = value;
});
},
),
),
Expanded(
child: RadioListTile<GoalSelection>(
title: Text(
'Gross',
style: Theme.of(context).textTheme.body1,
),
value: GoalSelection.gross,
groupValue: _goalSelection,
onChanged: (GoalSelection value) {
setState(() {
_goalSelection = value;
});
},
),
),
Expanded(
child: RadioListTile<GoalSelection>(
title: Text(
'Salary',
style: Theme.of(context).textTheme.body1,
),
value: GoalSelection.salary,
groupValue: _goalSelection,
onChanged: (GoalSelection value) {
setState(() {
_goalSelection = value;
});
},
),
),
],
),
按钮布局很好,但标签似乎浪费了很多空间。我在下面放了目前的屏幕截图。我尝试过包裹Expanded
, the RadioListTile
,以及Text
in Padding
小部件(一次全部一个)手动将填充设置为 0,但它没有执行任何操作。我也曾尝试过改变Expanded
to Flexible
尽管我认为这不会改变任何事情。我现在很茫然。有什么办法可以让这个布局发挥作用吗?我有点假设我正在做的事情真的很愚蠢。