【发布时间】:2018-09-30 14:37:51
【问题描述】:
我一直在开发一个玩具提醒应用程序,并希望实现一个下拉菜单供用户选择给定的时间间隔。
我已经加载了按钮,并且可以在弹出正确的菜单时单击它。问题是屏幕上按钮的外观。与父Widget同色,完全不显示选中项的文字。
如何使下拉按钮具有白色背景和黑色文本?
这是截图:
这是构建此视图的代码:
@override
Widget build(BuildContext context) {
return new Container(
child: new Row(
children: <Widget>[
new Expanded(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
_buildInformationRow(),
_buildReminderRow(),
],
)
)
],
)
);
}
Widget _buildInformationRow() {
return new Container(
padding: const EdgeInsets.all(10.0),
child: new Row(
children: <Widget>[
new Column(
children: <Widget>[
new Container(
padding: const EdgeInsets.all(10.0),
child: new Text(
"This app can remind you to do stuff\non a regular basis",
style: new TextStyle(
color: Colors.white,
fontSize: 18.0,
)
),
)
],
)
],
),
);
}
Widget _buildReminderRow() {
return new Container(
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
new Column(
children: <Widget>[
new Container(
child: new Text(
"Remind me",
style: new TextStyle(
color: Colors.white,
fontSize: 18.0,
)
),
)
],
),
new Column(
children: <Widget>[
new Container(
child: new DropdownButton<String>(
style: new TextStyle(
color: Colors.black,
fontSize: 18.0,
),
items: <String>["Never", "Daily", "Hourly", "Every 30 Minutes"].map((String value) {
return new DropdownMenuItem <String>(
value: value,
child: new Text(value)
);
}).toList(),
onChanged: null
)
)
],
)
],
),
);
}
【问题讨论】:
-
您是否将主题中的多个值设置为相同的颜色?
-
不,我的主题非常简单:我只是设置了亮度、原色和强调色。
标签: drop-down-menu colors flutter