skip to Main Content

How to change the border color of DropdownMenu? I want to change the border color of DropdownMenu.

2

Answers


  1. Chosen as BEST ANSWER

    I can change border color by adding inputDecorationTheme

    DropdownMenu(
      dropdownMenuEntries: [],
        inputDecorationTheme: InputDecorationTheme(
          enabledBorder: OutlineInputBorder(
            borderSide: BorderSide(
              color: Colors.red,
          ),
        ),
      ),
    ),
    

  2. Change the border color using the code below.

    InputDecorator(
          decoration: const InputDecoration(
            focusedBorder: OutlineInputBorder(
                borderSide: BorderSide(
              color: Colors.red, // Set your desired border color
            )),
            enabledBorder: OutlineInputBorder(
                borderSide: BorderSide(
              color: Colors.red, // Set your desired border color
            )),
          ),
          child: DropdownButtonHideUnderline(
            child: DropdownButton<String>(
              value: selectedValue,
              onChanged: (String? newValue) {
                setState(() {
                  selectedValue = newValue;
                });
              },
              items: [
                DropdownMenuItem<String>(
                  value: 'Option 1',
                  child: Text('Option 1'),
                ),
                DropdownMenuItem<String>(
                  value: 'Option 2',
                  child: Text('Option 2'),
                ),
                DropdownMenuItem<String>(
                  value: 'Option 3',
                  child: Text('Option 3'),
                ),
              ],
            ),
          ),
        )
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search