Open vasilich6107 opened 2 weeks ago
DropdownSearchBuilder
should be a nullable
selectedItem
otherwise, it will be impossible to represent "nothing" value .
isEmpty
only affects the display of the hint
or label
in the dropdown.
Behavior:
null
. If an item is selected, the hint is displayed as a label.dropdownBuilder
: The behavior depends on how the developer handles null
values.Examples:
If the developer handles null
as follows, the hint
remains inside the text field without issue:
dropdownBuilder: (_, item) {
if (item == null) {
return const SizedBox.shrink();
}
return Row(
children: [
...item
],
);
},
If the developer uses a non-empty or visible widget for a null
item, like this:
dropdownBuilder: (_, item) {
if (item == null) {
return Text('No item selected');
}
return Row(
children: [
...item
],
);
},
In this case, the hint
is hidden by default, and the developer should use floatingLabelBehavior
to explicitly show the hint
as a label
.
For more context, you can refer to this related topic: GitHub issue #515.
Is your feature request related to a problem? Please describe.
Here is an fn typedef
Selected item being defined as
nullable
at the same time input decorator statesDescribe the solution you'd like This means that the content will not be shown, considering this -
selectedItem
forDropdownSearchBuilder
could be non nullable cause there is no chance it will be shown.Describe alternatives you've considered