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
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
Share Improve this question edited Mar 4 at 13:03 tyg 16.7k4 gold badges39 silver badges49 bronze badges asked Mar 4 at 12:30 Naimish PatelNaimish Patel 8911 bronze badges1 Answer
Reset to default 0Have 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),
)
)