![](/img/trans.png)
[英]How can I get the id of a selected item in a list using the the dropdownSearch widget in flutter?
[英]How can I change the label color of a Dropdownsearch widget?
我有一個 Dropdownsearch 小部件,默認 label 顏色為黑色,但我想將其更改為灰色。 我怎樣才能做到這一點? 這是我的 Dropdownsearch 小部件。 問題是 Dropdownsearch 沒有大多數小部件都有的名為 labelStyle 的屬性。
Container(
child: Theme(
data: ThemeData(
textTheme: TextTheme(
subtitle1: TextStyle(
color: Colors.grey,
fontWeight: FontWeight.bold,
fontSize: height * .024),
),
),
child: DropdownSearch<String>(
label: "Primary Industry",
mode: Mode.BOTTOM_SHEET,
showSearchBox: true,
maxHeight: height * .5,
dropdownSearchDecoration: new InputDecoration(
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white),
),
prefixIcon: const Icon(
Icons.corporate_fare,
color: Colors.white,
),
),
showAsSuffixIcons: true,
showClearButton: false,
dropdownButtonBuilder: (_) => Padding(
padding: const EdgeInsets.all(8.0),
child: Icon(
Icons.arrow_drop_down,
size: height * .04,
color: Colors.grey,
),
),
showSelectedItem: true,
items: _industry,
onChanged: (String newValue) {
setState(() {
dropDownValue = newValue;
});
},
selectedItem: dropDownValue,
),
),
),
我沒有帶我的筆記本電腦,所以我不能自己嘗試,但在這里尋找合適的屬性......也許popupBackgroundColor
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.