Skip to content

Commit

Permalink
Merge pull request #78 from darkshredder/master
Browse files Browse the repository at this point in the history
fixed:Flutter app report incident screen drop-down selection bug
  • Loading branch information
ivantha authored Mar 2, 2021
2 parents 036ad28 + af2bc4b commit ac26e25
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion dengue_app/lib/views/report_incident.dart
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,22 @@ class _DistrictDropdownState extends State<DistrictDropdown> {
return null;
}

// todo fix bug on changing already selected dropdowns

@override
void didUpdateWidget(DistrictDropdown oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.selectedProvince != oldWidget.selectedProvince) {
setState(() {
selectedDistrict = widget.districtList
.where((element) => element.provinceId == widget.selectedProvince.id)
.toList()
.first;
widget.setDistrictFunction(selectedDistrict);
});
}
}


@override
Widget build(BuildContext context) {
return DropdownButtonFormField<District>(
Expand Down

0 comments on commit ac26e25

Please sign in to comment.