Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed:Flutter app report incident screen drop-down selection bug #78

Merged
merged 2 commits into from
Mar 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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