update to external apis
This commit is contained in:
@ -1,10 +1,14 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/services/external_service.dart';
|
||||
|
||||
class CameraPage extends StatelessWidget {
|
||||
CameraPage({Key? key}) : super(key: key);
|
||||
DestinationController destinationController = Get.find<DestinationController>();
|
||||
IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
ImageProvider getFinishImage(){
|
||||
if(destinationController.photos.isNotEmpty){
|
||||
@ -62,7 +66,27 @@ class CameraPage extends StatelessWidget {
|
||||
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);
|
||||
|
||||
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();
|
||||
Get.snackbar("goal_saved", "goal_added_successfuly");
|
||||
}
|
||||
else{
|
||||
Get.snackbar("goal_not_added", "please_try_again");
|
||||
}
|
||||
});
|
||||
},
|
||||
child: Text("finish_goal".tr)
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user