Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: #1398 add hint to FormBuilderDropdown #1424

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/src/fields/form_builder_dropdown.dart
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,15 @@ class FormBuilderDropdown<T> extends FormBuilderFieldDecoration<T> {
/// are defined by the corresponding properties of the [borderRadius].
final BorderRadius? borderRadius;

/// A placeholder widget that is displayed by the dropdown button.
///
/// If [value] is null and the dropdown is enabled ([items] and [onChanged] are non-null),
/// this widget is displayed as a placeholder for the dropdown button's value.
///
/// If [value] is null and the dropdown is disabled and [disabledHint] is null,
/// this widget is used as the placeholder.
final Widget? hint;

/// Creates field for Dropdown button
FormBuilderDropdown({
super.key,
Expand Down Expand Up @@ -253,6 +262,7 @@ class FormBuilderDropdown<T> extends FormBuilderFieldDecoration<T> {
this.enableFeedback,
this.borderRadius,
this.alignment = AlignmentDirectional.centerStart,
this.hint,
}) : super(
builder: (FormFieldState<T?> field) {
final state = field as _FormBuilderDropdownState<T>;
Expand Down Expand Up @@ -289,6 +299,7 @@ class FormBuilderDropdown<T> extends FormBuilderFieldDecoration<T> {
borderRadius: borderRadius,
enableFeedback: enableFeedback,
alignment: alignment,
hint: hint,
);
},
);
Expand Down
Loading