Also allow searching admin1 and admin2 regions

This commit is contained in:
Ming Ming 2022-08-30 02:36:58 +08:00
parent 5925d3f59b
commit 116884b5d4

View file

@ -214,9 +214,12 @@ class HomeSearchSuggestionBloc
}
try {
final locations = await ListLocationGroup(_c)(account);
// replace duplicated entries in name by the one in countryCode
// make sure no duplicates
final map = <String, LocationGroup>{};
for (final l in locations.name + locations.countryCode) {
for (final l in locations.name +
locations.admin1 +
locations.admin2 +
locations.countryCode) {
map[l.place] = l;
}
product.addAll(map.values.map((e) => _LocationSearcheable(e)));