簡體   English   中英

在 flutter 中點擊 DropdownButton 時如何更改啟動顏色?

[英]How to Change the splash color when tapping DropdownButton In flutter?

在 flutter 的DropdownButton小部件中,我想在點擊時更改啟動顏色。 雖然我改變了DropdownButtonfocusColor但沒有任何改變......如何做到這一點???

Container(
              height: 20,
              padding: EdgeInsets.only(
                right: 10,
                left: 10,
              ),
              decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(38),
                  border: Border.all(
                    color: Color(0xFFEAD6EE),
                  )),
              child: DropdownButton(
                focusColor: Color(0xFFC88FFF),
                style: TextStyle(
                  fontSize: 16,
                  color: fontColor.withOpacity(0.5),
                  fontWeight: FontWeight.normal,
                ),
                isExpanded: true,
                hint: Text('$editedCountry'),
                items: dropdownMenuItemByCategory('Country'),
                onChanged: (editedIndValue) {
                  _onCountrySelected(editedIndValue);
                },
                value: editedCountryID,
                underline: SizedBox(),
              ),
            ),

在此處輸入圖像描述

Theme包裝你的DropdownButton

Theme(
    data: ThemeData(
      splashColor: Colors.red, //change based your need
    ),
    child: DropdownButton(

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM