La Pyae
La Pyae

Reputation: 509

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

In DropdownButton widget of the flutter, I want to change the splash color when tapping. Although I change the focusColor of the DropdownButton but nothing changes... How to do this???

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(),
              ),
            ),

enter image description here

Upvotes: 0

Views: 303

Answers (1)

Md. Yeasin Sheikh
Md. Yeasin Sheikh

Reputation: 63569

Wrap your DropdownButton with Theme

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

Upvotes: 1

Related Questions