下拉按钮颤动
我创建了一个下拉按钮,在我选择某些内容后,该区域是灰色的。有可能把它拿走吗? 我不知道是否有房产可以做到这一点,但目前还找不到。
代码如下所示:
Container(
child: const Text('Multiplechoice?',
style: TextStyle(fontSize: 16)),
alignment: Alignment.center,
padding: const EdgeInsets.fromLTRB(0, 0, 10.0, 0),
margin: const EdgeInsets.fromLTRB(0, 0, 0, 15.0)),
Container(
width: 300,
padding: const EdgeInsets.symmetric(
horizontal: 8, vertical: 2),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
border: Border.all(color: Colors.black, width: 2),
),
child: DropdownButtonHideUnderline(
child: DropdownButton<DropdownOption>(
value: service.getSeventhOption,
isExpanded: true,
hint: const Text('Please choose'),
style: Constants.questionStyle,
iconSize: 20,
icon: const Icon(Icons.arrow_drop_down,
color: Colors.black),
onChanged: (DropdownOption? newValue) {
service.setSeventhOption = newValue!;
},
items: service.seventhDropdown
.map((DropdownOption option) {
return DropdownMenuItem<DropdownOption>(
value: option,
child: Text(option.text!),
);
}).toList(),
)),
),,
I created a dropdownbutton, after i chose something the area is grey. Is it possible to get it away?
I don´t know if theres an property to do it, but can´t find one yet.
The code looks like this:
Container(
child: const Text('Multiplechoice?',
style: TextStyle(fontSize: 16)),
alignment: Alignment.center,
padding: const EdgeInsets.fromLTRB(0, 0, 10.0, 0),
margin: const EdgeInsets.fromLTRB(0, 0, 0, 15.0)),
Container(
width: 300,
padding: const EdgeInsets.symmetric(
horizontal: 8, vertical: 2),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
border: Border.all(color: Colors.black, width: 2),
),
child: DropdownButtonHideUnderline(
child: DropdownButton<DropdownOption>(
value: service.getSeventhOption,
isExpanded: true,
hint: const Text('Please choose'),
style: Constants.questionStyle,
iconSize: 20,
icon: const Icon(Icons.arrow_drop_down,
color: Colors.black),
onChanged: (DropdownOption? newValue) {
service.setSeventhOption = newValue!;
},
items: service.seventhDropdown
.map((DropdownOption option) {
return DropdownMenuItem<DropdownOption>(
value: option,
child: Text(option.text!),
);
}).toList(),
)),
),,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
灰色区域表示您的
DropdownButton
当前处于焦点状态。在DropdownButton
中选择一个值
后,焦点仍保留在该值上。这就是它呈灰色的原因。如果您将焦点放在其他物体上,例如按钮或屏幕上,它们的灰色将会消失,因为它不再处于焦点上。如果想改变灰色区域的颜色,可以设置 focusColor< /a>.
The grey area indicates that your
DropdownButton
is currently focused. After selecting avalue
in yourDropdownButton
, the focus remains on it. This is the reason why it is grey. If you focus something else e.g. a button or on the screen, they grey color will disappear, since it isn't on focus anymore.If you want to change the color of the grey area, you can set the focusColor.