Skip to content

Commit c66e5b1

Browse files
committed
feat(core): added new dropdown attributes: borderRadius, enableFeedback, alignment. Fixes #1011
1 parent 0eae4f6 commit c66e5b1

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

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

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'package:collection/collection.dart' show IterableExtension;
22
import 'package:flutter/material.dart';
3-
43
import 'package:flutter_form_builder/flutter_form_builder.dart';
54

65
/// Field for Dropdown button
@@ -194,8 +193,40 @@ class FormBuilderDropdown<T> extends FormBuilderField<T> {
194193

195194
final bool shouldRequestFocus;
196195

196+
/// Whether detected gestures should provide acoustic and/or haptic feedback.
197+
///
198+
/// For example, on Android a tap will produce a clicking sound and a
199+
/// long-press will produce a short vibration, when feedback is enabled.
200+
///
201+
/// By default, platform-specific feedback is enabled.
202+
///
203+
/// See also:
204+
///
205+
/// * [Feedback] for providing platform-specific feedback to certain actions.
206+
final bool? enableFeedback;
207+
208+
/// Defines how the hint or the selected item is positioned within the button.
209+
///
210+
/// This property must not be null. It defaults to [AlignmentDirectional.centerStart].
211+
///
212+
/// See also:
213+
///
214+
/// * [Alignment], a class with convenient constants typically used to
215+
/// specify an [AlignmentGeometry].
216+
/// * [AlignmentDirectional], like [Alignment] for specifying alignments
217+
/// relative to text direction.
218+
final AlignmentGeometry alignment;
219+
220+
/// Defines the corner radii of the menu's rounded rectangle shape.
221+
///
222+
/// The radii of the first menu item's top left and right corners are
223+
/// defined by the corresponding properties of the [borderRadius].
224+
/// Similarly, the radii of the last menu item's bottom and right corners
225+
/// are defined by the corresponding properties of the [borderRadius].
226+
final BorderRadius? borderRadius;
227+
197228
/// Creates field for Dropdown button
198-
FormBuilderDropdown({
229+
FormBuilderDropdown( {
199230
Key? key,
200231
//From Super
201232
required String name,
@@ -230,6 +261,9 @@ class FormBuilderDropdown<T> extends FormBuilderField<T> {
230261
this.itemHeight = kMinInteractiveDimension,
231262
this.selectedItemBuilder,
232263
this.menuMaxHeight,
264+
this.enableFeedback,
265+
this.borderRadius,
266+
this.alignment = AlignmentDirectional.centerStart,
233267
}) : /*: assert(allowClear == true || clearIcon != null)*/ super(
234268
key: key,
235269
initialValue: initialValue,
@@ -296,6 +330,9 @@ class FormBuilderDropdown<T> extends FormBuilderField<T> {
296330
itemHeight: itemHeight,
297331
selectedItemBuilder: selectedItemBuilder,
298332
menuMaxHeight: menuMaxHeight,
333+
borderRadius: borderRadius,
334+
enableFeedback: enableFeedback,
335+
alignment: alignment,
299336
),
300337
),
301338
),

0 commit comments

Comments
 (0)