I using this model for my DropdownButtonFormField:
class MyItem {
final String fullName;
final String shortName;
}
This my UI code:
List<DropdownMenuItem<MyItem>> _getItems() {
return widget.items
.map((e) => DropdownMenuItem(
value: e,
child: Container(
color: AppColors.inputBackgroundColor,
alignment: Alignment.centerLeft,
child: Text(
'${e.fullName} (${e.shortName})',
style: AppStyles.bodyText1,
),
),
))
.toList();
}
DropdownButtonFormField2<MyItem>(
items: _getItems(),
),
I need to display "fullName + (shortName)" in the popup(items), and only the "shortName" in the input field itself (when I selected the value).
Is this possible?