Release 4.8.0 - 2024-05-26
This commit is contained in:
@ -75,7 +75,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
}
|
||||
} else {
|
||||
GeoJSONFeature gf = indexController.currentFeature[0];
|
||||
print("=== photo sss ${gf.properties!["photos"]}");
|
||||
//print("=== photo sss ${gf.properties!["photos"]}");
|
||||
if (gf.properties!["photos"] == null || gf.properties!["photos"] == "") {
|
||||
return const Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
} else {
|
||||
@ -170,6 +170,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
(destination.cp == -1 || destination.cp == 0 ) &&
|
||||
destinationController.rogainingCounted.value == false) {
|
||||
// ゲームが始まってなければ
|
||||
// ロゲ開始している && (開始地点から100m以内 又は 電波が弱い) && CP番号が 1 or 0 && rogainingCounted==false(どこにもチェックインしていない) なら
|
||||
return Obx(() {
|
||||
final isInRog = destinationController.isInRog.value;
|
||||
|
||||
@ -196,6 +197,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
// ダイアログをキャンセルした場合はボタンを再度有効化
|
||||
destinationController.isInRog.value = false;
|
||||
Get.back(); // Close the dialog
|
||||
Get.back(); // Close the bottom sheet
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
@ -215,7 +217,8 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
|
||||
saveGameState();
|
||||
await ExternalService().startRogaining();
|
||||
Get.back(); // Close the dialog and potentially navigate away
|
||||
Get.back();
|
||||
Get.back();// Close the dialog and potentially navigate away
|
||||
},
|
||||
),
|
||||
],
|
||||
@ -240,7 +243,11 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
(destination.cp == 0 || destination.cp == -2 || destination.cp == -1) &&
|
||||
// (destination.cp == 0 || destination.cp == -2 ) &&
|
||||
DestinationController.ready_for_goal == true) {
|
||||
|
||||
// ready_for_goal && (開始地点から500m以内 又は 電波が弱い) && CP番号が -1 or -2 or 0 && rogainingCounted==true なら
|
||||
// Goal ボタン
|
||||
//goal
|
||||
|
||||
return ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(backgroundColor: Colors.red),
|
||||
onPressed: destinationController.rogainingCounted.value == true &&
|
||||
@ -268,8 +275,10 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
"finish_rogaining".tr,
|
||||
style: TextStyle(color: Colors.white),
|
||||
));
|
||||
|
||||
} else if (distanceToDest <=
|
||||
destinationController.getForcedChckinDistance(destination)) {
|
||||
// cpごとの強制チェックイン以内にいれば
|
||||
//start
|
||||
return ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
@ -281,6 +290,8 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
try{
|
||||
destinationController.isCheckingIn.value = true; // ここを追加
|
||||
Get.back();
|
||||
Get.back();
|
||||
await Future.delayed(Duration(milliseconds: 500));
|
||||
await destinationController.callforCheckin(destination);
|
||||
destinationController.isCheckingIn.value = false;
|
||||
} catch (e) {
|
||||
@ -296,62 +307,6 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
print('Error processing check-in: $e');
|
||||
}
|
||||
},
|
||||
/*
|
||||
// Check conditions to show confirmation dialog
|
||||
if (destinationController.isInRog.value == false &&
|
||||
(destinationController.distanceToStart() <= 500 || destinationController.isGpsSignalWeak() ) && //追加 Akira 2024-4-5
|
||||
destination.cp == -1 &&
|
||||
destinationController.rogainingCounted.value == false) {
|
||||
print("counted ${destinationController.rogainingCounted.value}");
|
||||
|
||||
// Show confirmation dialog
|
||||
Get.dialog(
|
||||
AlertDialog(
|
||||
title: const Text("確認"), //confirm
|
||||
content: const Text(
|
||||
"ロゲを開始すると、今までのロゲデータが全てクリアされます。本当に開始しますか?"), //are you sure
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: const Text("いいえ"), //no
|
||||
onPressed: () {
|
||||
Get.back(); // Close the dialog
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: const Text("はい"), //yes
|
||||
onPressed: () async {
|
||||
// Clear data and start game logic here
|
||||
destinationController.isInRog.value = true;
|
||||
destinationController.resetRogaining();
|
||||
destinationController.addToRogaining(
|
||||
destinationController.currentLat,
|
||||
destinationController.currentLon,
|
||||
destination.location_id!,
|
||||
);
|
||||
saveGameState();
|
||||
await ExternalService().startRogaining();
|
||||
Get.back(); // Close the dialog and potentially navigate away
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
barrierDismissible:
|
||||
false, // User must tap a button to close the dialog
|
||||
);
|
||||
} else if (destinationController.isInRog.value == true &&
|
||||
destination.cp != -1) {
|
||||
//print("counted ${destinationController.rogainingCounted.value}");
|
||||
// Existing logic for other conditions
|
||||
|
||||
Get.back();
|
||||
await destinationController.callforCheckin(destination);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
},
|
||||
|
||||
*/
|
||||
|
||||
child: Text(
|
||||
destination.cp == -1 &&
|
||||
destinationController.isInRog.value == false &&
|
||||
@ -418,23 +373,23 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
destinationController.currentLat, destinationController.currentLon),
|
||||
LatLng(cdest.lat!, cdest.lon!));
|
||||
|
||||
LogManager().addLog("Distance from current point : $distanceToDest");
|
||||
LogManager().addLog(
|
||||
debugPrint("Distance from current point : $distanceToDest");
|
||||
debugPrint(
|
||||
"forced distance for point : ${destinationController.getForcedChckinDistance(destination)}");
|
||||
LogManager().addLog(
|
||||
debugPrint(
|
||||
"current point : ${destinationController.currentLat}, ${destinationController.currentLon} - ${DateTime.now().hour}:${DateTime.now().minute}:${DateTime.now().second}:${DateTime.now().microsecond}");
|
||||
|
||||
LogManager().addLog("Checkin radius : ${destination.checkin_radious}");
|
||||
LogManager().addLog("--${destination.cp}--");
|
||||
debugPrint("Checkin radius : ${destination.checkin_radious}");
|
||||
debugPrint("--${destination.cp}--");
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
Padding( // 1行目
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
MaterialButton(
|
||||
MaterialButton( // キャンセルボタン
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
@ -447,7 +402,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
size: 14,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
Expanded( // チェックポイント番号+ポイント名
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Obx(() => Text(
|
||||
@ -462,7 +417,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
Row( // 2行目 チェックポイント写真
|
||||
children: [
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
@ -471,84 +426,89 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
)),
|
||||
],
|
||||
),
|
||||
Obx(() => Padding(
|
||||
Obx(() => Padding( // 3行め ボタン類
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
Row( // 開始・ゴールボタン
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
// Finish or Goal
|
||||
(destination.cp == -1 || destination.cp == 0)
|
||||
(destination.cp == -1 || destination.cp == 0 || destination.cp == -2)
|
||||
? getActionButton(context, destination)
|
||||
: Container(),
|
||||
: Container(), // 一般CPは空
|
||||
],
|
||||
),
|
||||
Row(
|
||||
Row( // 2列目 チェックインボタン
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
//checkin or remove checkin
|
||||
destinationController.isInRog.value == true && destination.cp != 0 && destination.cp != -1 && destination.cp != -2
|
||||
destinationController.isInRog.value == true
|
||||
&& (distanceToDest <=
|
||||
destinationController.getForcedChckinDistance(destination) || destination.checkin_radious==-1 )
|
||||
&& destination.cp != 0 && destination.cp != -1 && destination.cp != -2
|
||||
? (isAlreadyCheckedIn == false
|
||||
? ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.red),
|
||||
onPressed: () async {
|
||||
try {
|
||||
await destinationController.callforCheckin(destination);
|
||||
} catch (e) {
|
||||
// エラーハンドリング
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'An error occurred while processing check-in.',
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
duration: Duration(seconds: 3),
|
||||
);
|
||||
// 必要に応じてエラーログを記録
|
||||
print('Error processing check-in: $e');
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
"checkin".tr,
|
||||
style: TextStyle(color: Colors.white),
|
||||
))
|
||||
: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.grey[300]),
|
||||
onPressed: () async {
|
||||
try {
|
||||
await destinationController
|
||||
.removeCheckin(destination.cp!.toInt());
|
||||
destinationController
|
||||
.deleteDestination(destination);
|
||||
Get.back();
|
||||
Get.snackbar(
|
||||
'チェックイン取り消し',
|
||||
'${destination.name}のチェックインは取り消されました',
|
||||
backgroundColor: Colors.green,
|
||||
colorText: Colors.white,
|
||||
duration: Duration(seconds: 3),
|
||||
);
|
||||
} catch (e) {
|
||||
// エラーハンドリング
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'An error occurred while canceling check-in.',
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
duration: Duration(seconds: 3),
|
||||
);
|
||||
// 必要に応じてエラーログを記録
|
||||
print('Error canceling check-in: $e');
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
"cancel_checkin".tr,
|
||||
style: TextStyle(color: Colors.black),
|
||||
)))
|
||||
: Container(),
|
||||
// go here or cancel route
|
||||
? ElevatedButton( // まだチェックインしていなければ、チェックインボタンを表示
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.red),
|
||||
onPressed: () async {
|
||||
try {
|
||||
Get.back();
|
||||
|
||||
await destinationController.callforCheckin(destination);
|
||||
|
||||
} catch (e) {
|
||||
// エラーハンドリング
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'An error occurred while processing check-in.',
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
duration: Duration(seconds: 3),
|
||||
);
|
||||
// 必要に応じてエラーログを記録
|
||||
print('Error processing check-in: $e');
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
"checkin".tr,
|
||||
style: TextStyle(color: Colors.white),
|
||||
)
|
||||
)
|
||||
: ElevatedButton( // チェックインしていれば、チェックイン取消ボタン
|
||||
style: ElevatedButton.styleFrom(backgroundColor: Colors.grey[300]),
|
||||
onPressed: () async {
|
||||
try {
|
||||
await destinationController.removeCheckin(destination.cp!.toInt());
|
||||
destinationController.deleteDestination(destination);
|
||||
Get.back();
|
||||
Get.snackbar(
|
||||
'チェックイン取り消し',
|
||||
'${destination.name}のチェックインは取り消されました',
|
||||
backgroundColor: Colors.green,
|
||||
colorText: Colors.white,
|
||||
duration: Duration(seconds: 3),
|
||||
);
|
||||
} catch (e) {
|
||||
// エラーハンドリング
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'An error occurred while canceling check-in.',
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
duration: Duration(seconds: 3),
|
||||
);
|
||||
// 必要に応じてエラーログを記録
|
||||
print('Error canceling check-in: $e');
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
"cancel_checkin".tr,
|
||||
style: TextStyle(color: Colors.black),
|
||||
)
|
||||
)
|
||||
) : Container(), // 近くにいなければ空
|
||||
// go here or cancel route
|
||||
Obx(() => ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Theme.of(context)
|
||||
@ -557,6 +517,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
onPressed: () async {
|
||||
if (destinationController.isRouteShowing.value) {
|
||||
destinationController.clearRoute();
|
||||
Get.back();
|
||||
} else {
|
||||
Get.back();
|
||||
Position position =
|
||||
@ -575,14 +536,16 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
.destinationMatrixFromCurrentPoint([ds, tp]);
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
child: Text( //ルート表示 or ルート消去
|
||||
destinationController.isRouteShowing.value
|
||||
? "cancel_route".tr
|
||||
: "go_here".tr,
|
||||
style: TextStyle(
|
||||
color:
|
||||
Theme.of(context).colorScheme.onPrimary),
|
||||
))),
|
||||
)
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
|
||||
Reference in New Issue
Block a user