This commit is contained in:
Mohamed Nouffer
2022-06-06 21:15:58 +05:30
parent eea432c3c7
commit 3d9f20fd66
11 changed files with 168 additions and 34 deletions

View File

@ -52,6 +52,22 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
return dropDownItems;
}
List<DropdownMenuItem<String>> getCustomArea(){
List<DropdownMenuItem<String>> dropDownItems = [];
if(widget.indexController.areas.isNotEmpty){
for (Map<String, dynamic> currency in widget.indexController.areas[0]) {
var newDropdown = DropdownMenuItem(
child: Text(currency["area_nm"].toString()),
value: currency["id"].toString(),
);
dropDownItems.add(newDropdown);
}
}
return dropDownItems;
}
@override
Widget build(BuildContext context) {
return Obx(() =>
@ -78,6 +94,29 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
items: getDropdownItems()
),
// Custom events area
widget.indexController.areas.isNotEmpty ?
DropdownButton<String>(
value: widget.indexController.areaDropdownValue,
icon: const Icon(Icons.arrow_downward),
elevation: 16,
style: const TextStyle(color: Colors.deepPurple),
hint: const Text("select"),
underline: Container(
height: 2,
color: Colors.deepPurpleAccent,
),
onChanged: (String? newValue) {
setState(() {
if(newValue != null){
widget.indexController.is_loading.value = true;
widget.indexController.populateForCustomArea(newValue, widget.mapController);
}
});
},
items: getCustomArea(),
): const Text(""),
widget.indexController.subPerfs.isNotEmpty ?
DropdownButton<String>(