File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
packages/dropdown_button2/lib/src Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -360,7 +360,6 @@ class _DropdownMenuRouteLayout<T> extends SingleChildLayoutDelegate {
360360
361361 @override
362362 BoxConstraints getConstraintsForChild (BoxConstraints constraints) {
363- final double ? itemWidth = route.dropdownStyle.width;
364363 double maxHeight =
365364 route.getMenuAvailableHeight (availableHeight, mediaQueryPadding);
366365 final double ? preferredMaxHeight = route.dropdownStyle.maxHeight;
@@ -369,8 +368,9 @@ class _DropdownMenuRouteLayout<T> extends SingleChildLayoutDelegate {
369368 }
370369 // The width of a menu should be at most the view width. This ensures that
371370 // the menu does not extend past the left and right edges of the screen.
371+ final double ? menuWidth = route.dropdownStyle.width;
372372 final double width =
373- math.min (constraints.maxWidth, itemWidth ?? buttonRect.width);
373+ math.min (constraints.maxWidth, menuWidth ?? buttonRect.width);
374374 return BoxConstraints (
375375 minWidth: width,
376376 maxWidth: width,
Original file line number Diff line number Diff line change @@ -172,6 +172,8 @@ class DropdownStyleData {
172172 final double ? maxHeight;
173173
174174 /// The width of the dropdown menu
175+ ///
176+ /// If it is not provided, the width of the menu is the width of the dropdown button.
175177 final double ? width;
176178
177179 /// The inner padding of the dropdown menu
You can’t perform that action at this time.
0 commit comments