flutter - flutter:将 DropDownButton 中的图标移动到灵活区域的左侧
问题描述
我想将以下 DropDownButton 中的排序图标移动到左侧,使其不会悬停在中间。
所以我可以通过添加一个带有 Text 'sort' 的提示来解决这个问题,但这并不是我想要的。
还有人知道如何使下拉菜单比包装它的扩展/灵活更大吗?
Widget playerHeaderRow(header) => Container(
height: 35,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Flexible(
flex: 1,
child: Container(
height: 35.0,
width: 50.0,
child: DropdownButton<String>(
isExpanded: true,
underline: Container(
height: 0,
),
//value: dropdownValue, //looks too messy to display sorting value
style:
const TextStyle(color: Colors.deepPurple, fontSize: 12),
icon: const Icon(Icons.sort),
items: <String>['Name', 'Price', 'Sentiment']
.map((String value) {
return new DropdownMenuItem<String>(
value: value,
child: new Text(value),
);
}).toList(),
onChanged: (String newValue) {
setState(() {
dropdownValue = newValue;
});
},
),
),
),
Expanded(
flex: 3,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(header[0],
textAlign: TextAlign.center, style: textStyle),
Text("team", style: textStyleThin),
],
),
),
Expanded(
flex: 2,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(header[1],
textAlign: TextAlign.center, style: textStyle),
Text("weekly change", style: textStyleThin),
],
),
),
Expanded(
flex: 2,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(header[2],
textAlign: TextAlign.center, style: textStyle),
Text("3hrs change", style: textStyleThin),
],
),
),
],
),
);