Fix 2803,2802,2800

This commit is contained in:
2024-04-03 21:39:12 +09:00
parent 7e6b5f887a
commit accd0cad43
5 changed files with 94 additions and 6 deletions

View File

@ -172,11 +172,11 @@ class IndexController extends GetxController {
} else {
isLoading.value = false;
Get.snackbar(
"Failed",
"User login failed, please try again.",
"ログイン失敗",
"ログインIDかパスワードを確認して下さい。",
icon: const Icon(Icons.error, size: 40.0, color: Colors.blue),
snackPosition: SnackPosition.TOP,
duration: const Duration(milliseconds: 800),
duration: const Duration(seconds: 3),
backgroundColor: Colors.yellow,
//icon:Image(image:AssetImage("assets/images/dora.png"))
);
@ -282,6 +282,7 @@ class IndexController extends GetxController {
});
}
/*
void loadLocationsBound() {
if (isCustomAreaSelected.value == true) {
return;
@ -320,7 +321,7 @@ class IndexController extends GetxController {
icon: const Icon(Icons.assistant_photo_outlined,
size: 40.0, color: Colors.blue),
snackPosition: SnackPosition.TOP,
duration: const Duration(milliseconds: 800),
duration: const Duration(seconds: 2),
backgroundColor: Colors.yellow,
//icon:Image(image:AssetImage("assets/images/dora.png"))
);
@ -333,6 +334,73 @@ class IndexController extends GetxController {
}
});
}
*/
// 2024-04-03 Akira .. Update the code . See ticket 2800.
//
void loadLocationsBound() {
if (isCustomAreaSelected.value == true) {
return;
}
locations.clear();
String cat = currentCat.isNotEmpty ? currentCat[0] : "";
if (currentCat.isNotEmpty && currentCat[0] == "-all-") {
cat = "";
}
LatLngBounds bounds = mapController.bounds!;
currentBound.clear();
currentBound.add(bounds);
isLoading.value = true; // ローディング状態をtrueに設定
LocationService.loadLocationsBound(
bounds.southWest.latitude,
bounds.southWest.longitude,
bounds.northWest.latitude,
bounds.northWest.longitude,
bounds.northEast.latitude,
bounds.northEast.longitude,
bounds.southEast.latitude,
bounds.southEast.longitude,
cat
).then((value) {
isLoading.value = false; // ローディング状態をfalseに設定
if (value == null) {
// APIからのレスポンスがnullの場合は処理を中断
return;
}
if (value.features.isEmpty) {
if (showPopup == false) {
return;
}
Get.snackbar(
"Too many Points",
"please zoom in",
icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
snackPosition: SnackPosition.TOP,
duration: const Duration(seconds: 3),
backgroundColor: Colors.yellow,
);
showPopup = false;
}
if (value.features.isNotEmpty) {
locations.add(value);
}
}).catchError((error) {
isLoading.value = false; // ローディング状態をfalseに設定
// エラーハンドリング: APIリクエストが失敗した場合
Get.snackbar(
"Error",
"Failed to load locations. Please check your internet connection and try again.",
icon: const Icon(Icons.error, size: 40.0, color: Colors.red),
snackPosition: SnackPosition.TOP,
duration: const Duration(milliseconds: 800),
backgroundColor: Colors.yellow,
);
});
}
void setBound(LatLngBounds bounds) {
currentBound.clear();