Home > Enterprise >  how to add margin in dropdown item menu
how to add margin in dropdown item menu

Time:03-11

how to add margin in dropdown item menu? i want to add space in every menu item

here is my code

// Dropdown Box
        Container(
         .....
          child: DropdownButton(
            elevation: 1,
            isExpanded: true,
            hint: Text(
              '--Select One--',
              style: TextStyle(
                color: Color(0xffB2B2B2),
              ),
            ),
           
            items: dropdownOption.map((e) {
              return DropdownMenuItem(
                value: e['value'],
                child: Text(e['label']),
              );
            }).toList(),
            value: dropdownValue,
            onChanged: (value) {
              setState(() {
                dropdownValue = value;
              });

            },
          ),
        ),

enter image description here

if i put padding in text dropdown menu it looks like this

enter image description here

CodePudding user response:

By simply wrapping your text widget with padding widget.

CodePudding user response:

You can do that with DropdownButton2 by using itemPadding property. DropdownButton2 is based on Flutter's core DropdownButton with steady dropdown menu below the button and many other options you can customize to your needs.

  • Related