mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 05:26:47 +00:00
Custom empty builder for dropdown search
This commit is contained in:
parent
e620cfa515
commit
58a52c9d6d
@ -558,6 +558,9 @@ class APIFormField {
|
||||
popupItemBuilder: (context, item, isSelected) {
|
||||
return _renderRelatedField(item, isSelected, true);
|
||||
},
|
||||
emptyBuilder: (context, item) {
|
||||
return _renderEmptyResult();
|
||||
},
|
||||
onSaved: (item) {
|
||||
if (item != null) {
|
||||
data["value"] = item["pk"];
|
||||
@ -650,9 +653,21 @@ class APIFormField {
|
||||
subtitle: Text("Model '${model}' rendering not supported"),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Construct a widget to instruct the user that no results were found
|
||||
Widget _renderEmptyResult() {
|
||||
return ListTile(
|
||||
leading: FaIcon(FontAwesomeIcons.search),
|
||||
title: Text(L10().noResults),
|
||||
subtitle: Text(
|
||||
L10().queryNoResults,
|
||||
style: TextStyle(fontStyle: FontStyle.italic),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Construct a string input element
|
||||
Widget _constructString() {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user