update to add resume app from sleep
This commit is contained in:
@ -1,15 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_map/plugin_api.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_state_manager/get_state_manager.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:modal_bottom_sheet/modal_bottom_sheet.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/index/index_controller.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
@ -28,11 +22,11 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
|
||||
Image getImage(){
|
||||
|
||||
String server_url = ConstValues.currentServer();
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
if(indexController.rog_mode == 1){
|
||||
//print("----- rogaining mode 1");
|
||||
if(indexController.currentDestinationFeature.length <= 0 || indexController.currentDestinationFeature[0].photos! == ""){
|
||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
if(indexController.currentDestinationFeature.isEmpty || indexController.currentDestinationFeature[0].photos! == ""){
|
||||
return const Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
}
|
||||
else{
|
||||
//print("@@@@@@@@@@@@@ rog mode -------------------- ${indexController.currentDestinationFeature[0].photos} @@@@@@@@@@@");
|
||||
@ -48,7 +42,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
}
|
||||
else {
|
||||
return Image(image: NetworkImage(
|
||||
'${server_url}/media/compressed/' + indexController.currentDestinationFeature[0].photos!,
|
||||
'$serverUrl/media/compressed/' + indexController.currentDestinationFeature[0].photos!,
|
||||
),
|
||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
return Image.asset("assets/images/empty_image.png");
|
||||
@ -59,11 +53,11 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
}
|
||||
else{
|
||||
GeoJsonFeature<dynamic> gf = indexController.currentFeature[0];
|
||||
if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){
|
||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
if(gf.properties!["photos"] == null || gf.properties!["photos"] == ""){
|
||||
return const Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
}
|
||||
else{
|
||||
String _photo = gf!.properties!["photos"];
|
||||
String _photo = gf.properties!["photos"];
|
||||
if(_photo.contains('http')){
|
||||
return Image(image: NetworkImage(
|
||||
gf.properties!["photos"],
|
||||
@ -75,7 +69,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
}
|
||||
else {
|
||||
return Image(image: NetworkImage(
|
||||
'${server_url}/media/compressed/' + gf.properties!["photos"],
|
||||
'$serverUrl/media/compressed/' + gf.properties!["photos"],
|
||||
),
|
||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
return Image.asset("assets/images/empty_image.png");
|
||||
@ -94,7 +88,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
|
||||
bool isInDestination(String locationid){
|
||||
int lid = int.parse(locationid);
|
||||
if(destinationController.destinations.where((element) => element.location_id == lid).length > 0){
|
||||
if(destinationController.destinations.where((element) => element.location_id == lid).isNotEmpty){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
@ -130,25 +124,25 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
},
|
||||
color: Colors.blue,
|
||||
textColor: Colors.white,
|
||||
child: Icon(
|
||||
child: const Icon(
|
||||
Icons.arrow_back_ios,
|
||||
size: 14,
|
||||
),
|
||||
padding: EdgeInsets.all(16),
|
||||
shape: CircleBorder(),
|
||||
padding: const EdgeInsets.all(16),
|
||||
shape: const CircleBorder(),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
child: Obx(() =>
|
||||
indexController.currentUser.length > 0 ?
|
||||
Text("${TextUtils.getDisplayText(indexController.currentDestinationFeature[0])} : ${TextUtils.getDisplayText(indexController.currentDestinationFeature[0])} : ${indexController.currentDestinationFeature[0].name!}", style: TextStyle(
|
||||
indexController.currentUser.isNotEmpty ?
|
||||
Text("${TextUtils.getDisplayText(indexController.currentDestinationFeature[0])} : ${TextUtils.getDisplayText(indexController.currentDestinationFeature[0])} : ${indexController.currentDestinationFeature[0].name!}", style: const TextStyle(
|
||||
fontSize: 15.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
)
|
||||
:
|
||||
Text("${indexController.currentDestinationFeature[0].name!}", style: TextStyle(
|
||||
Text(indexController.currentDestinationFeature[0].name!, style: const TextStyle(
|
||||
fontSize: 15.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@ -257,33 +251,33 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
indexController.currentDestinationFeature[0].address != null && indexController.currentDestinationFeature[0].address!.isNotEmpty ?
|
||||
getDetails(context, "address".tr, indexController.currentDestinationFeature[0].address! ?? '')
|
||||
:
|
||||
Container(width: 0.0, height: 0,),
|
||||
const SizedBox(width: 0.0, height: 0,),
|
||||
),
|
||||
Obx(() =>
|
||||
indexController.currentDestinationFeature[0].phone != null && indexController.currentDestinationFeature[0].phone!.isNotEmpty ?
|
||||
getDetails(context, "telephone".tr, indexController.currentDestinationFeature[0].phone! ?? '')
|
||||
:
|
||||
Container(width: 0.0, height: 0,),
|
||||
const SizedBox(width: 0.0, height: 0,),
|
||||
),
|
||||
Obx(() =>
|
||||
indexController.currentDestinationFeature[0].email != null && indexController.currentDestinationFeature[0].email!.isNotEmpty ?
|
||||
getDetails(context, "email".tr, indexController.currentDestinationFeature[0].email! ?? '')
|
||||
:
|
||||
Container(width: 0.0, height: 0,),
|
||||
const SizedBox(width: 0.0, height: 0,),
|
||||
),
|
||||
Obx(() =>
|
||||
indexController.currentDestinationFeature[0].webcontents != null && indexController.currentDestinationFeature[0].webcontents!.isNotEmpty ?
|
||||
getDetails(context, "web".tr, indexController.currentDestinationFeature[0].webcontents! ?? '', isurl: true)
|
||||
:
|
||||
Container(width: 0.0, height: 0,),
|
||||
const SizedBox(width: 0.0, height: 0,),
|
||||
),
|
||||
Obx(() =>
|
||||
indexController.currentDestinationFeature[0].videos != null && indexController.currentDestinationFeature[0].videos!.isNotEmpty ?
|
||||
getDetails(context, "video".tr, indexController.currentDestinationFeature[0].videos! ?? '', isurl: true)
|
||||
:
|
||||
Container(width: 0.0, height: 0,),
|
||||
const SizedBox(width: 0.0, height: 0,),
|
||||
),
|
||||
SizedBox(height: 20.0,),
|
||||
const SizedBox(height: 20.0,),
|
||||
// Obx(() =>
|
||||
// //wantToGo(context),
|
||||
|
||||
@ -297,7 +291,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
// ),
|
||||
|
||||
// ),
|
||||
SizedBox(height: 60.0,)
|
||||
const SizedBox(height: 60.0,)
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -321,19 +315,19 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
},
|
||||
color: Colors.blue,
|
||||
textColor: Colors.white,
|
||||
child: Icon(
|
||||
child: const Icon(
|
||||
Icons.arrow_back_ios,
|
||||
//Icons.arrow_back_ios,
|
||||
size: 14,
|
||||
),
|
||||
padding: EdgeInsets.all(16),
|
||||
shape: CircleBorder(),
|
||||
padding: const EdgeInsets.all(16),
|
||||
shape: const CircleBorder(),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
child: Obx(() =>
|
||||
Text(indexController.currentFeature[0].properties!["location_name"], style: TextStyle(
|
||||
Text(indexController.currentFeature[0].properties!["location_name"], style: const TextStyle(
|
||||
fontSize: 15.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@ -423,7 +417,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
indexController.currentFeature[0].properties!["location_name"] != null && (indexController.currentFeature[0].properties!["location_name"] as String).isNotEmpty ?
|
||||
Flexible(child: Text(indexController.currentFeature[0].properties!["location_name"]))
|
||||
:
|
||||
Container(width: 0.0, height: 0,),
|
||||
const SizedBox(width: 0.0, height: 0,),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -432,8 +426,8 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
Get.back();
|
||||
print("---- go to ----");
|
||||
GeoJsonFeature<GeoJsonMultiPoint> mp = indexController.currentFeature[0] as GeoJsonFeature<GeoJsonMultiPoint>;
|
||||
Position position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.lowest);
|
||||
print("------- position -------- ${position}");
|
||||
Position position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.lowest, forceAndroidLocationManager: true);
|
||||
print("------- position -------- $position");
|
||||
Destination ds = Destination(
|
||||
lat: position.latitude,
|
||||
lon: position.longitude
|
||||
@ -447,20 +441,20 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
|
||||
destinationController.destinationMatrixFromCurrentPoint([ds, tp]);
|
||||
},
|
||||
child:Text("ここへ行く")),
|
||||
child:const Text("ここへ行く")),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8.0,),
|
||||
const SizedBox(height: 8.0,),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.roundabout_left),
|
||||
SizedBox(width: 8.0,),
|
||||
const Icon(Icons.roundabout_left),
|
||||
const SizedBox(width: 8.0,),
|
||||
indexController.currentFeature[0].properties!["address"] != null && (indexController.currentFeature[0].properties!["address"] as String).isNotEmpty ?
|
||||
getDetails(context, "address".tr, indexController.currentFeature[0].properties!["address"] ?? '')
|
||||
:
|
||||
Container(width: 0.0, height: 0,),
|
||||
const SizedBox(width: 0.0, height: 0,),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -468,12 +462,12 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.phone),
|
||||
SizedBox(width: 8.0,),
|
||||
const Icon(Icons.phone),
|
||||
const SizedBox(width: 8.0,),
|
||||
indexController.currentFeature[0].properties!["phone"] != null && (indexController.currentFeature[0].properties!["phone"] as String).isNotEmpty ?
|
||||
getDetails(context, "telephone".tr, indexController.currentFeature[0].properties!["phone"] ?? '')
|
||||
:
|
||||
Container(width: 0.0, height: 0,),
|
||||
const SizedBox(width: 0.0, height: 0,),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -481,12 +475,12 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.email),
|
||||
SizedBox(width: 8.0,),
|
||||
const Icon(Icons.email),
|
||||
const SizedBox(width: 8.0,),
|
||||
indexController.currentFeature[0].properties!["email"] != null && (indexController.currentFeature[0].properties!["email"] as String).isNotEmpty ?
|
||||
getDetails(context, "email".tr, indexController.currentFeature[0].properties!["email"] ?? '')
|
||||
:
|
||||
Container(width: 0.0, height: 0,),
|
||||
const SizedBox(width: 0.0, height: 0,),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -494,12 +488,12 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.language),
|
||||
SizedBox(width: 8.0,),
|
||||
const Icon(Icons.language),
|
||||
const SizedBox(width: 8.0,),
|
||||
indexController.currentFeature[0].properties!["webcontents"] != null && (indexController.currentFeature[0].properties!["webcontents"] as String).isNotEmpty ?
|
||||
getDetails(context, "web".tr, indexController.currentFeature[0].properties!["webcontents"] ?? '', isurl: true)
|
||||
:
|
||||
Container(width: 0.0, height: 0,),
|
||||
const SizedBox(width: 0.0, height: 0,),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -507,11 +501,11 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(width: 8.0,),
|
||||
const SizedBox(width: 8.0,),
|
||||
indexController.currentFeature[0].properties!["remark"] != null && (indexController.currentFeature[0].properties!["remark"] as String).isNotEmpty ?
|
||||
getDetails(context, "remarks".tr, indexController.currentFeature[0].properties!["remark"] ?? '', isurl: false)
|
||||
:
|
||||
Container(width: 0.0, height: 0,),
|
||||
const SizedBox(width: 0.0, height: 0,),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -520,7 +514,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
),
|
||||
)
|
||||
),
|
||||
SizedBox(height: 60.0,)
|
||||
const SizedBox(height: 60.0,)
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -645,23 +639,20 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
// // },
|
||||
// // ):
|
||||
// // Container(),
|
||||
SizedBox(width: 8.0,) ,
|
||||
const SizedBox(width: 8.0,) ,
|
||||
Obx((() =>
|
||||
|
||||
indexController.rog_mode == 1 ?
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
Destination dest = indexController.currentDestinationFeature[0]!;
|
||||
Destination dest = indexController.currentDestinationFeature[0];
|
||||
//print("------ curent destination is ${dest!.checkedIn}-------");
|
||||
if(dest != null){
|
||||
//print("------ curent destination is ${dest!.checkedin}-------::::::::::");
|
||||
destinationController.makeCheckin(dest, !dest.checkedin!, "");
|
||||
}
|
||||
destinationController.makeCheckin(dest, !dest.checkedin!, "");
|
||||
},
|
||||
child: indexController.currentDestinationFeature[0].checkedin == false ?
|
||||
Text("チェックイン")
|
||||
const Text("チェックイン")
|
||||
:
|
||||
Text("チェックアウト")
|
||||
const Text("チェックアウト")
|
||||
):
|
||||
Container()
|
||||
|
||||
@ -690,7 +681,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
child: Text("Image"), onPressed: (){
|
||||
child: const Text("Image"), onPressed: (){
|
||||
final ImagePicker _picker = ImagePicker();
|
||||
_picker.pickImage(source: ImageSource.camera).then((value){
|
||||
//print("----- image---- ${value!.path}");
|
||||
@ -729,7 +720,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
indexController.makeAction(context);
|
||||
},
|
||||
|
||||
child: Icon(
|
||||
child: const Icon(
|
||||
Icons.favorite, color: Colors.red)
|
||||
|
||||
,
|
||||
@ -747,7 +738,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(label),
|
||||
SizedBox(width: 10.0,),
|
||||
const SizedBox(width: 10.0,),
|
||||
InkWell(
|
||||
onTap: (){
|
||||
if(isurl){
|
||||
@ -760,7 +751,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
child: SizedBox(
|
||||
width: MediaQuery.of(context).size.width - 160,
|
||||
child: Text(text,
|
||||
style: TextStyle(
|
||||
|
||||
Reference in New Issue
Block a user