added disabled feature to buttons and reset on start
This commit is contained in:
@ -396,45 +396,6 @@ class StartRogaining extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// class NotAtGoal extends StatelessWidget {
|
|
||||||
// NotAtGoal({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
// DestinationController destinationController =
|
|
||||||
// Get.find<DestinationController>();
|
|
||||||
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// return Scaffold(
|
|
||||||
// appBar: AppBar(
|
|
||||||
// title: Text(
|
|
||||||
// "Not reached the goal yet".tr,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// body: Container(
|
|
||||||
// child: Center(
|
|
||||||
// child: Column(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
// children: [
|
|
||||||
// Text("You have not reached the goal yet.".tr,
|
|
||||||
// style: const TextStyle(fontSize: 24)),
|
|
||||||
// const SizedBox(
|
|
||||||
// height: 40.0,
|
|
||||||
// ),
|
|
||||||
// ElevatedButton(
|
|
||||||
// onPressed: () {
|
|
||||||
// Get.back();
|
|
||||||
// destinationController.skip_gps = false;
|
|
||||||
// },
|
|
||||||
// child: const Text("Back"),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
class BuyPointCamera extends StatelessWidget {
|
class BuyPointCamera extends StatelessWidget {
|
||||||
BuyPointCamera({Key? key, required this.destination}) : super(key: key);
|
BuyPointCamera({Key? key, required this.destination}) : super(key: key);
|
||||||
|
|
||||||
@ -445,6 +406,8 @@ class BuyPointCamera extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
print("in camera purchase 1 ${destinationController.isInRog.value}");
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: false,
|
||||||
@ -482,6 +445,8 @@ class BuyPointCamera extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
print(
|
||||||
|
"in camera purchase 2 ${destinationController.isInRog.value}");
|
||||||
destinationController.openCamera(
|
destinationController.openCamera(
|
||||||
context, destination);
|
context, destination);
|
||||||
},
|
},
|
||||||
@ -520,10 +485,14 @@ class BuyPointCamera extends StatelessWidget {
|
|||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: Colors.red),
|
backgroundColor: Colors.red),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
print(
|
||||||
|
"in camera purchase 3 ${destinationController.isInRog.value}");
|
||||||
await destinationController.makeBuyPoint(
|
await destinationController.makeBuyPoint(
|
||||||
destination,
|
destination,
|
||||||
destinationController.photos[0].path);
|
destinationController.photos[0].path);
|
||||||
Get.back();
|
Get.back();
|
||||||
|
print(
|
||||||
|
"in camera purchase 4 ${destinationController.isInRog.value}");
|
||||||
destinationController.rogainingCounted.value =
|
destinationController.rogainingCounted.value =
|
||||||
true;
|
true;
|
||||||
destinationController.skipGps = false;
|
destinationController.skipGps = false;
|
||||||
|
|||||||
@ -430,6 +430,10 @@ class DestinationController extends GetxController {
|
|||||||
rogainingCounted.value = false;
|
rogainingCounted.value = false;
|
||||||
|
|
||||||
DatabaseHelper db = DatabaseHelper.instance;
|
DatabaseHelper db = DatabaseHelper.instance;
|
||||||
|
|
||||||
|
await db.deleteAllDestinations();
|
||||||
|
await db.deleteAllRogaining();
|
||||||
|
|
||||||
int? latgoal = await db.latestGoal();
|
int? latgoal = await db.latestGoal();
|
||||||
if (latgoal != null) {
|
if (latgoal != null) {
|
||||||
lastGoalAt = DateTime.fromMicrosecondsSinceEpoch(latgoal);
|
lastGoalAt = DateTime.fromMicrosecondsSinceEpoch(latgoal);
|
||||||
@ -794,6 +798,8 @@ class DestinationController extends GetxController {
|
|||||||
orElse: () => null, // Provide a null value if no element is found
|
orElse: () => null, // Provide a null value if no element is found
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//print("gfs : ${gfs}");
|
||||||
|
|
||||||
if (gfs == null) {
|
if (gfs == null) {
|
||||||
return distanceToDest;
|
return distanceToDest;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -209,7 +209,25 @@ class LoginPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
),
|
||||||
|
const Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(8.0),
|
||||||
|
child: Text(
|
||||||
|
"※第8回と第9回は、岐阜県からの「清流の国ぎふ」SDGs推進ネットワーク連携促進補助金を受けています",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize:
|
||||||
|
12, // Consider adjusting the font size if the text is too small.
|
||||||
|
// Removed overflow: TextOverflow.ellipsis to allow text wrapping.
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -202,13 +202,13 @@ class ExternalService {
|
|||||||
'image': ""
|
'image': ""
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
var vvv = jsonEncode(<String, String>{
|
// var vvv = jsonEncode(<String, String>{
|
||||||
'team_name': teamname,
|
// 'team_name': teamname,
|
||||||
'cp_number': cp.toString(),
|
// 'cp_number': cp.toString(),
|
||||||
'event_code': eventcode,
|
// 'event_code': eventcode,
|
||||||
'image': res["checkinimage"].toString().replaceAll(
|
// 'image': res["checkinimage"].toString().replaceAll(
|
||||||
'http://localhost:8100', 'http://rogaining.sumasen.net')
|
// 'http://localhost:8100', 'http://rogaining.sumasen.net')
|
||||||
});
|
// });
|
||||||
// print("--json-- $vvv");
|
// print("--json-- $vvv");
|
||||||
// print("--- checnin response ${response3.statusCode}----");
|
// print("--- checnin response ${response3.statusCode}----");
|
||||||
if (response3.statusCode == 200) {
|
if (response3.statusCode == 200) {
|
||||||
|
|||||||
@ -112,6 +112,8 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
print("to start ${destinationController.distanceToStart()}");
|
||||||
|
|
||||||
destinationController.skipGps = true;
|
destinationController.skipGps = true;
|
||||||
// print('--- c use --- ${indexController.currentUser[0].values}');
|
// print('--- c use --- ${indexController.currentUser[0].values}');
|
||||||
// print('---- rog_mode ----- ${indexController.rogMode.value} -----');
|
// print('---- rog_mode ----- ${indexController.rogMode.value} -----');
|
||||||
@ -121,261 +123,6 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
return detailsSheet(context);
|
return detailsSheet(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show destination detais
|
|
||||||
// SingleChildScrollView destinationSheet(BuildContext context) {
|
|
||||||
// // print(
|
|
||||||
// // '---- currentDestinationFeature ----- ${indexController.currentDestinationFeature[0].name} -----');
|
|
||||||
|
|
||||||
// return SingleChildScrollView(
|
|
||||||
// child: Column(
|
|
||||||
// children: [
|
|
||||||
// Padding(
|
|
||||||
// padding: const EdgeInsets.all(8.0),
|
|
||||||
// child: Row(
|
|
||||||
// children: [
|
|
||||||
// MaterialButton(
|
|
||||||
// onPressed: () {
|
|
||||||
// Get.back();
|
|
||||||
// //destinationController.makePrevious(indexController.currentDestinationFeature[0]);
|
|
||||||
// },
|
|
||||||
// color: Colors.blue,
|
|
||||||
// textColor: Colors.white,
|
|
||||||
// padding: const EdgeInsets.all(16),
|
|
||||||
// shape: const CircleBorder(),
|
|
||||||
// child: const Icon(
|
|
||||||
// Icons.arrow_back_ios,
|
|
||||||
// size: 14,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Expanded(
|
|
||||||
// child: Container(
|
|
||||||
// alignment: Alignment.center,
|
|
||||||
// child: Obx(() => indexController.currentUser.isNotEmpty
|
|
||||||
// ? Text(
|
|
||||||
// "${TextUtils.getDisplayText(indexController.currentDestinationFeature[0])} : ${TextUtils.getDisplayText(indexController.currentDestinationFeature[0])} : ${indexController.currentDestinationFeature[0].name!}",
|
|
||||||
// style: const TextStyle(
|
|
||||||
// fontSize: 15.0,
|
|
||||||
// fontWeight: FontWeight.bold,
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
// : Text(
|
|
||||||
// indexController.currentDestinationFeature[0].name!,
|
|
||||||
// style: const TextStyle(
|
|
||||||
// fontSize: 15.0,
|
|
||||||
// fontWeight: FontWeight.bold,
|
|
||||||
// ),
|
|
||||||
// )),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Row(
|
|
||||||
// children: [
|
|
||||||
// Expanded(
|
|
||||||
// child: SizedBox(
|
|
||||||
// height: 260.0,
|
|
||||||
// child: Obx(() => getImage()),
|
|
||||||
// )),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// Row(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
||||||
// children: [
|
|
||||||
// Obx(
|
|
||||||
// () => indexController.currentDestinationFeature.isNotEmpty &&
|
|
||||||
// destinationController.isInCheckin.value == true &&
|
|
||||||
// destinationController.isAtStart.value == false
|
|
||||||
// ? Row(
|
|
||||||
// children: [
|
|
||||||
// ElevatedButton(
|
|
||||||
// onPressed: () {
|
|
||||||
// if (indexController.currentDestinationFeature[0]
|
|
||||||
// .checkedin ==
|
|
||||||
// null ||
|
|
||||||
// indexController.currentDestinationFeature[0]
|
|
||||||
// .checkedin ==
|
|
||||||
// false) {
|
|
||||||
// if (indexController
|
|
||||||
// .currentDestinationFeature[0]
|
|
||||||
// .hidden_location ==
|
|
||||||
// 0) {
|
|
||||||
// destinationController.skipGps = false;
|
|
||||||
// destinationController.isPhotoShoot.value =
|
|
||||||
// true;
|
|
||||||
// Get.back();
|
|
||||||
// } else {
|
|
||||||
// destinationController.makeCheckin(
|
|
||||||
// indexController
|
|
||||||
// .currentDestinationFeature[0],
|
|
||||||
// true,
|
|
||||||
// "");
|
|
||||||
// if (indexController
|
|
||||||
// .currentDestinationFeature[0].cp !=
|
|
||||||
// -1) {
|
|
||||||
// destinationController
|
|
||||||
// .rogainingCounted.value = true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// destinationController.makeCheckin(
|
|
||||||
// indexController
|
|
||||||
// .currentDestinationFeature[0],
|
|
||||||
// false,
|
|
||||||
// "");
|
|
||||||
// }
|
|
||||||
// //Get.back();
|
|
||||||
// },
|
|
||||||
// child: Text(
|
|
||||||
// //Checkin
|
|
||||||
// indexController.currentDestinationFeature[0]
|
|
||||||
// .checkedin ==
|
|
||||||
// null ||
|
|
||||||
// indexController
|
|
||||||
// .currentDestinationFeature[0]
|
|
||||||
// .checkedin ==
|
|
||||||
// false
|
|
||||||
// ? "チェックイン"
|
|
||||||
// : "チェックアウト")),
|
|
||||||
// ],
|
|
||||||
// )
|
|
||||||
// : Container(),
|
|
||||||
// ),
|
|
||||||
// Obx(
|
|
||||||
// () => destinationController.isAtStart.value == true
|
|
||||||
// ? ElevatedButton(
|
|
||||||
// onPressed: () {
|
|
||||||
// destinationController.isInRog.value = true;
|
|
||||||
// destinationController.addToRogaining(
|
|
||||||
// destinationController.currentLat,
|
|
||||||
// destinationController.currentLon,
|
|
||||||
// indexController
|
|
||||||
// .currentDestinationFeature[0].location_id!);
|
|
||||||
// saveGameState();
|
|
||||||
// ExternalService()
|
|
||||||
// .startRogaining()
|
|
||||||
// .then((value) => Get.back());
|
|
||||||
// },
|
|
||||||
// child: Text(
|
|
||||||
// // start
|
|
||||||
// indexController.currentDestinationFeature[0]
|
|
||||||
// .checkedin !=
|
|
||||||
// null ||
|
|
||||||
// indexController.currentDestinationFeature[0]
|
|
||||||
// .checkedin ==
|
|
||||||
// true
|
|
||||||
// ? "ロゲイニングを開始"
|
|
||||||
// : "間違った目的地..."))
|
|
||||||
// : Container(),
|
|
||||||
// ),
|
|
||||||
// Obx(
|
|
||||||
// () => destinationController.isAtGoal.value == true &&
|
|
||||||
// destinationController.rogainingCounted.value == true
|
|
||||||
// ? ElevatedButton(
|
|
||||||
// onPressed: () {
|
|
||||||
// Get.toNamed(AppPages.CAMERA_PAGE);
|
|
||||||
// Get.back();
|
|
||||||
// },
|
|
||||||
// child: Text(
|
|
||||||
// //goal
|
|
||||||
// indexController.currentDestinationFeature[0]
|
|
||||||
// .checkedin !=
|
|
||||||
// null ||
|
|
||||||
// indexController.currentDestinationFeature[0]
|
|
||||||
// .checkedin ==
|
|
||||||
// true
|
|
||||||
// ? "ロゲイニングを終える"
|
|
||||||
// : "間違った目的地 ..."))
|
|
||||||
// : Container(),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// Obx(
|
|
||||||
// () => indexController.currentDestinationFeature[0].address !=
|
|
||||||
// null &&
|
|
||||||
// indexController
|
|
||||||
// .currentDestinationFeature[0].address!.isNotEmpty
|
|
||||||
// ? getDetails(context, "address".tr,
|
|
||||||
// indexController.currentDestinationFeature[0].address! ?? '')
|
|
||||||
// : const SizedBox(
|
|
||||||
// width: 0.0,
|
|
||||||
// height: 0,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Obx(
|
|
||||||
// () => indexController.currentDestinationFeature[0].phone != null &&
|
|
||||||
// indexController
|
|
||||||
// .currentDestinationFeature[0].phone!.isNotEmpty
|
|
||||||
// ? getDetails(context, "telephone".tr,
|
|
||||||
// indexController.currentDestinationFeature[0].phone! ?? '')
|
|
||||||
// : const SizedBox(
|
|
||||||
// width: 0.0,
|
|
||||||
// height: 0,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Obx(
|
|
||||||
// () => indexController.currentDestinationFeature[0].email != null &&
|
|
||||||
// indexController
|
|
||||||
// .currentDestinationFeature[0].email!.isNotEmpty
|
|
||||||
// ? getDetails(context, "email".tr,
|
|
||||||
// indexController.currentDestinationFeature[0].email! ?? '')
|
|
||||||
// : const SizedBox(
|
|
||||||
// width: 0.0,
|
|
||||||
// height: 0,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Obx(
|
|
||||||
// () => indexController.currentDestinationFeature[0].webcontents !=
|
|
||||||
// null &&
|
|
||||||
// indexController
|
|
||||||
// .currentDestinationFeature[0].webcontents!.isNotEmpty
|
|
||||||
// ? getDetails(
|
|
||||||
// context,
|
|
||||||
// "web".tr,
|
|
||||||
// indexController.currentDestinationFeature[0].webcontents! ??
|
|
||||||
// '',
|
|
||||||
// isurl: true)
|
|
||||||
// : const SizedBox(
|
|
||||||
// width: 0.0,
|
|
||||||
// height: 0,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Obx(
|
|
||||||
// () => indexController.currentDestinationFeature[0].videos != null &&
|
|
||||||
// indexController
|
|
||||||
// .currentDestinationFeature[0].videos!.isNotEmpty
|
|
||||||
// ? getDetails(context, "video".tr,
|
|
||||||
// indexController.currentDestinationFeature[0].videos! ?? '',
|
|
||||||
// isurl: true)
|
|
||||||
// : const SizedBox(
|
|
||||||
// width: 0.0,
|
|
||||||
// height: 0,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// const SizedBox(
|
|
||||||
// height: 20.0,
|
|
||||||
// ),
|
|
||||||
// // Obx(() =>
|
|
||||||
// // //wantToGo(context),
|
|
||||||
|
|
||||||
// // FutureBuilder<Widget>(
|
|
||||||
// // future: wantToGo(context),
|
|
||||||
// // builder: (context, snapshot) {
|
|
||||||
// // return Container(
|
|
||||||
// // child: snapshot.data,
|
|
||||||
// // );
|
|
||||||
// // },
|
|
||||||
// // ),
|
|
||||||
|
|
||||||
// // ),
|
|
||||||
// const SizedBox(
|
|
||||||
// height: 60.0,
|
|
||||||
// )
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
Future<bool> isDestinationCheckedIn(Destination d) async {
|
Future<bool> isDestinationCheckedIn(Destination d) async {
|
||||||
DatabaseHelper db = DatabaseHelper.instance;
|
DatabaseHelper db = DatabaseHelper.instance;
|
||||||
List<Destination> ds = await db.getDestinationByLatLon(d.lat!, d.lon!);
|
List<Destination> ds = await db.getDestinationByLatLon(d.lat!, d.lon!);
|
||||||
@ -459,80 +206,43 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
// Obx(
|
// Finish or Goal
|
||||||
// () => indexController
|
ElevatedButton(
|
||||||
// .currentDestinationFeature.isNotEmpty &&
|
style: ElevatedButton.styleFrom(
|
||||||
// indexController
|
backgroundColor: Colors.red),
|
||||||
// .currentDestinationFeature[0].cp ==
|
onPressed: destinationController
|
||||||
// -1 &&
|
.rogainingCounted.value ==
|
||||||
// indexController.currentDestinationFeature[0]
|
true &&
|
||||||
// .checkedin ==
|
destinationController.distanceToStart() <=
|
||||||
// false &&
|
500 &&
|
||||||
// destinationController.isAtStart.value == true
|
//destination.cp == -1 &&
|
||||||
// ? ElevatedButton(
|
DestinationController.ready_for_goal == true
|
||||||
// onPressed: () async {
|
? () async {
|
||||||
// await destinationController
|
destinationController.isAtGoal.value = true;
|
||||||
// .resetRogaining();
|
destinationController.photos.clear();
|
||||||
// //print("~~~~ start button ~~~~");
|
await showModalBottomSheet(
|
||||||
// destinationController.isInRog.value = true;
|
constraints: BoxConstraints.loose(
|
||||||
// destinationController.addToRogaining(
|
ui.Size(
|
||||||
// destinationController.currentLat,
|
Get.width, Get.height * 0.75)),
|
||||||
// destinationController.currentLon,
|
context: Get.context!,
|
||||||
// indexController
|
isScrollControlled: true,
|
||||||
// .currentDestinationFeature[0]
|
builder: ((context) => CameraPage(
|
||||||
// .location_id!);
|
destination: destination,
|
||||||
// saveGameState();
|
))).whenComplete(() {
|
||||||
// ExternalService()
|
destinationController.skipGps = false;
|
||||||
// .startRogaining()
|
destinationController.chekcs = 0;
|
||||||
// .then((value) {
|
destinationController.isAtGoal.value =
|
||||||
// Get.back();
|
false;
|
||||||
// });
|
});
|
||||||
// },
|
}
|
||||||
// child: Text(
|
: null,
|
||||||
// // start
|
child: const Text("ロゲイニングを終える")) // goal
|
||||||
// indexController
|
,
|
||||||
// .currentDestinationFeature[
|
|
||||||
// 0]
|
|
||||||
// .checkedin !=
|
|
||||||
// null ||
|
|
||||||
// indexController
|
|
||||||
// .currentDestinationFeature[
|
|
||||||
// 0]
|
|
||||||
// .checkedin ==
|
|
||||||
// true
|
|
||||||
// ? "ロゲイニングを開始"
|
|
||||||
// : "間違った目的地..."))
|
|
||||||
// : Container(),
|
|
||||||
// ),
|
|
||||||
|
|
||||||
destinationController.rogainingCounted.value == true &&
|
|
||||||
destinationController.distanceToStart() <=
|
|
||||||
500 &&
|
|
||||||
destination.cp == -1 &&
|
|
||||||
DestinationController.ready_for_goal == true
|
|
||||||
? ElevatedButton(
|
|
||||||
onPressed: () async {
|
|
||||||
destinationController.isAtGoal.value = true;
|
|
||||||
destinationController.photos.clear();
|
|
||||||
await showModalBottomSheet(
|
|
||||||
constraints: BoxConstraints.loose(ui.Size(
|
|
||||||
Get.width, Get.height * 0.75)),
|
|
||||||
context: Get.context!,
|
|
||||||
isScrollControlled: true,
|
|
||||||
builder: ((context) => CameraPage(
|
|
||||||
destination: destination,
|
|
||||||
))).whenComplete(() {
|
|
||||||
destinationController.skipGps = false;
|
|
||||||
destinationController.chekcs = 0;
|
|
||||||
destinationController.isAtGoal.value =
|
|
||||||
false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: Text("ロゲイニングを終える"))
|
|
||||||
: Container(),
|
|
||||||
//remove checkin
|
//remove checkin
|
||||||
isAlreadyCheckedIn == true && destination.cp != -1
|
isAlreadyCheckedIn == true && destination.cp != -1
|
||||||
? ElevatedButton(
|
? ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Colors.blueAccent),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await destinationController
|
await destinationController
|
||||||
.removeCheckin(destination.cp!.toInt());
|
.removeCheckin(destination.cp!.toInt());
|
||||||
@ -540,35 +250,8 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
.deleteDestination(destination);
|
.deleteDestination(destination);
|
||||||
Get.back();
|
Get.back();
|
||||||
},
|
},
|
||||||
child: const Text("チェックイン取消"))
|
child: const Text("チェックイン取消")) //remove checkin
|
||||||
: Container(),
|
: Container(),
|
||||||
|
|
||||||
// Obx(
|
|
||||||
// () => destinationController.rogainingCounted.value ==
|
|
||||||
// false &&
|
|
||||||
// destination.cp == -1 &&
|
|
||||||
// destinationController.distanceToStart() <= 500
|
|
||||||
// ? ElevatedButton(
|
|
||||||
// onPressed: () {
|
|
||||||
// Get.toNamed(AppPages.CAMERA_PAGE);
|
|
||||||
// Get.back();
|
|
||||||
// },
|
|
||||||
// child: Text(
|
|
||||||
// //goal
|
|
||||||
// indexController
|
|
||||||
// .currentDestinationFeature[
|
|
||||||
// 0]
|
|
||||||
// .checkedin !=
|
|
||||||
// null ||
|
|
||||||
// indexController
|
|
||||||
// .currentDestinationFeature[
|
|
||||||
// 0]
|
|
||||||
// .checkedin ==
|
|
||||||
// true
|
|
||||||
// ? "ロゲイニングを終える"
|
|
||||||
// : "間違った目的地 ..."))
|
|
||||||
// : Container(),
|
|
||||||
// ),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
@ -579,28 +262,35 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
backgroundColor: Theme.of(context)
|
backgroundColor: Theme.of(context)
|
||||||
.colorScheme
|
.colorScheme
|
||||||
.onPrimaryContainer),
|
.onPrimaryContainer),
|
||||||
onPressed: () async {
|
onPressed: destinationController.distanceToStart() >
|
||||||
Get.back();
|
500
|
||||||
//print("---- go to ----");
|
? () async {
|
||||||
GeoJSONMultiPoint mp = indexController
|
print(
|
||||||
.currentFeature[0] as GeoJSONMultiPoint;
|
"dist to start ${destinationController.distanceToStart()}");
|
||||||
Position position =
|
Get.back();
|
||||||
await Geolocator.getCurrentPosition(
|
//print("---- go to ----");
|
||||||
desiredAccuracy:
|
GeoJSONMultiPoint mp = indexController
|
||||||
LocationAccuracy.bestForNavigation,
|
.currentFeature[0] as GeoJSONMultiPoint;
|
||||||
forceAndroidLocationManager: true);
|
Position position =
|
||||||
//print("------- position -------- $position");
|
await Geolocator.getCurrentPosition(
|
||||||
Destination ds = Destination(
|
desiredAccuracy: LocationAccuracy
|
||||||
lat: position.latitude,
|
.bestForNavigation,
|
||||||
lon: position.longitude);
|
forceAndroidLocationManager: true);
|
||||||
|
//print("------- position -------- $position");
|
||||||
|
Destination ds = Destination(
|
||||||
|
lat: position.latitude,
|
||||||
|
lon: position.longitude);
|
||||||
|
|
||||||
Destination tp = Destination(
|
Destination tp = Destination(
|
||||||
lat: mp.coordinates[0][1],
|
lat: mp.coordinates[0][1],
|
||||||
lon: mp.coordinates[0][0]);
|
lon: mp.coordinates[0][0]);
|
||||||
|
|
||||||
destinationController
|
destinationController
|
||||||
.destinationMatrixFromCurrentPoint([ds, tp]);
|
.destinationMatrixFromCurrentPoint(
|
||||||
},
|
[ds, tp]);
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
//go here
|
||||||
child: Text(
|
child: Text(
|
||||||
"ここへ行く",
|
"ここへ行く",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -616,37 +306,69 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
destinationController
|
destinationController
|
||||||
.getForcedChckinDistance(destination)
|
.getForcedChckinDistance(destination)
|
||||||
? Obx(() => ElevatedButton(
|
? Obx(() => ElevatedButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: Theme.of(context)
|
backgroundColor:
|
||||||
.colorScheme
|
Theme.of(context).colorScheme.secondary,
|
||||||
.secondary),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
//print("~~~~ manual checkin button ~~~~");
|
// Check conditions to show confirmation dialog
|
||||||
if (destination.cp == -1 &&
|
if (destination.cp == -1 &&
|
||||||
destinationController.isInRog.value ==
|
destinationController.isInRog.value ==
|
||||||
false &&
|
false &&
|
||||||
destinationController
|
destinationController
|
||||||
.rogainingCounted.value ==
|
.rogainingCounted.value ==
|
||||||
false) {
|
false) {
|
||||||
destinationController.isInRog.value = true;
|
// Show confirmation dialog
|
||||||
destinationController.addToRogaining(
|
Get.dialog(
|
||||||
destinationController.currentLat,
|
AlertDialog(
|
||||||
destinationController.currentLon,
|
title: const Text("確認"), //confirm
|
||||||
destination.location_id!);
|
content: const Text(
|
||||||
saveGameState();
|
"ロゲを開始すると、今までのロゲデータが全てクリアされます。本当に開始しますか?"), //are you sure
|
||||||
ExternalService()
|
actions: <Widget>[
|
||||||
.startRogaining()
|
TextButton(
|
||||||
.then((value) => Get.back());
|
child: const Text("いいえ"), //no
|
||||||
} else {
|
onPressed: () {
|
||||||
if (destination.cp == -1) {
|
Get.back(); // Close the dialog
|
||||||
return;
|
},
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
child: const Text("はい"), //yes
|
||||||
|
onPressed: () async {
|
||||||
|
// Clear data and start game logic here
|
||||||
|
destinationController
|
||||||
|
.isInRog.value = true;
|
||||||
|
destinationController
|
||||||
|
.resetRogaining(); // Assuming you have a method to clear data
|
||||||
|
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 {
|
||||||
|
// Existing logic for other conditions
|
||||||
|
if (destination.cp == -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Get.back();
|
||||||
|
await destinationController
|
||||||
|
.callforCheckin(destination);
|
||||||
}
|
}
|
||||||
Get.back();
|
},
|
||||||
await destinationController
|
child: Text(
|
||||||
.callforCheckin(destination);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
destination.cp == -1 &&
|
destination.cp == -1 &&
|
||||||
destinationController
|
destinationController
|
||||||
.isInRog.value ==
|
.isInRog.value ==
|
||||||
@ -665,7 +387,9 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.colorScheme
|
.colorScheme
|
||||||
.onSecondary))))
|
.onSecondary),
|
||||||
|
),
|
||||||
|
))
|
||||||
: Container(),
|
: Container(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user