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

@ -561,7 +561,14 @@ class DestinationController extends GetxController {
}
});
} else {
Get.snackbar("始まっていない", "ロゲイニングを始める必要があります");
Get.snackbar(
"始まっていません",
"ロゲ開始ボタンをタップして、ロゲイニングを始める必要があります",
icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
snackPosition: SnackPosition.TOP,
duration: const Duration(seconds: 3),
backgroundColor: Colors.yellow,
);
}
}
}
@ -931,7 +938,11 @@ class DestinationController extends GetxController {
}
void centerMapToCurrentLocation() {
assert(() {
print("center is ${currentLon}, ${currentLon}");
return true;
}());
// Akira
if (currentLat != 0 || currentLon != 0) {
indexController.mapController.move(LatLng(currentLat, currentLon), 17.0);
}

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();

View File

@ -111,7 +111,7 @@ class LoginPage extends StatelessWidget {
snackPosition:
SnackPosition.TOP,
duration: const Duration(
milliseconds: 800),
seconds: 3),
backgroundColor: Colors.yellow,
//icon:Image(image:AssetImage("assets/images/dora.png"))
);

View File

@ -111,10 +111,14 @@ class BottomSheetNew extends GetView<BottomSheetController> {
}
Widget getActionButton(BuildContext context, Destination destination) {
assert(() {
print("getActionButton ${destinationController.rogainingCounted.value}");
print("getActionButton ${destinationController.distanceToStart()}");
print("getActionButton ${destination.cp}");
print("getActionButton ${DestinationController.ready_for_goal}");
return true;
}());
// ...2024-04-03 Akira デバッグモードのみ出力するようにした。
Destination cdest = destinationController
.festuretoDestination(indexController.currentFeature[0]);

View File

@ -181,7 +181,12 @@ class _MapWidgetState extends State<MapWidget> {
}
void _centerMapOnUser() {
assert(() {
print("showBottomSheet ${destinationController.shouldShowBottomSheet}");
return true;
}());
// 2024-04-03 Akira Log enabled only debug mode..
//
//if (destinationController.shouldShowBottomSheet) {
destinationController.centerMapToCurrentLocation();
//}