updated camera back button and text

This commit is contained in:
Mohamed Nouffer
2023-01-26 23:30:48 +05:30
parent 03b586651d
commit 65dc5309d6
4 changed files with 24 additions and 4 deletions

View File

@ -1,3 +1,5 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
@ -10,6 +12,8 @@ class CameraPage extends StatelessWidget {
DestinationController destinationController = Get.find<DestinationController>();
IndexController indexController = Get.find<IndexController>();
Timer? timer;
ImageProvider getFinishImage(){
if(destinationController.photos.isNotEmpty){
return FileImage(destinationController.photos[0]);
@ -73,11 +77,13 @@ class CameraPage extends StatelessWidget {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
ElevatedButton(
Obx(() =>
ElevatedButton(
onPressed: (){
destinationController.openCamera(context);
},
child: Text("撮影")
child: destinationController.photos.length > 0 ? Text("再撮影") : Text("撮影")
)
),
Obx(() =>
destinationController.photos.isNotEmpty ?
@ -129,6 +135,17 @@ class CameraPage extends StatelessWidget {
AppBar(
title: Text("finishing_rogaining".tr)
,
leading: IconButton(
icon: Text("cancel".tr),
onPressed: (){
Navigator.of(context).pop();
destinationController.skip_10s = true;
timer = Timer.periodic(Duration(seconds: 10), (Timer t){
destinationController.skip_10s = false;
});
},
),
centerTitle: true,
)
:
AppBar(

View File

@ -42,6 +42,8 @@ class DestinationController extends GetxController {
double current_lat = 0.0;
double current_lon = 0.0;
bool skip_10s = false;
List<Destination> currentSelectedDestinations = <Destination>[].obs;
var is_in_checkin = false.obs;
@ -254,7 +256,7 @@ class DestinationController extends GetxController {
print("--- at goal ${is_at_goal} ---");
print("--- rog counted ${rogaining_counted} ---");
print("--- loc already checked in ${location_already_checked_in} ---");
if(isUser_logged_in && d.cp == -1 && location_already_checked_in){
if(isUser_logged_in && d.cp == -1 && location_already_checked_in && skip_10s == false){
//check for rogaining
if(is_at_goal.value == false && rogaining_counted.value){
//goal