From 6cbc2d4f07eabe7a687d995775f26741d79697eb Mon Sep 17 00:00:00 2001 From: Ahmed Elsayed Date: Fri, 7 Mar 2025 19:57:17 +0200 Subject: [PATCH] Minor renaming --- packages/dropdown_button2/lib/src/dropdown_route.dart | 4 ++-- packages/dropdown_button2/lib/src/dropdown_style_data.dart | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/dropdown_button2/lib/src/dropdown_route.dart b/packages/dropdown_button2/lib/src/dropdown_route.dart index 38f574c..d699aca 100644 --- a/packages/dropdown_button2/lib/src/dropdown_route.dart +++ b/packages/dropdown_button2/lib/src/dropdown_route.dart @@ -360,7 +360,6 @@ class _DropdownMenuRouteLayout extends SingleChildLayoutDelegate { @override BoxConstraints getConstraintsForChild(BoxConstraints constraints) { - final double? itemWidth = route.dropdownStyle.width; double maxHeight = route.getMenuAvailableHeight(availableHeight, mediaQueryPadding); final double? preferredMaxHeight = route.dropdownStyle.maxHeight; @@ -369,8 +368,9 @@ class _DropdownMenuRouteLayout extends SingleChildLayoutDelegate { } // The width of a menu should be at most the view width. This ensures that // the menu does not extend past the left and right edges of the screen. + final double? menuWidth = route.dropdownStyle.width; final double width = - math.min(constraints.maxWidth, itemWidth ?? buttonRect.width); + math.min(constraints.maxWidth, menuWidth ?? buttonRect.width); return BoxConstraints( minWidth: width, maxWidth: width, diff --git a/packages/dropdown_button2/lib/src/dropdown_style_data.dart b/packages/dropdown_button2/lib/src/dropdown_style_data.dart index 9702c1e..1a2e770 100644 --- a/packages/dropdown_button2/lib/src/dropdown_style_data.dart +++ b/packages/dropdown_button2/lib/src/dropdown_style_data.dart @@ -172,6 +172,8 @@ class DropdownStyleData { final double? maxHeight; /// The width of the dropdown menu + /// + /// If it is not provided, the width of the menu is the width of the dropdown button. final double? width; /// The inner padding of the dropdown menu