-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),
  )
)
Sign up to request clarification or add additional context in comments.

1 Comment

yes But not give my aspected results. @B. Cratty

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.