在我選擇了灰色區域后,我創建了一個下拉按鈕。有可能把它弄走嗎?我不知道是否有房產可以做,但還沒有找到。

代碼如下所示:
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(),
)),
),,
uj5u.com熱心網友回復:
灰色區域表示您DropdownButton當前處于專注狀態。value在您的 中選擇一個后DropdownButton,焦點仍然在它上面。這就是為什么它是灰色的原因。如果您將焦點放在其他東西上,例如按鈕或螢屏上,它們的灰色將消失,因為它不再是焦點。
如果要改變灰色區域的顏色,可以設定focusColor。
DropdownButton<DropdownOption>(
focusColor: Colors.transparent,
...
),
uj5u.com熱心網友回復:
quoci 的回答和我一樣。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/442664.html
上一篇:徹底清除表格
下一篇:如何將這兩個按鈕放在左側?
