dropDownList method
Widget dropDownList (ExploreEventsViewModel model, BuildContext context)
Shows a list of dropdown taken from model
and context
.
params:
model
: contains the events datacontext
: the overall context of UI
returns:
Widget
: the dropdown
Implementation
Widget dropDownList(ExploreEventsViewModel model, BuildContext context) {
return DropdownButton<String>(
key: homeModel?.keySECategoryMenu,
value: model.chosenValue,
isExpanded: true,
items: <String>[
'All Events',
'Created Events',
'Registered Events',
'Public Events',
'Private Events',
].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(
AppLocalizations.of(context)!.strictTranslate(value),
style: Theme.of(context)
.textTheme
.titleLarge!
.copyWith(color: Theme.of(context).colorScheme.secondary),
),
);
}).toList(),
onChanged: (value) {
model.choseValueFromDropdown(value!);
},
);
}