diff --git a/packages/dropdown_button2/CHANGELOG.md b/packages/dropdown_button2/CHANGELOG.md index c2e789e..d96c1ea 100644 --- a/packages/dropdown_button2/CHANGELOG.md +++ b/packages/dropdown_button2/CHANGELOG.md @@ -14,6 +14,7 @@ - Update SDK constraints: ">=3.4.0 <4.0.0" - Fix DropdownButtonFormField clips text when large text scale is used [Flutter core]. - Fix DropdownButtonFormField padding when ButtonTheme.alignedDropdown is true [Flutter core]. +- Add barrierCoversButton to DropdownButtonFormField2. ## 3.0.0-beta.21 diff --git a/packages/dropdown_button2/lib/src/dropdown_button2.dart b/packages/dropdown_button2/lib/src/dropdown_button2.dart index cdc8313..01f40df 100644 --- a/packages/dropdown_button2/lib/src/dropdown_button2.dart +++ b/packages/dropdown_button2/lib/src/dropdown_button2.dart @@ -116,9 +116,9 @@ class DropdownButton2 extends StatefulWidget { this.customButton, this.openWithLongPress = false, this.barrierDismissible = true, + this.barrierCoversButton = true, this.barrierColor, this.barrierLabel, - this.barrierCoversButton = true, this.openDropdownListenable, // When adding new arguments, consider adding similar arguments to // DropdownButtonFormField. @@ -132,37 +132,37 @@ class DropdownButton2 extends StatefulWidget { const DropdownButton2._formField({ super.key, required this.items, - this.selectedItemBuilder, + required this.selectedItemBuilder, required this.valueListenable, required this.multiValueListenable, - this.hint, - this.disabledHint, + required this.hint, + required this.disabledHint, required this.onChanged, - this.onMenuStateChange, - this.style, - this.underline, - this.isDense = false, - this.isExpanded = false, - this.focusNode, - this.autofocus = false, - this.enableFeedback, - this.alignment = AlignmentDirectional.centerStart, - this.buttonStyleData, + required this.onMenuStateChange, + required this.style, + required this.isDense, + required this.isExpanded, + required this.focusNode, + required this.autofocus, + required this.enableFeedback, + required this.alignment, + required this.buttonStyleData, required this.iconStyleData, required this.dropdownStyleData, required this.menuItemStyleData, - this.dropdownSearchData, - this.dropdownSeparator, - this.customButton, - this.openWithLongPress = false, - this.barrierDismissible = true, - this.barrierColor, - this.barrierCoversButton = true, - this.barrierLabel, - this.openDropdownListenable, + required this.dropdownSearchData, + required this.dropdownSeparator, + required this.customButton, + required this.openWithLongPress, + required this.barrierDismissible, + required this.barrierCoversButton, + required this.barrierColor, + required this.barrierLabel, + required this.openDropdownListenable, required InputDecoration inputDecoration, required bool isEmpty, - }) : _inputDecoration = inputDecoration, + }) : underline = null, + _inputDecoration = inputDecoration, _isEmpty = isEmpty; /// The list of items the user can select. @@ -338,6 +338,11 @@ class DropdownButton2 extends StatefulWidget { /// Whether you can dismiss this route by tapping the modal barrier. final bool barrierDismissible; + /// Specifies whether the modal barrier should cover the dropdown button or not. + /// + /// Defaults to true. + final bool barrierCoversButton; + /// The color to use for the modal barrier. If this is null, the barrier will /// be transparent. final Color? barrierColor; @@ -348,11 +353,6 @@ class DropdownButton2 extends StatefulWidget { /// accessibility tools (like VoiceOver on iOS) focus on the barrier. final String? barrierLabel; - /// Specifies whether the modal barrier should cover the dropdown button or not. - /// - /// Defaults to true. - final bool barrierCoversButton; - /// A [Listenable] that can be used to programmatically open the dropdown menu. /// /// The [openDropdownListenable] allows you to manually open the dropdown by modifying its value. @@ -985,6 +985,7 @@ class DropdownButtonFormField2 extends FormField { Widget? customButton, bool openWithLongPress = false, bool barrierDismissible = true, + bool barrierCoversButton = true, Color? barrierColor, String? barrierLabel, Listenable? openDropdownListenable, @@ -1056,6 +1057,7 @@ class DropdownButtonFormField2 extends FormField { customButton: customButton, openWithLongPress: openWithLongPress, barrierDismissible: barrierDismissible, + barrierCoversButton: barrierCoversButton, barrierColor: barrierColor, barrierLabel: barrierLabel, openDropdownListenable: openDropdownListenable,