optimized
This commit is contained in:
@ -57,9 +57,9 @@ class CameraPage extends StatelessWidget {
|
||||
await destinationController.makeCheckin(destination, true,
|
||||
destinationController.photos[0].path);
|
||||
Get.back();
|
||||
destinationController.rogaining_counted.value = true;
|
||||
destinationController.skip_gps = false;
|
||||
destinationController.is_photo_shoot.value = false;
|
||||
destinationController.rogainingCounted.value = true;
|
||||
destinationController.skipGps = false;
|
||||
destinationController.isPhotoShoot.value = false;
|
||||
Get.snackbar("チェックインしました。",
|
||||
"${destination.sub_loc_id} : ${destination.name}");
|
||||
},
|
||||
@ -69,8 +69,8 @@ class CameraPage extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
if (destinationController.is_at_goal.value &&
|
||||
destinationController.is_in_rog.value) {
|
||||
if (destinationController.isAtGoal.value &&
|
||||
destinationController.isInRog.value) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
@ -87,21 +87,21 @@ class CameraPage extends StatelessWidget {
|
||||
style:
|
||||
ElevatedButton.styleFrom(backgroundColor: Colors.red),
|
||||
onPressed: () async {
|
||||
print(
|
||||
"----- user isss ${indexController.currentUser[0]} -----");
|
||||
// print(
|
||||
// "----- user isss ${indexController.currentUser[0]} -----");
|
||||
|
||||
settingGoal.value = true;
|
||||
try {
|
||||
int userId =
|
||||
indexController.currentUser[0]["user"]["id"];
|
||||
//print("--- Pressed -----");
|
||||
String _team = indexController.currentUser[0]["user"]
|
||||
String team = indexController.currentUser[0]["user"]
|
||||
['team_name'];
|
||||
//print("--- _team : ${_team}-----");
|
||||
String _event_code = indexController.currentUser[0]
|
||||
String eventCode = indexController.currentUser[0]
|
||||
["user"]["event_code"];
|
||||
//print("--- _event_code : ${_event_code}-----");
|
||||
String _token =
|
||||
String token =
|
||||
indexController.currentUser[0]["token"];
|
||||
//print("--- _token : ${_token}-----");
|
||||
DateTime now = DateTime.now();
|
||||
@ -111,21 +111,21 @@ class CameraPage extends StatelessWidget {
|
||||
await ExternalService()
|
||||
.makeGoal(
|
||||
userId,
|
||||
_token,
|
||||
_team,
|
||||
token,
|
||||
team,
|
||||
destinationController.photos[0].path,
|
||||
formattedDate,
|
||||
_event_code)
|
||||
eventCode)
|
||||
.then((value) {
|
||||
print(
|
||||
"---called ext api ${value['status']} ------");
|
||||
// print(
|
||||
// "---called ext api ${value['status']} ------");
|
||||
if (value['status'] == 'OK') {
|
||||
Get.back();
|
||||
destinationController.skip_gps = false;
|
||||
destinationController.skipGps = false;
|
||||
Get.snackbar("目標が保存されました", "目標が正常に追加されました");
|
||||
destinationController.resetRogaining();
|
||||
} else {
|
||||
print("---- status ${value['status']} ---- ");
|
||||
//print("---- status ${value['status']} ---- ");
|
||||
Get.snackbar("目標が追加されていません", "please_try_again");
|
||||
}
|
||||
});
|
||||
@ -136,15 +136,13 @@ class CameraPage extends StatelessWidget {
|
||||
}
|
||||
},
|
||||
child: Text("finish_goal".tr))
|
||||
: Container(
|
||||
child: const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
: const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
)
|
||||
: Container())
|
||||
],
|
||||
);
|
||||
} else if (destinationController.is_in_rog.value &&
|
||||
} else if (destinationController.isInRog.value &&
|
||||
dbDest?.checkedin != null &&
|
||||
dbDest?.checkedin == true) {
|
||||
//make buypoint image
|
||||
@ -162,16 +160,16 @@ class CameraPage extends StatelessWidget {
|
||||
? ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(backgroundColor: Colors.red),
|
||||
onPressed: () async {
|
||||
print(
|
||||
"##### current destination ${indexController.currentDestinationFeature[0].sub_loc_id} #######");
|
||||
// print(
|
||||
// "##### current destination ${indexController.currentDestinationFeature[0].sub_loc_id} #######");
|
||||
await destinationController.makeBuyPoint(
|
||||
destination!, destinationController.photos[0].path);
|
||||
destination, destinationController.photos[0].path);
|
||||
Get.back();
|
||||
destinationController.rogaining_counted.value = true;
|
||||
destinationController.skip_gps = false;
|
||||
destinationController.is_photo_shoot.value = false;
|
||||
destinationController.rogainingCounted.value = true;
|
||||
destinationController.skipGps = false;
|
||||
destinationController.isPhotoShoot.value = false;
|
||||
Get.snackbar("お買い物加点を行いました。",
|
||||
"${destination!.sub_loc_id} : ${destination!.name}");
|
||||
"${destination.sub_loc_id} : ${destination.name}");
|
||||
},
|
||||
child: const Text("レシートの写真を撮る"))
|
||||
: Container())
|
||||
@ -192,16 +190,16 @@ class CameraPage extends StatelessWidget {
|
||||
? ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(backgroundColor: Colors.red),
|
||||
onPressed: () async {
|
||||
print(
|
||||
"##### current destination ${indexController.currentDestinationFeature[0].sub_loc_id} #######");
|
||||
// print(
|
||||
// "##### current destination ${indexController.currentDestinationFeature[0].sub_loc_id} #######");
|
||||
await destinationController.makeCheckin(
|
||||
indexController.currentDestinationFeature[0],
|
||||
true,
|
||||
destinationController.photos[0].path);
|
||||
Get.back();
|
||||
destinationController.rogaining_counted.value = true;
|
||||
destinationController.skip_gps = false;
|
||||
destinationController.is_photo_shoot.value = false;
|
||||
destinationController.rogainingCounted.value = true;
|
||||
destinationController.skipGps = false;
|
||||
destinationController.isPhotoShoot.value = false;
|
||||
Get.snackbar("チェックインした", "正常にチェックインしました");
|
||||
},
|
||||
child: const Text("チェックイン"))
|
||||
@ -218,13 +216,13 @@ class CameraPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (buyPointPhoto == true) {
|
||||
print("--- buy point camera ${destination.toString()}");
|
||||
//print("--- buy point camera ${destination.toString()}");
|
||||
return BuyPointCamera(destination: destination);
|
||||
} else if (destinationController.is_in_rog.value) {
|
||||
print("--- in normal camera ${destination.toString()}");
|
||||
} else if (destinationController.isInRog.value) {
|
||||
//print("--- in normal camera ${destination.toString()}");
|
||||
return Scaffold(
|
||||
appBar: destinationController.is_in_rog.value &&
|
||||
destinationController.rogaining_counted.value == true
|
||||
appBar: destinationController.isInRog.value &&
|
||||
destinationController.rogainingCounted.value == true
|
||||
? AppBar(
|
||||
automaticallyImplyLeading: false,
|
||||
title: destination.cp == -1
|
||||
@ -297,25 +295,23 @@ class StartRogaining extends StatelessWidget {
|
||||
"Not started yet".tr,
|
||||
),
|
||||
),
|
||||
body: Container(
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text("You have not started rogaining yet.".tr,
|
||||
style: const TextStyle(fontSize: 24)),
|
||||
const SizedBox(
|
||||
height: 40.0,
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
destinationController.skip_gps = false;
|
||||
},
|
||||
child: const Text("Back"),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text("You have not started rogaining yet.".tr,
|
||||
style: const TextStyle(fontSize: 24)),
|
||||
const SizedBox(
|
||||
height: 40.0,
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
destinationController.skipGps = false;
|
||||
},
|
||||
child: const Text("Back"),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
@ -404,7 +400,7 @@ class BuyPointCamera extends StatelessWidget {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Obx(() => Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
@ -414,17 +410,17 @@ class BuyPointCamera extends StatelessWidget {
|
||||
child: destinationController.photos.isNotEmpty
|
||||
? const Text("再撮影")
|
||||
: const Text("撮影")),
|
||||
const SizedBox(width: 10,),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
await destinationController.cancelBuyPoint(
|
||||
destination);
|
||||
Get.back();
|
||||
destinationController.rogaining_counted.value =
|
||||
true;
|
||||
destinationController.skip_gps = false;
|
||||
destinationController.is_photo_shoot.value =
|
||||
false;
|
||||
await destinationController
|
||||
.cancelBuyPoint(destination);
|
||||
Get.back();
|
||||
destinationController.rogainingCounted.value = true;
|
||||
destinationController.skipGps = false;
|
||||
destinationController.isPhotoShoot.value = false;
|
||||
},
|
||||
child: const Text("買い物なし"))
|
||||
],
|
||||
@ -449,11 +445,10 @@ class BuyPointCamera extends StatelessWidget {
|
||||
destination,
|
||||
destinationController.photos[0].path);
|
||||
Get.back();
|
||||
destinationController.rogaining_counted.value =
|
||||
destinationController.rogainingCounted.value =
|
||||
true;
|
||||
destinationController.skip_gps = false;
|
||||
destinationController.is_photo_shoot.value =
|
||||
false;
|
||||
destinationController.skipGps = false;
|
||||
destinationController.isPhotoShoot.value = false;
|
||||
Get.snackbar("お買い物加点を行いました",
|
||||
"${destination.sub_loc_id} : ${destination.name}");
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user