image chekin
This commit is contained in:
@ -53,12 +53,12 @@ class CameraPage extends StatelessWidget {
|
|||||||
if(value['status'] == 'OK'){
|
if(value['status'] == 'OK'){
|
||||||
Get.back();
|
Get.back();
|
||||||
destinationController.skip_gps = false;
|
destinationController.skip_gps = false;
|
||||||
Get.snackbar("goal_saved", "goal_added_successfuly");
|
Get.snackbar("目標が保存されました", "目標が正常に追加されました");
|
||||||
destinationController.resetRogaining();
|
destinationController.resetRogaining();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
print("---- status ${value['status']} ---- ");
|
print("---- status ${value['status']} ---- ");
|
||||||
Get.snackbar("goal_not_added", "please_try_again");
|
Get.snackbar("目標が追加されていません", "please_try_again");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -77,7 +77,7 @@ class CameraPage extends StatelessWidget {
|
|||||||
onPressed: (){
|
onPressed: (){
|
||||||
destinationController.openCamera(context);
|
destinationController.openCamera(context);
|
||||||
},
|
},
|
||||||
child: Text("take checkin photo".tr)
|
child: Text("再撮影")
|
||||||
),
|
),
|
||||||
Obx(() =>
|
Obx(() =>
|
||||||
destinationController.photos.isNotEmpty ?
|
destinationController.photos.isNotEmpty ?
|
||||||
@ -86,18 +86,13 @@ class CameraPage extends StatelessWidget {
|
|||||||
primary: Colors.red
|
primary: Colors.red
|
||||||
),
|
),
|
||||||
onPressed: (){
|
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);
|
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;
|
||||||
|
Get.snackbar("チェックインした", "正常にチェックインしました");
|
||||||
|
|
||||||
// ExternalService().makeGoal(user_id, _token, _team, destinationController.photos[0].path, formattedDate, _event_code).then((value){
|
// ExternalService().makeGoal(user_id, _token, _team, destinationController.photos[0].path, formattedDate, _event_code).then((value){
|
||||||
// print("---called ext api ${value['status']} ------");
|
// print("---called ext api ${value['status']} ------");
|
||||||
@ -112,7 +107,7 @@ class CameraPage extends StatelessWidget {
|
|||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
},
|
},
|
||||||
child: Text("Check In".tr)
|
child: Text("チェックイン")
|
||||||
):
|
):
|
||||||
Container()
|
Container()
|
||||||
)
|
)
|
||||||
@ -129,8 +124,15 @@ class CameraPage extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if(destinationController.is_in_rog.value){
|
if(destinationController.is_in_rog.value){
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar:
|
||||||
title: Text("finishing_rogaining".tr),
|
destinationController.is_in_rog.value && destinationController.rogaining_counted.value == true ?
|
||||||
|
AppBar(
|
||||||
|
title: Text("finishing_rogaining".tr)
|
||||||
|
,
|
||||||
|
)
|
||||||
|
:
|
||||||
|
AppBar(
|
||||||
|
title: Text("チェックポイント"),
|
||||||
),
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:geojson/geojson.dart';
|
import 'package:geojson/geojson.dart';
|
||||||
import 'package:geolocator/geolocator.dart';
|
import 'package:geolocator/geolocator.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
import 'package:latlong2/latlong.dart';
|
import 'package:latlong2/latlong.dart';
|
||||||
import 'package:rogapp/model/Rogaining.dart';
|
import 'package:rogapp/model/Rogaining.dart';
|
||||||
import 'package:rogapp/model/destination.dart';
|
import 'package:rogapp/model/destination.dart';
|
||||||
@ -26,6 +27,7 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||||
import 'package:sqflite/sqlite_api.dart';
|
import 'package:sqflite/sqlite_api.dart';
|
||||||
|
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
|
||||||
|
|
||||||
class DestinationController extends GetxController {
|
class DestinationController extends GetxController {
|
||||||
|
|
||||||
@ -42,6 +44,7 @@ class DestinationController extends GetxController {
|
|||||||
var is_in_rog = false.obs;
|
var is_in_rog = false.obs;
|
||||||
var is_at_start = false.obs;
|
var is_at_start = false.obs;
|
||||||
var is_at_goal = false.obs;
|
var is_at_goal = false.obs;
|
||||||
|
var is_photo_shoot = false.obs;
|
||||||
//List<Rogaining> rogainings = <Rogaining>[].obs;
|
//List<Rogaining> rogainings = <Rogaining>[].obs;
|
||||||
|
|
||||||
bool checking_in = false;
|
bool checking_in = false;
|
||||||
@ -139,6 +142,17 @@ class DestinationController extends GetxController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(is_photo_shoot.value == true){
|
||||||
|
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
|
||||||
|
builder:((context) => CameraPage())
|
||||||
|
).whenComplete((){
|
||||||
|
skip_gps = false;
|
||||||
|
chekcs = 0;
|
||||||
|
is_in_checkin.value = false;
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
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!);
|
||||||
if(ds.isEmpty){
|
if(ds.isEmpty){
|
||||||
@ -159,7 +173,7 @@ class DestinationController extends GetxController {
|
|||||||
is_in_checkin.value = false;
|
is_in_checkin.value = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if(is_in_rog.value == false)
|
else if(is_in_rog.value == true)
|
||||||
{
|
{
|
||||||
print("----- in location popup checkin cp - ${d.cp}----");
|
print("----- in location popup checkin cp - ${d.cp}----");
|
||||||
chekcs = 2;
|
chekcs = 2;
|
||||||
@ -176,10 +190,10 @@ class DestinationController extends GetxController {
|
|||||||
|
|
||||||
print("---- location checkin radious ${d.checkin_radious} ----");
|
print("---- location checkin radious ${d.checkin_radious} ----");
|
||||||
print("---- already checked in ${location_already_checked_in} ----");
|
print("---- already checked in ${location_already_checked_in} ----");
|
||||||
if(checkin_radious >= distance && location_already_checked_in == false){
|
if(checkin_radious >= distance && location_already_checked_in == false && is_in_rog.value == true){
|
||||||
if(auto_checkin){
|
if(auto_checkin){
|
||||||
if(!checking_in){
|
if(!checking_in){
|
||||||
makeCheckin(d, true);
|
makeCheckin(d, true,"");
|
||||||
if(d.cp != -1){
|
if(d.cp != -1){
|
||||||
rogaining_counted.value =true;
|
rogaining_counted.value =true;
|
||||||
}
|
}
|
||||||
@ -190,26 +204,36 @@ class DestinationController extends GetxController {
|
|||||||
print("--- hidden loc ${d.hidden_location} ----");
|
print("--- hidden loc ${d.hidden_location} ----");
|
||||||
// ask for checkin
|
// ask for checkin
|
||||||
if(d.hidden_location != null && d.hidden_location == 0 && 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;
|
// chekcs = 3;
|
||||||
is_in_checkin.value = true;
|
// is_in_checkin.value = true;
|
||||||
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
|
// showModalBottomSheet(context: Get.context!, isScrollControlled: true,
|
||||||
builder:((context) => CameraPage())
|
// builder:((context) => CameraPage())
|
||||||
).whenComplete((){
|
// ).whenComplete((){
|
||||||
skip_gps = false;
|
// skip_gps = false;
|
||||||
chekcs = 0;
|
// chekcs = 0;
|
||||||
is_in_checkin.value = false;
|
// is_in_checkin.value = false;
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
else if(is_in_rog.value == true && d.cp != -1){
|
else if(is_in_rog.value == true && d.cp != -1){
|
||||||
chekcs = 4;
|
chekcs = 4;
|
||||||
is_in_checkin.value = true;
|
is_in_checkin.value = true;
|
||||||
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
|
showMaterialModalBottomSheet(
|
||||||
builder:((context) => BottomSheetNew())
|
expand: true,
|
||||||
).whenComplete((){
|
context: Get.context!,
|
||||||
skip_gps = false;
|
backgroundColor: Colors.transparent,
|
||||||
chekcs = 0;
|
builder: (context) => BottomSheetNew()
|
||||||
is_in_checkin.value = false;
|
).whenComplete(() {
|
||||||
});
|
skip_gps = false;
|
||||||
|
chekcs = 0;
|
||||||
|
is_in_checkin.value = false;
|
||||||
|
});
|
||||||
|
// showModalBottomSheet(context: Get.context!, isScrollControlled: true,
|
||||||
|
// builder:((context) => BottomSheetNew())
|
||||||
|
// ).whenComplete((){
|
||||||
|
// skip_gps = false;
|
||||||
|
// chekcs = 0;
|
||||||
|
// is_in_checkin.value = false;
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -349,6 +373,7 @@ class DestinationController extends GetxController {
|
|||||||
is_in_rog.value = false;
|
is_in_rog.value = false;
|
||||||
is_at_start.value = false;
|
is_at_start.value = false;
|
||||||
is_at_goal.value = false;
|
is_at_goal.value = false;
|
||||||
|
destinations.clear();
|
||||||
|
|
||||||
_start = 0;
|
_start = 0;
|
||||||
chekcs = 0;
|
chekcs = 0;
|
||||||
@ -448,7 +473,7 @@ class DestinationController extends GetxController {
|
|||||||
if(d.isEmpty){
|
if(d.isEmpty){
|
||||||
Destination df = festuretoDestination(indexController.currentFeature[0]);
|
Destination df = festuretoDestination(indexController.currentFeature[0]);
|
||||||
print("--- made checkin ${df.location_id} ----");
|
print("--- made checkin ${df.location_id} ----");
|
||||||
makeCheckin(df, true);
|
makeCheckin(df, true, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
Rogaining rog = Rogaining(
|
Rogaining rog = Rogaining(
|
||||||
@ -466,8 +491,8 @@ class DestinationController extends GetxController {
|
|||||||
is_in_rog.value = true;
|
is_in_rog.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void makeCheckin(Destination destination, bool action, {String imageurl = ""}) async {
|
void makeCheckin(Destination destination, bool action, String imageurl) async {
|
||||||
// print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${action}@@@@@@@@@@@");
|
//print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${action}@@@@@@@@@@@");
|
||||||
DatabaseHelper db = DatabaseHelper.instance;
|
DatabaseHelper db = DatabaseHelper.instance;
|
||||||
List<Destination> ddd = await db.getDestinationByLatLon(destination.lat!, destination.lon!);
|
List<Destination> ddd = await db.getDestinationByLatLon(destination.lat!, destination.lon!);
|
||||||
|
|
||||||
@ -475,18 +500,30 @@ class DestinationController extends GetxController {
|
|||||||
destination.checkedin = true;
|
destination.checkedin = true;
|
||||||
await db.insertDestination(destination);
|
await db.insertDestination(destination);
|
||||||
}
|
}
|
||||||
//int res = await db.updateAction(destination, action);
|
|
||||||
|
|
||||||
PopulateDestinations();
|
PopulateDestinations();
|
||||||
|
|
||||||
/// post to NATNAT
|
/// post to NATNAT
|
||||||
if(indexController.currentUser.length > 0){
|
if(indexController.currentUser.length > 0){
|
||||||
int cp_num = int.parse(destination.cp!.toString());
|
double cp_num = destination.cp!;
|
||||||
String _team = indexController.currentUser[0]["user"]["team_name"];
|
|
||||||
|
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"];
|
String _event_code = indexController.currentUser[0]["user"]["event_code"];
|
||||||
ExternalService().makeCheckpoint(_team, cp_num, _event_code, imageurl).then((value){
|
//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);
|
||||||
|
|
||||||
|
print("------ checkin event ${_event_code} ------");
|
||||||
|
ExternalService().makeCheckpoint(user_id, _token, formattedDate, _team,cp_num.round(), _event_code, imageurl).then((value){
|
||||||
print("------Ext service check point ${value} ------");
|
print("------Ext service check point ${value} ------");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
import 'package:get/get.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import '../utils/const.dart';
|
import '../utils/const.dart';
|
||||||
@ -15,8 +15,17 @@ class ExternalService {
|
|||||||
|
|
||||||
ExternalService._internal();
|
ExternalService._internal();
|
||||||
|
|
||||||
Future<Map<String, dynamic>> StartRogaining(String teamname, String eventcode) async {
|
Future<Map<String, dynamic>> StartRogaining() async {
|
||||||
Map<String, dynamic> _res = {};
|
Map<String, dynamic> _res = {};
|
||||||
|
|
||||||
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
|
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"];
|
||||||
|
|
||||||
String url = 'https://natnats.mobilous.com/start_from_rogapp';
|
String url = 'https://natnats.mobilous.com/start_from_rogapp';
|
||||||
//print('---- toekn is ${token} -----');
|
//print('---- toekn is ${token} -----');
|
||||||
final http.Response response = await http.post(
|
final http.Response response = await http.post(
|
||||||
@ -25,11 +34,13 @@ class ExternalService {
|
|||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
},
|
},
|
||||||
body: jsonEncode(<String, String>{
|
body: jsonEncode(<String, String>{
|
||||||
'team_name': teamname,
|
'team_name': _team,
|
||||||
'event_code': eventcode
|
'event_code': _event_code
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
print("---- start rogianing api status ---- ${response.statusCode}");
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
_res = json.decode(utf8.decode(response.bodyBytes));
|
_res = json.decode(utf8.decode(response.bodyBytes));
|
||||||
print('----_res : ${_res} ----');
|
print('----_res : ${_res} ----');
|
||||||
@ -37,29 +48,80 @@ class ExternalService {
|
|||||||
return _res;
|
return _res;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, dynamic>> makeCheckpoint(String teamname, int cp, String eventcode, String imageurl) async {
|
Future<Map<String, dynamic>> makeCheckpoint(int user_id, String token, String checkin_time, String teamname, int cp, String eventcode, String imageurl) async {
|
||||||
Map<String, dynamic> _res = {};
|
Map<String, dynamic> _res = {};
|
||||||
String url = 'https://natnats.mobilous.com/checkin_from_rogapp';
|
String url = 'https://natnats.mobilous.com/checkin_from_rogapp';
|
||||||
//print('---- toekn is ${token} -----');
|
|
||||||
final http.Response response = await http.post(
|
|
||||||
Uri.parse(url),
|
|
||||||
headers: <String, String>{
|
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
|
||||||
},
|
|
||||||
body: jsonEncode(<String, String>{
|
|
||||||
'team_name': teamname,
|
|
||||||
'cp_number': cp.toString(),
|
|
||||||
'event_code': eventcode,
|
|
||||||
'image': imageurl
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if(imageurl != null){
|
||||||
|
String server_url = ConstValues.currentServer();
|
||||||
|
String url1 = "${server_url}/api/checkinimage/";
|
||||||
|
final im1Bytes = File(imageurl!).readAsBytesSync();
|
||||||
|
String im1_64 = base64Encode(im1Bytes);
|
||||||
|
|
||||||
|
final http.Response response = await http.post(
|
||||||
|
Uri.parse(url1),
|
||||||
|
headers: <String, String>{
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
'Authorization': 'Token ${token}'
|
||||||
|
},
|
||||||
|
// 'id', 'user', 'goalimage', 'goaltime', 'team_name', 'event_code','cp_number'
|
||||||
|
body: jsonEncode(<String, String>{
|
||||||
|
'user' : user_id.toString(),
|
||||||
|
'team_name': teamname,
|
||||||
|
'event_code': eventcode,
|
||||||
|
'checkinimage' : im1_64,
|
||||||
|
'checkintime' : checkin_time,
|
||||||
|
'cp_number' : cp.toString()
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
_res = json.decode(utf8.decode(response.bodyBytes));
|
_res = json.decode(utf8.decode(response.bodyBytes));
|
||||||
print('----_res : ${_res} ----');
|
|
||||||
|
print("-----@@@@@ ${_res} -----");
|
||||||
|
|
||||||
|
if(response.statusCode == 201){
|
||||||
|
//print('---- toekn is ${token} -----');
|
||||||
|
final http.Response response2 = await http.post(
|
||||||
|
Uri.parse(url),
|
||||||
|
headers: <String, String>{
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
},
|
||||||
|
body: jsonEncode(<String, String>{
|
||||||
|
'team_name': teamname,
|
||||||
|
'cp_number': cp.toString(),
|
||||||
|
'event_code': eventcode,
|
||||||
|
'image': _res["checkinimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net')
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
print("--- checnin response ${response2.statusCode}----");
|
||||||
|
if (response2.statusCode == 200) {
|
||||||
|
_res = json.decode(utf8.decode(response2.bodyBytes));
|
||||||
|
print('----checkin res _res : ${_res} ----');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
final http.Response response3 = await http.post(
|
||||||
|
Uri.parse(url),
|
||||||
|
headers: <String, String>{
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
},
|
||||||
|
body: jsonEncode(<String, String>{
|
||||||
|
'team_name': teamname,
|
||||||
|
'cp_number': cp.toString(),
|
||||||
|
'event_code': eventcode,
|
||||||
|
'image': ""
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
print("--- checnin response ${response3.statusCode}----");
|
||||||
|
if (response3.statusCode == 200) {
|
||||||
|
_res = json.decode(utf8.decode(response3.bodyBytes));
|
||||||
|
print('----checkin res _res : ${_res} ----');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return _res;
|
return _res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Future<Map<String, dynamic>> makeGoal(int user_id, String token, String teamname, String image, String goal_time, String eventcode) async {
|
Future<Map<String, dynamic>> makeGoal(int user_id, String token, String teamname, String image, String goal_time, String eventcode) async {
|
||||||
Map<String, dynamic> _res2 = {};
|
Map<String, dynamic> _res2 = {};
|
||||||
@ -86,7 +148,7 @@ class ExternalService {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
String url = 'https://natnats.mobilous.com/start_from_rogapp';
|
String url = 'https://natnats.mobilous.com/goal_from_rogapp';
|
||||||
//print("---response is : ${response.statusCode}----");
|
//print("---response is : ${response.statusCode}----");
|
||||||
if (response.statusCode == 201) {
|
if (response.statusCode == 201) {
|
||||||
Map<String, dynamic> _res = json.decode(utf8.decode(response.bodyBytes));
|
Map<String, dynamic> _res = json.decode(utf8.decode(response.bodyBytes));
|
||||||
@ -101,7 +163,7 @@ class ExternalService {
|
|||||||
'team_name': teamname,
|
'team_name': teamname,
|
||||||
'event_code': eventcode,
|
'event_code': eventcode,
|
||||||
'goal_time' : goal_time,
|
'goal_time' : goal_time,
|
||||||
'image' : _res["goalimage"]
|
'image' : _res["goalimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net')
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -5,10 +5,13 @@ import 'package:get/get.dart';
|
|||||||
import 'package:get/get_state_manager/get_state_manager.dart';
|
import 'package:get/get_state_manager/get_state_manager.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
import 'package:latlong2/latlong.dart';
|
import 'package:latlong2/latlong.dart';
|
||||||
|
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
|
||||||
import 'package:rogapp/model/destination.dart';
|
import 'package:rogapp/model/destination.dart';
|
||||||
|
import 'package:rogapp/pages/camera/camera_page.dart';
|
||||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
import 'package:rogapp/routes/app_pages.dart';
|
import 'package:rogapp/routes/app_pages.dart';
|
||||||
|
import 'package:rogapp/services/external_service.dart';
|
||||||
import 'package:rogapp/utils/const.dart';
|
import 'package:rogapp/utils/const.dart';
|
||||||
import 'package:rogapp/utils/database_helper.dart';
|
import 'package:rogapp/utils/database_helper.dart';
|
||||||
import 'package:rogapp/utils/text_util.dart';
|
import 'package:rogapp/utils/text_util.dart';
|
||||||
@ -173,21 +176,47 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: (){
|
onPressed: (){
|
||||||
if(indexController.currentDestinationFeature[0].checkedin == null || indexController.currentDestinationFeature[0].checkedin == false){
|
if(indexController.currentDestinationFeature[0].checkedin == null || indexController.currentDestinationFeature[0].checkedin == false){
|
||||||
destinationController.makeCheckin(indexController.currentDestinationFeature[0], true);
|
if(indexController.currentDestinationFeature[0].hidden_location == 0){
|
||||||
if(indexController.currentDestinationFeature[0].cp != -1){
|
destinationController.skip_gps = false;
|
||||||
destinationController.rogaining_counted.value =true;
|
destinationController.is_photo_shoot.value = true;
|
||||||
|
Get.back();
|
||||||
|
|
||||||
|
// showMaterialModalBottomSheet(
|
||||||
|
// expand: true,
|
||||||
|
// context: Get.context!,
|
||||||
|
// backgroundColor: Colors.transparent,
|
||||||
|
// builder: (context) => BottomSheetNew()
|
||||||
|
// ).whenComplete(() {
|
||||||
|
// });
|
||||||
|
|
||||||
|
// showModalBottomSheet(context: Get.context!, isScrollControlled: true,
|
||||||
|
// //builder:((context) => CameraPage())
|
||||||
|
// builder:((context) => Container(child: Text("model"),))
|
||||||
|
// ).whenComplete((){
|
||||||
|
// // destinationController.makeCheckin(indexController.currentDestinationFeature[0], true);
|
||||||
|
// // if(indexController.currentDestinationFeature[0].cp != -1){
|
||||||
|
// // destinationController.rogaining_counted.value =true;
|
||||||
|
// // }
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
destinationController.makeCheckin(indexController.currentDestinationFeature[0], true, "");
|
||||||
|
if(indexController.currentDestinationFeature[0].cp != -1){
|
||||||
|
destinationController.rogaining_counted.value =true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
destinationController.makeCheckin(indexController.currentDestinationFeature[0], false);
|
destinationController.makeCheckin(indexController.currentDestinationFeature[0], false, "");
|
||||||
}
|
}
|
||||||
Get.back();
|
//Get.back();
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
indexController.currentDestinationFeature[0].checkedin == null || indexController.currentDestinationFeature[0].checkedin == false ?
|
indexController.currentDestinationFeature[0].checkedin == null || indexController.currentDestinationFeature[0].checkedin == false ?
|
||||||
"Chekin"
|
"チェックイン"
|
||||||
:
|
:
|
||||||
"Checkput"
|
"チェックアウト"
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -201,13 +230,13 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
onPressed: (){
|
onPressed: (){
|
||||||
destinationController.is_in_rog.value = true;
|
destinationController.is_in_rog.value = true;
|
||||||
destinationController.addToRogaining(destinationController.current_lat, destinationController.current_lon, indexController.currentDestinationFeature[0].location_id!);
|
destinationController.addToRogaining(destinationController.current_lat, destinationController.current_lon, indexController.currentDestinationFeature[0].location_id!);
|
||||||
Get.back();
|
ExternalService().StartRogaining().then((value) => Get.back());
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
indexController.currentDestinationFeature[0].checkedin != null || indexController.currentDestinationFeature[0].checkedin == true ?
|
indexController.currentDestinationFeature[0].checkedin != null || indexController.currentDestinationFeature[0].checkedin == true ?
|
||||||
"Start Rogaining"
|
"ロゲイニングを開始"
|
||||||
:
|
:
|
||||||
"Wrong destination ..."
|
"間違った目的地..."
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
@ -223,9 +252,9 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
indexController.currentDestinationFeature[0].checkedin != null || indexController.currentDestinationFeature[0].checkedin == true ?
|
indexController.currentDestinationFeature[0].checkedin != null || indexController.currentDestinationFeature[0].checkedin == true ?
|
||||||
"Finish Rogaining"
|
"ロゲイニングを終える"
|
||||||
:
|
:
|
||||||
"Wrong destination ..."
|
"間違った目的地 ..."
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
@ -350,21 +379,21 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: (){
|
onPressed: (){
|
||||||
if(indexController.currentDestinationFeature[0].checkedin == null || indexController.currentDestinationFeature[0].checkedin == false){
|
if(indexController.currentDestinationFeature[0].checkedin == null || indexController.currentDestinationFeature[0].checkedin == false){
|
||||||
destinationController.makeCheckin(indexController.currentDestinationFeature[0], true);
|
destinationController.makeCheckin(indexController.currentDestinationFeature[0], true, "");
|
||||||
if(indexController.currentDestinationFeature[0].cp != -1){
|
if(indexController.currentDestinationFeature[0].cp != -1){
|
||||||
destinationController.rogaining_counted.value =true;
|
destinationController.rogaining_counted.value =true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
destinationController.makeCheckin(indexController.currentDestinationFeature[0], false);
|
destinationController.makeCheckin(indexController.currentDestinationFeature[0], false, "");
|
||||||
}
|
}
|
||||||
Get.back();
|
Get.back();
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
indexController.currentDestinationFeature[0].checkedin == null || indexController.currentDestinationFeature[0].checkedin == false ?
|
indexController.currentDestinationFeature[0].checkedin == null || indexController.currentDestinationFeature[0].checkedin == false ?
|
||||||
"Chekin"
|
"チェックイン"
|
||||||
:
|
:
|
||||||
"Checkput"
|
"チェックアウト"
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -604,13 +633,13 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
//print("------ curent destination is ${dest!.checkedIn}-------");
|
//print("------ curent destination is ${dest!.checkedIn}-------");
|
||||||
if(dest != null){
|
if(dest != null){
|
||||||
//print("------ curent destination is ${dest!.checkedin}-------::::::::::");
|
//print("------ curent destination is ${dest!.checkedin}-------::::::::::");
|
||||||
destinationController.makeCheckin(dest, !dest.checkedin!);
|
destinationController.makeCheckin(dest, !dest.checkedin!, "");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: indexController.currentDestinationFeature[0].checkedin == false ?
|
child: indexController.currentDestinationFeature[0].checkedin == false ?
|
||||||
Text("Check in")
|
Text("チェックイン")
|
||||||
:
|
:
|
||||||
Text("Check out")
|
Text("チェックアウト")
|
||||||
):
|
):
|
||||||
Container()
|
Container()
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:rogapp/model/destination.dart';
|
import 'package:rogapp/model/destination.dart';
|
||||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
|
import 'package:rogapp/utils/const.dart';
|
||||||
import 'package:rogapp/utils/database_helper.dart';
|
import 'package:rogapp/utils/database_helper.dart';
|
||||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||||
@ -35,8 +36,9 @@ class DestinationWidget extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
String server_url = ConstValues.currentServer();
|
||||||
return Image(image: NetworkImage(
|
return Image(image: NetworkImage(
|
||||||
'http://container.intranet.sumasen.net:8100/media/' + destinationController.destinations[index].photos!),
|
'${server_url}/media/' + destinationController.destinations[index].photos!),
|
||||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||||
return Image.asset("assets/images/empty_image.png");
|
return Image.asset("assets/images/empty_image.png");
|
||||||
},
|
},
|
||||||
|
|||||||
@ -562,6 +562,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.0.0"
|
||||||
|
modal_bottom_sheet:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: modal_bottom_sheet
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.2"
|
||||||
path:
|
path:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@ -71,6 +71,7 @@ dependencies:
|
|||||||
circular_menu: ^2.0.1
|
circular_menu: ^2.0.1
|
||||||
camera_camera: ^3.0.0-dev
|
camera_camera: ^3.0.0-dev
|
||||||
intl: ^0.17.0
|
intl: ^0.17.0
|
||||||
|
modal_bottom_sheet: ^2.1.2
|
||||||
|
|
||||||
flutter_icons:
|
flutter_icons:
|
||||||
android: true
|
android: true
|
||||||
|
|||||||
Reference in New Issue
Block a user