Skip to content

Commit 648c277

Browse files
committed
feat(core): added option for Dropdown menuMaxHeight
1 parent 194ff0b commit 648c277

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/flutter_form_builder/lib/src/fields/form_builder_dropdown.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,17 @@ class FormBuilderDropdown<T> extends FormBuilderField<T> {
181181
final bool allowClear;
182182
final Widget clearIcon;
183183

184+
/// The maximum height of the menu.
185+
///
186+
/// The maximum height of the menu must be at least one row shorter than
187+
/// the height of the app's view. This ensures that a tappable area
188+
/// outside of the simple menu is present so the user can dismiss the menu.
189+
///
190+
/// If this property is set above the maximum allowable height threshold
191+
/// mentioned above, then the menu defaults to being padded at the top
192+
/// and bottom of the menu by at one menu item's height.
193+
final double? menuMaxHeight;
194+
184195
/// Creates field for Dropdown button
185196
FormBuilderDropdown({
186197
Key? key,
@@ -215,6 +226,7 @@ class FormBuilderDropdown<T> extends FormBuilderField<T> {
215226
this.focusColor,
216227
this.itemHeight = kMinInteractiveDimension,
217228
this.selectedItemBuilder,
229+
this.menuMaxHeight,
218230
}) : /*: assert(allowClear == true || clearIcon != null)*/ super(
219231
key: key,
220232
initialValue: initialValue,
@@ -278,6 +290,7 @@ class FormBuilderDropdown<T> extends FormBuilderField<T> {
278290
focusColor: focusColor,
279291
itemHeight: itemHeight,
280292
selectedItemBuilder: selectedItemBuilder,
293+
menuMaxHeight: menuMaxHeight,
281294
),
282295
),
283296
),

0 commit comments

Comments
 (0)