This commit is contained in:
Mohamed Nouffer
2022-11-04 14:11:18 +05:30
parent 9987b243f7
commit d2517cd0bf
3 changed files with 96 additions and 17 deletions

View File

@ -70,11 +70,53 @@ class CameraPage extends StatelessWidget {
);
}
else{
return ElevatedButton(
child: Text("Checking image"),
return Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
ElevatedButton(
onPressed: (){
Get.back();
destinationController.openCamera(context);
},
child: Text("take checkin photo".tr)
),
Obx(() =>
destinationController.photos.isNotEmpty ?
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.red
),
onPressed: (){
int user_id = indexController.currentUser[0]["user"]["id"];
//print("--- Pressed -----");
String _team = indexController.currentUser[0]["user"]['team_name'];
//print("--- _team : ${_team}-----");
String _event_code = indexController.currentUser[0]["user"]["event_code"];
//print("--- _event_code : ${_event_code}-----");
String _token = indexController.currentUser[0]["token"];
//print("--- _token : ${_token}-----");
DateTime now = DateTime.now();
String formattedDate = DateFormat('yyyy-MM-dd HH:mm:ss').format(now);
destinationController.makeCheckin(indexController.currentDestinationFeature[0], true);
// ExternalService().makeGoal(user_id, _token, _team, destinationController.photos[0].path, formattedDate, _event_code).then((value){
// print("---called ext api ${value['status']} ------");
// if(value['status'] == 'OK'){
// Get.back();
// destinationController.skip_gps = false;
// Get.snackbar("Checked in", "Checked in successfuly");
// }
// else{
// print("---- status ${value['status']} ---- ");
// Get.snackbar("Checkin not added", "please_try_again");
// }
// });
},
child: Text("Check In".tr)
):
Container()
)
],
);
}
}
@ -85,7 +127,7 @@ class CameraPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
if(destinationController.is_at_goal.value){
if(destinationController.is_in_rog.value){
return Scaffold(
appBar: AppBar(
title: Text("finishing_rogaining".tr),
@ -116,9 +158,6 @@ class CameraPage extends StatelessWidget {
),
);
}
else if(destinationController.rogaining_counted.value == true) {
return NotAtGoal();
}
else {
return StartRogaining();
}

View File

@ -148,6 +148,7 @@ class DestinationController extends GetxController {
//start
print("---- in start -----");
chekcs = 1;
is_in_checkin.value = true;
is_at_start.value = true;
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
builder:((context) => BottomSheetNew())
@ -155,13 +156,14 @@ class DestinationController extends GetxController {
skip_gps = false;
chekcs = 0;
is_at_start.value = false;
is_in_checkin.value = false;
});
}
else
else if(is_in_rog.value == false)
{
print("----- in location popup checkin cp - ${d.cp}----");
chekcs = 2;
//is_in_checkin.value = true;
is_in_checkin.value = true;
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
builder:((context) => BottomSheetNew())
).whenComplete((){
@ -185,8 +187,9 @@ class DestinationController extends GetxController {
}
}
else{
print("--- hidden loc ${d.hidden_location} ----");
// ask for checkin
if(d.hidden_location != null && d.hidden_location ==true && is_in_rog.value == true && d.cp != -1){
if(d.hidden_location != null && d.hidden_location == 0 && is_in_rog.value == true && d.cp != -1){
chekcs = 3;
is_in_checkin.value = true;
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
@ -217,7 +220,7 @@ class DestinationController extends GetxController {
print("--- loc already checked in ${location_already_checked_in} ---");
if(isUser_logged_in && d.cp == -1 && location_already_checked_in){
//check for rogaining
if(is_at_goal.value == false && rogaining_counted.value){
if(is_at_goal.value == false && rogaining_counted.value && indexController.rog_mode == 1){
//goal
print("---- in goal -----");
chekcs = 5;
@ -230,7 +233,7 @@ class DestinationController extends GetxController {
is_at_goal.value = false;
});
}
else if(is_in_rog.value == false){
else if(is_in_rog.value == false && indexController.rog_mode == 1){
//start
print("---- in start -----");
chekcs = 6;

View File

@ -167,7 +167,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Obx(() =>
indexController.currentDestinationFeature.isNotEmpty && destinationController.is_in_checkin.value == true ?
indexController.currentDestinationFeature.isNotEmpty && destinationController.is_in_checkin.value == true && destinationController.is_at_start.value == false ?
Row(
children: [
ElevatedButton(
@ -340,12 +340,49 @@ class BottomSheetNew extends GetView<BottomSheetController> {
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Obx(() =>
indexController.currentDestinationFeature.isNotEmpty && destinationController.is_in_checkin.value == true ?
Row(
children: [
ElevatedButton(
onPressed: (){
if(indexController.currentDestinationFeature[0].checkedin == null || indexController.currentDestinationFeature[0].checkedin == false){
destinationController.makeCheckin(indexController.currentDestinationFeature[0], true);
if(indexController.currentDestinationFeature[0].cp != -1){
destinationController.rogaining_counted.value =true;
}
}
else{
destinationController.makeCheckin(indexController.currentDestinationFeature[0], false);
}
Get.back();
},
child: Text(
indexController.currentDestinationFeature[0].checkedin == null || indexController.currentDestinationFeature[0].checkedin == false ?
"Chekin"
:
"Checkput"
)
),
],
)
:
Container(),
),
],
),
Row(
children: [
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
indexController.currentDestinationFeature.isNotEmpty && destinationController.is_in_checkin.value == true ?
Container()
:
FutureBuilder<Widget>(
future: wantToGo(context),
builder: (context, snapshot) {