-1
DropdownButtonFormField(
  items: businessType
            .map((businessType) => DropdownMenuItem(
                  value: businessType,
                  child: SizedBox(
                    child: Text(
                      businessType['val'],
                      maxLines: 1,
                      style:
                          TextThemeFile.primary14MediumPoppins(context, 25),
                      softWrap: true,
                      overflow: TextOverflow.ellipsis,
                    ),
                  ),
                ))
            .toList(),
  onChanged: onChanged,
  value: selected,
    hint:hint,
  icon: suffixIcon,
  elevation: 0,
  decoration: InputDecoration(),
)

i want give a margin from the left & right side And menu item show below the dropdown menu as user point of view is not good.In this image dropdownmenu item show at that time dropdown is hide and menu item width is full width

In this image dropdownmenu item show at that time dropdown is hide and menu item width is full width

1 Answer 1

0

Have you tried adding the following to your DropDownButtonField()

isExpanded: true,
decoration: InputDecoration(
    contentPadding: EdgeInsets.symmetric(horizontal: 16),
  ),

So now your code should look like the following:

DropdownButtonFormField(
  items: businessType
            .map((businessType) => DropdownMenuItem(
                  value: businessType,
                  child: SizedBox(
                    child: Text(
                      businessType['val'],
                      maxLines: 1,
                      style:
                          TextThemeFile.primary14MediumPoppins(context, 25),
                      softWrap: true,
                      overflow: TextOverflow.ellipsis,
                    ),
                  ),
                ))
            .toList(),
  onChanged: onChanged,
  value: selected,
    hint:hint,
  icon: suffixIcon,
  elevation: 0,
  isExpanded: true,
  decoration: InputDecoration(
    contentPadding: EdgeInsets.symmetric(horizontal: 16),
  )
)
1
  • yes But not give my aspected results. @B. Cratty Commented Mar 5 at 6:01

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.