update
This commit is contained in:
@ -18,6 +18,14 @@ class PerfectureWidget extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _PerfectureWidgetState extends State<PerfectureWidget> {
|
||||
|
||||
|
||||
bool isNumeric(String s) {
|
||||
if (s == null) {
|
||||
return false;
|
||||
}
|
||||
return double.tryParse(s) != null;
|
||||
}
|
||||
|
||||
|
||||
List<DropdownMenuItem<String>> getDropdownItems() {
|
||||
@ -64,7 +72,22 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
|
||||
|
||||
dropDownItems.add(newDropdown);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(widget.indexController.customAreas.isNotEmpty){
|
||||
|
||||
for (Map<String, dynamic> currency in widget.indexController.customAreas[0]) {
|
||||
var newDropdown = DropdownMenuItem(
|
||||
child: Text(currency["event_name"].toString()),
|
||||
value: currency["event_name"].toString(),
|
||||
);
|
||||
|
||||
dropDownItems.add(newDropdown);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return dropDownItems;
|
||||
}
|
||||
|
||||
@ -94,7 +117,7 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
|
||||
items: getDropdownItems()
|
||||
),
|
||||
|
||||
// Custom events area
|
||||
// Gifu areas
|
||||
widget.indexController.areas.isNotEmpty ?
|
||||
DropdownButton<String>(
|
||||
value: widget.indexController.areaDropdownValue,
|
||||
@ -107,10 +130,17 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
|
||||
color: Colors.deepPurpleAccent,
|
||||
),
|
||||
onChanged: (String? newValue) {
|
||||
if (isNumeric(newValue!)){
|
||||
|
||||
}
|
||||
else{
|
||||
widget.indexController.loadCustomLocation(newValue);
|
||||
}
|
||||
setState(() {
|
||||
if(newValue != null){
|
||||
widget.indexController.is_loading.value = true;
|
||||
widget.indexController.populateForCustomArea(newValue, widget.mapController);
|
||||
widget.indexController.areaDropdownValue = newValue;
|
||||
widget.indexController.populateSubPerForArea(newValue, widget.mapController);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user