Files
rog_app/lib/widgets/bottom_sheet_new.dart

775 lines
33 KiB
Dart
Raw Normal View History

2022-06-27 12:15:54 +05:30
import 'package:flutter/material.dart';
2022-10-30 21:43:29 +05:30
import 'package:flutter/services.dart';
2023-02-16 19:36:39 +05:30
import 'package:flutter_map/plugin_api.dart';
2022-06-27 12:15:54 +05:30
import 'package:geojson/geojson.dart';
2023-02-16 19:36:39 +05:30
import 'package:geolocator/geolocator.dart';
2022-06-27 12:15:54 +05:30
import 'package:get/get.dart';
import 'package:get/get_state_manager/get_state_manager.dart';
import 'package:image_picker/image_picker.dart';
2022-07-09 22:51:34 +05:30
import 'package:latlong2/latlong.dart';
2022-11-05 22:02:21 +05:30
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
2022-07-09 22:51:34 +05:30
import 'package:rogapp/model/destination.dart';
2022-11-05 22:02:21 +05:30
import 'package:rogapp/pages/camera/camera_page.dart';
2022-07-09 22:51:34 +05:30
import 'package:rogapp/pages/destination/destination_controller.dart';
2022-06-27 12:15:54 +05:30
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/routes/app_pages.dart';
2022-11-05 22:02:21 +05:30
import 'package:rogapp/services/external_service.dart';
2022-10-30 21:43:29 +05:30
import 'package:rogapp/utils/const.dart';
2022-07-09 22:51:34 +05:30
import 'package:rogapp/utils/database_helper.dart';
2022-10-12 21:46:17 +05:30
import 'package:rogapp/utils/text_util.dart';
2022-06-27 12:15:54 +05:30
import 'package:rogapp/widgets/bottom_sheet_controller.dart';
import 'package:url_launcher/url_launcher.dart';
class BottomSheetNew extends GetView<BottomSheetController> {
BottomSheetNew({ Key? key }) : super(key: key);
final IndexController indexController = Get.find<IndexController>();
2022-07-09 22:51:34 +05:30
final DestinationController destinationController = Get.find<DestinationController>();
2022-06-27 12:15:54 +05:30
2022-07-14 23:10:24 +05:30
Image getImage(){
2022-10-30 21:43:29 +05:30
String server_url = ConstValues.currentServer();
2022-07-14 23:10:24 +05:30
if(indexController.rog_mode == 1){
2022-09-27 17:52:54 +05:30
//print("----- rogaining mode 1");
2022-07-14 23:10:24 +05:30
if(indexController.currentDestinationFeature.length <= 0 || indexController.currentDestinationFeature[0].photos! == ""){
return Image(image: AssetImage('assets/images/empty_image.png'));
}
else{
2022-09-27 17:52:54 +05:30
//print("@@@@@@@@@@@@@ rog mode -------------------- ${indexController.currentDestinationFeature[0].photos} @@@@@@@@@@@");
String _photo = indexController.currentDestinationFeature[0].photos!;
if(_photo.contains('http')){
return Image(image: NetworkImage(
indexController.currentDestinationFeature[0].photos!,
),
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset("assets/images/empty_image.png");
},
);
}
else {
return Image(image: NetworkImage(
2022-10-30 21:43:29 +05:30
'${server_url}/media/compressed/' + indexController.currentDestinationFeature[0].photos!,
2022-09-27 17:52:54 +05:30
),
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset("assets/images/empty_image.png");
},
2022-07-14 23:10:24 +05:30
);
2022-09-27 17:52:54 +05:30
}
2022-07-14 23:10:24 +05:30
}
2022-06-27 12:15:54 +05:30
}
else{
2022-07-14 23:10:24 +05:30
GeoJsonFeature<dynamic> gf = indexController.currentFeature[0];
if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){
return Image(image: AssetImage('assets/images/empty_image.png'));
}
else{
2022-09-27 17:52:54 +05:30
String _photo = gf!.properties!["photos"];
if(_photo.contains('http')){
return Image(image: NetworkImage(
gf.properties!["photos"],
),
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset("assets/images/empty_image.png");
},
);
}
else {
return Image(image: NetworkImage(
2022-10-30 21:43:29 +05:30
'${server_url}/media/compressed/' + gf.properties!["photos"],
2022-09-27 17:52:54 +05:30
),
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset("assets/images/empty_image.png");
},
);
}
2022-07-14 23:10:24 +05:30
}
2022-06-27 12:15:54 +05:30
}
2022-07-14 23:10:24 +05:30
2022-06-27 12:15:54 +05:30
}
void _launchURL(url) async {
if (!await launch(url)) throw 'Could not launch $url';
}
2022-07-22 19:36:04 +05:30
bool isInDestination(String locationid){
int lid = int.parse(locationid);
if(destinationController.destinations.where((element) => element.location_id == lid).length > 0){
return true;
}
else{
return false;
}
}
2022-06-27 12:15:54 +05:30
@override
Widget build(BuildContext context) {
2022-10-30 21:43:29 +05:30
print('---- rog_mode ----- ${indexController.rog_mode} -----');
2022-07-14 23:10:24 +05:30
return indexController.rog_mode == 0 ? detailsSheet(context) : destinationSheet(context);
}
2022-09-01 19:14:18 +05:30
// Show destination detais
2022-07-14 23:10:24 +05:30
SingleChildScrollView destinationSheet(BuildContext context) {
2022-10-30 21:43:29 +05:30
print('---- currentDestinationFeature ----- ${indexController.currentDestinationFeature[0].name} -----');
2022-07-14 23:10:24 +05:30
return SingleChildScrollView(
child: Column(
2022-06-27 12:15:54 +05:30
children: [
2022-07-14 23:10:24 +05:30
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: Row(
children: [
MaterialButton(
onPressed: () {
2022-09-29 15:32:33 +05:30
Get.back();
//destinationController.makePrevious(indexController.currentDestinationFeature[0]);
2022-07-14 23:10:24 +05:30
},
color: Colors.blue,
textColor: Colors.white,
child: Icon(
Icons.arrow_back_ios,
size: 14,
),
padding: EdgeInsets.all(16),
shape: CircleBorder(),
),
Expanded(
child: Container(
alignment: Alignment.center,
child: Obx(() =>
2022-10-12 21:46:17 +05:30
indexController.currentUser.length > 0 ?
2023-01-22 18:05:15 +05:30
Text("${TextUtils.getDisplayText(indexController.currentDestinationFeature[0])} : ${TextUtils.getDisplayText(indexController.currentDestinationFeature[0])} : ${indexController.currentDestinationFeature[0].name!}", style: TextStyle(
2022-10-12 21:46:17 +05:30
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
)
:
Text("${indexController.currentDestinationFeature[0].name!}", style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
)
2022-06-27 12:15:54 +05:30
),
2022-07-14 23:10:24 +05:30
),
2022-06-27 12:15:54 +05:30
),
],
),
2022-07-14 23:10:24 +05:30
),
),
Row(
children: [
Expanded(
child: SizedBox(
height: 260.0,
child: Obx(() => getImage()),
)
2022-06-27 12:15:54 +05:30
),
2022-07-14 23:10:24 +05:30
],
),
2022-10-30 21:43:29 +05:30
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Obx(() =>
2022-11-04 14:11:18 +05:30
indexController.currentDestinationFeature.isNotEmpty && destinationController.is_in_checkin.value == true && destinationController.is_at_start.value == false ?
2022-10-30 21:43:29 +05:30
Row(
children: [
ElevatedButton(
onPressed: (){
if(indexController.currentDestinationFeature[0].checkedin == null || indexController.currentDestinationFeature[0].checkedin == false){
2022-11-05 22:02:21 +05:30
if(indexController.currentDestinationFeature[0].hidden_location == 0){
destinationController.skip_gps = false;
destinationController.is_photo_shoot.value = true;
Get.back();
}
else{
destinationController.makeCheckin(indexController.currentDestinationFeature[0], true, "");
if(indexController.currentDestinationFeature[0].cp != -1){
destinationController.rogaining_counted.value =true;
}
2022-10-30 21:43:29 +05:30
}
2022-11-05 22:02:21 +05:30
2022-10-30 21:43:29 +05:30
}
else{
2022-11-05 22:02:21 +05:30
destinationController.makeCheckin(indexController.currentDestinationFeature[0], false, "");
2022-10-30 21:43:29 +05:30
}
2022-11-05 22:02:21 +05:30
//Get.back();
2022-10-30 21:43:29 +05:30
},
child: Text(
2022-11-08 15:29:42 +05:30
//Checkin
2022-10-30 21:43:29 +05:30
indexController.currentDestinationFeature[0].checkedin == null || indexController.currentDestinationFeature[0].checkedin == false ?
2022-11-05 22:02:21 +05:30
"チェックイン"
2022-10-30 21:43:29 +05:30
:
2022-11-05 22:02:21 +05:30
"チェックアウト"
2022-10-30 21:43:29 +05:30
)
),
],
)
:
Container(),
),
Obx(() =>
destinationController.is_at_start.value == true ?
ElevatedButton(
onPressed: (){
destinationController.is_in_rog.value = true;
destinationController.addToRogaining(destinationController.current_lat, destinationController.current_lon, indexController.currentDestinationFeature[0].location_id!);
2022-11-05 22:02:21 +05:30
ExternalService().StartRogaining().then((value) => Get.back());
2022-10-30 21:43:29 +05:30
},
child: Text(
2022-11-08 15:29:42 +05:30
// start
2022-10-30 21:43:29 +05:30
indexController.currentDestinationFeature[0].checkedin != null || indexController.currentDestinationFeature[0].checkedin == true ?
2022-11-05 22:02:21 +05:30
"ロゲイニングを開始"
2022-10-30 21:43:29 +05:30
:
2022-11-05 22:02:21 +05:30
"間違った目的地..."
2022-10-30 21:43:29 +05:30
)
)
:
Container(),
),
Obx(() =>
destinationController.is_at_goal.value == true && destinationController.rogaining_counted ==true ?
ElevatedButton(
onPressed: (){
Get.toNamed(AppPages.CAMERA_PAGE);
Get.back();
},
child: Text(
2022-11-08 15:29:42 +05:30
//goal
2022-10-30 21:43:29 +05:30
indexController.currentDestinationFeature[0].checkedin != null || indexController.currentDestinationFeature[0].checkedin == true ?
2022-11-05 22:02:21 +05:30
"ロゲイニングを終える"
2022-10-30 21:43:29 +05:30
:
2022-11-05 22:02:21 +05:30
"間違った目的地 ..."
2022-10-30 21:43:29 +05:30
)
)
:
Container(),
),
],
),
2022-07-14 23:10:24 +05:30
Obx(() =>
2022-09-01 19:14:18 +05:30
indexController.currentDestinationFeature[0].address != null && indexController.currentDestinationFeature[0].address!.isNotEmpty ?
2022-07-14 23:10:24 +05:30
getDetails(context, "address".tr, indexController.currentDestinationFeature[0].address! ?? '')
:
Container(width: 0.0, height: 0,),
),
Obx(() =>
2022-09-01 19:14:18 +05:30
indexController.currentDestinationFeature[0].phone != null && indexController.currentDestinationFeature[0].phone!.isNotEmpty ?
2022-07-14 23:10:24 +05:30
getDetails(context, "telephone".tr, indexController.currentDestinationFeature[0].phone! ?? '')
:
Container(width: 0.0, height: 0,),
),
Obx(() =>
2022-09-01 19:14:18 +05:30
indexController.currentDestinationFeature[0].email != null && indexController.currentDestinationFeature[0].email!.isNotEmpty ?
2022-07-14 23:10:24 +05:30
getDetails(context, "email".tr, indexController.currentDestinationFeature[0].email! ?? '')
:
Container(width: 0.0, height: 0,),
),
Obx(() =>
2022-09-01 19:14:18 +05:30
indexController.currentDestinationFeature[0].webcontents != null && indexController.currentDestinationFeature[0].webcontents!.isNotEmpty ?
2022-07-14 23:10:24 +05:30
getDetails(context, "web".tr, indexController.currentDestinationFeature[0].webcontents! ?? '', isurl: true)
:
Container(width: 0.0, height: 0,),
),
Obx(() =>
2022-09-01 19:14:18 +05:30
indexController.currentDestinationFeature[0].videos != null && indexController.currentDestinationFeature[0].videos!.isNotEmpty ?
2022-07-14 23:10:24 +05:30
getDetails(context, "video".tr, indexController.currentDestinationFeature[0].videos! ?? '', isurl: true)
:
Container(width: 0.0, height: 0,),
),
SizedBox(height: 20.0,),
2022-10-30 21:43:29 +05:30
// Obx(() =>
// //wantToGo(context),
2022-07-14 23:10:24 +05:30
2022-10-30 21:43:29 +05:30
// FutureBuilder<Widget>(
// future: wantToGo(context),
// builder: (context, snapshot) {
// return Container(
// child: snapshot.data,
// );
// },
// ),
2022-07-14 23:10:24 +05:30
2022-10-30 21:43:29 +05:30
// ),
2022-07-14 23:10:24 +05:30
SizedBox(height: 60.0,)
],
),
);
}
2022-07-10 23:50:43 +05:30
2022-11-02 22:47:49 +05:30
2022-09-01 19:14:18 +05:30
// show add location details
2022-07-14 23:10:24 +05:30
SingleChildScrollView detailsSheet(BuildContext context) {
return SingleChildScrollView(
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: Row(
children: [
MaterialButton(
onPressed: () {
2022-09-29 15:32:33 +05:30
Get.back();
//indexController.makePrevious(indexController.currentFeature[0]);
2022-07-14 23:10:24 +05:30
},
color: Colors.blue,
textColor: Colors.white,
child: Icon(
Icons.arrow_back_ios,
2023-01-26 23:30:48 +05:30
//Icons.arrow_back_ios,
2022-07-14 23:10:24 +05:30
size: 14,
),
padding: EdgeInsets.all(16),
shape: CircleBorder(),
),
Expanded(
child: Container(
alignment: Alignment.center,
child: Obx(() =>
Text(indexController.currentFeature[0].properties!["location_name"], style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
)
),
),
),
],
2022-07-10 23:50:43 +05:30
),
2022-07-14 23:10:24 +05:30
),
),
Row(
children: [
Expanded(
child: SizedBox(
height: 260.0,
child: Obx(() => getImage()),
)
2022-07-10 23:50:43 +05:30
),
2022-06-27 12:15:54 +05:30
],
2022-07-14 23:10:24 +05:30
),
2022-07-22 10:27:11 +05:30
Obx(() =>
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
2022-11-04 14:11:18 +05:30
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
2022-11-08 15:29:42 +05:30
Obx(() =>
indexController.currentDestinationFeature.isNotEmpty && indexController.currentDestinationFeature[0].cp == -1 && indexController.currentDestinationFeature[0].checkedin == false && destinationController.is_at_start.value == true ?
ElevatedButton(
onPressed: (){
destinationController.is_in_rog.value = true;
destinationController.addToRogaining(destinationController.current_lat, destinationController.current_lon, indexController.currentDestinationFeature[0].location_id!);
ExternalService().StartRogaining().then((value) => Get.back());
},
child: Text(
// start
indexController.currentDestinationFeature[0].checkedin != null || indexController.currentDestinationFeature[0].checkedin == true ?
"ロゲイニングを開始"
:
"間違った目的地..."
)
)
:
Container(),
),
Obx(() =>
destinationController.is_at_goal.value == true && destinationController.rogaining_counted ==true ?
ElevatedButton(
2022-11-04 14:11:18 +05:30
onPressed: (){
2022-11-08 15:29:42 +05:30
Get.toNamed(AppPages.CAMERA_PAGE);
2022-11-04 14:11:18 +05:30
Get.back();
},
child: Text(
2022-11-08 15:29:42 +05:30
//goal
indexController.currentDestinationFeature[0].checkedin != null || indexController.currentDestinationFeature[0].checkedin == true ?
"ロゲイニングを終える"
2022-11-04 14:11:18 +05:30
:
2022-11-08 15:29:42 +05:30
"間違った目的地 ..."
2022-11-04 14:11:18 +05:30
)
2022-11-08 15:29:42 +05:30
)
:
Container(),
),
2022-11-04 14:11:18 +05:30
],
),
2022-07-22 10:27:11 +05:30
Row(
children: [
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
2022-11-04 14:11:18 +05:30
indexController.currentDestinationFeature.isNotEmpty && destinationController.is_in_checkin.value == true ?
Container()
:
FutureBuilder<Widget>(
2022-07-22 10:27:11 +05:30
future: wantToGo(context),
builder: (context, snapshot) {
return Container(
child: snapshot.data,
);
},
),
2022-07-25 19:56:32 +05:30
indexController.currentFeature[0].properties!["location_name"] != null && (indexController.currentFeature[0].properties!["location_name"] as String).isNotEmpty ?
2022-07-22 10:27:11 +05:30
Flexible(child: Text(indexController.currentFeature[0].properties!["location_name"]))
:
Container(width: 0.0, height: 0,),
],
),
),
2023-02-16 19:36:39 +05:30
ElevatedButton(
onPressed:() async {
GeoJsonFeature<GeoJsonMultiPoint> mp = indexController.currentFeature[0] as GeoJsonFeature<GeoJsonMultiPoint>;
Position position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
Destination ds = Destination(
lat: position.latitude,
lon: position.longitude
);
Destination tp = Destination(
lat: mp.geometry!.geoSerie!.geoPoints[0].latitude,
lon: mp.geometry!.geoSerie!.geoPoints[0].longitude
);
Get.back();
destinationController.destinationMatrixFromCurrentPoint([ds, tp]);
},
child:Text("ここへ行く")),
2022-07-22 10:27:11 +05:30
],
),
SizedBox(height: 8.0,),
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
Icon(Icons.roundabout_left),
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,),
],
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
Icon(Icons.phone),
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,),
],
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
Icon(Icons.email),
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,),
],
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
Icon(Icons.language),
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,),
],
),
2022-09-01 19:14:18 +05:30
),
2022-09-29 15:32:33 +05:30
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
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,),
],
),
),
2022-10-12 21:46:17 +05:30
// Text('${TextUtils.getDisplayText(indexController.currentFeature[0].properties!["cp"].toString())} - id: ${TextUtils.getDisplayText(indexController.currentFeature[0].properties!["checkin_point"].toString())}'),
2022-07-22 10:27:11 +05:30
],
),
)
2022-07-14 23:10:24 +05:30
),
SizedBox(height: 60.0,)
2022-06-27 12:15:54 +05:30
],
2022-07-14 23:10:24 +05:30
),
);
2022-06-27 12:15:54 +05:30
}
2022-11-02 22:47:49 +05:30
2022-07-10 23:50:43 +05:30
Future<Widget> wantToGo(BuildContext context)async {
2022-10-12 21:46:17 +05:30
2022-09-27 17:52:54 +05:30
bool _selected = false;
print('---target-- ${indexController.currentFeature[0].properties!["location_id"]}----');
for(Destination d in destinationController.destinations){
print('---- ${d.location_id.toString()} ----');
if(d.location_id == indexController.currentFeature[0].properties!["location_id"]){
_selected = true;
break;
}
}
2022-07-14 23:10:24 +05:30
2022-07-10 23:50:43 +05:30
DatabaseHelper db = DatabaseHelper.instance;
return
Row(
2022-07-09 22:51:34 +05:30
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
2023-02-16 19:36:39 +05:30
mainAxisAlignment: MainAxisAlignment.spaceBetween,
2022-07-09 22:51:34 +05:30
children: [
2022-07-22 19:36:04 +05:30
indexController.rog_mode == 0 ?
IconButton(
2022-09-27 17:52:54 +05:30
icon: Icon(Icons.pin_drop_sharp, size: 32, color: _selected == true ? Colors.amber : Colors.blue,),
2022-07-22 19:36:04 +05:30
onPressed: (){
2022-10-12 21:46:17 +05:30
if(_selected){
// show remove from destination
Get.defaultDialog(
title: "本当にこのポイントを通過順から外しますか?",
middleText: "場所は目的地リストから削除されます",
backgroundColor: Colors.blue.shade300,
titleStyle: TextStyle(color: Colors.white),
middleTextStyle: TextStyle(color: Colors.white),
textConfirm: "はい",
textCancel: "いいえ",
cancelTextColor: Colors.white,
confirmTextColor: Colors.blue,
buttonColor: Colors.white,
barrierDismissible: false,
radius: 10,
content: Column(
children: [
],
),
onConfirm: (){
int _id = indexController.currentFeature[0].properties!["location_id"];
Destination? d = destinationController.destinationById(_id);
print('--- des id is : ${d} -----');
if(d != null) {
//print('--- des id is : ${d.location_id} -----');
destinationController.deleteDestination(d);
Get.back();
Get.back();
Get.snackbar("追加した", "場所が削除されました");
}
}
);
return;
}
// show add to destination
2022-09-05 19:12:25 +05:30
Get.defaultDialog(
title: "この場所を登録してもよろしいですか",
middleText: "ロケーションがロガニング リストに追加されます",
backgroundColor: Colors.blue.shade300,
titleStyle: TextStyle(color: Colors.white),
middleTextStyle: TextStyle(color: Colors.white),
2022-10-12 21:46:17 +05:30
textConfirm: "はい",
textCancel: "いいえ",
2022-09-05 19:12:25 +05:30
cancelTextColor: Colors.white,
confirmTextColor: Colors.blue,
buttonColor: Colors.white,
barrierDismissible: false,
radius: 10,
content: Column(
children: [
],
),
onConfirm: (){
GeoJsonMultiPoint mp = indexController.currentFeature[0].geometry as GeoJsonMultiPoint;
LatLng pt = LatLng(mp.geoSerie!.geoPoints[0].latitude, mp.geoSerie!.geoPoints[0].longitude);
2022-07-09 22:51:34 +05:30
2022-10-30 21:43:29 +05:30
//print("----- ${indexController.currentFeature[0].properties} -----");
2022-09-05 19:12:25 +05:30
Destination dest = Destination(
name: indexController.currentFeature[0].properties!["location_name"],
address: indexController.currentFeature[0].properties!["address"],
phone: indexController.currentFeature[0].properties!["phone"],
email: indexController.currentFeature[0].properties!["email"],
webcontents: indexController.currentFeature[0].properties!["webcontents"],
videos: indexController.currentFeature[0].properties!["videos"],
category: indexController.currentFeature[0].properties!["category"],
series: 1,
lat: pt.latitude,
lon: pt.longitude,
2023-05-16 20:40:02 +05:30
sub_loc_id: indexController.currentFeature[0].properties!["sub_loc_id"],
2022-09-05 19:12:25 +05:30
location_id: indexController.currentFeature[0].properties!["location_id"],
list_order: 1,
photos: indexController.currentFeature[0].properties!["photos"],
2022-10-30 21:43:29 +05:30
checkin_radious: indexController.currentFeature[0].properties!["checkin_radius"],
2022-09-05 19:12:25 +05:30
auto_checkin: indexController.currentFeature[0].properties!["auto_checkin"] == true ? 1 : 0,
cp: indexController.currentFeature[0].properties!["cp"],
checkin_point: indexController.currentFeature[0].properties!["checkin_point"],
buy_point: indexController.currentFeature[0].properties!["buy_point"],
selected: false,
2022-10-30 21:43:29 +05:30
checkedin: false,
hidden_location: indexController.currentFeature[0].properties!["hidden_location"] == true ?1 : 0
2022-09-05 19:12:25 +05:30
);
destinationController.addDestinations(dest);
Get.back();
2022-10-12 21:46:17 +05:30
Get.back();
2022-09-05 19:12:25 +05:30
Get.snackbar("追加した", "場所が追加されました");
}
2022-07-22 19:36:04 +05:30
);
2022-09-05 19:12:25 +05:30
2022-07-22 19:36:04 +05:30
},
):
Container(),
2022-07-22 10:27:11 +05:30
SizedBox(width: 8.0,) ,
2022-07-14 23:10:24 +05:30
Obx((() =>
indexController.rog_mode == 1 ?
ElevatedButton(
onPressed: () async {
Destination dest = indexController.currentDestinationFeature[0]!;
//print("------ curent destination is ${dest!.checkedIn}-------");
if(dest != null){
2022-07-25 19:56:32 +05:30
//print("------ curent destination is ${dest!.checkedin}-------::::::::::");
2022-11-05 22:02:21 +05:30
destinationController.makeCheckin(dest, !dest.checkedin!, "");
2022-07-14 23:10:24 +05:30
}
},
child: indexController.currentDestinationFeature[0].checkedin == false ?
2022-11-05 22:02:21 +05:30
Text("チェックイン")
2022-07-14 23:10:24 +05:30
:
2022-11-05 22:02:21 +05:30
Text("チェックアウト")
2022-07-14 23:10:24 +05:30
):
Container()
)
2023-02-16 19:36:39 +05:30
),
2022-07-09 22:51:34 +05:30
],
2023-02-16 19:36:39 +05:30
),
2022-07-09 22:51:34 +05:30
],
);
}
2022-06-27 12:15:54 +05:30
Widget getCheckin(BuildContext context){
2022-07-09 22:51:34 +05:30
2022-07-25 19:56:32 +05:30
//print("------ currentAction ----- ${indexController.currentAction}-----");
2022-07-09 22:51:34 +05:30
2022-06-27 12:15:54 +05:30
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
2022-07-14 23:10:24 +05:30
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
indexController.currentAction[0][0]["checkin"] == false ?
Column(
children: [
Row(
mainAxisSize: MainAxisSize.max,
2022-06-27 12:15:54 +05:30
children: [
ElevatedButton(
2022-07-14 23:10:24 +05:30
child: Text("Image"), onPressed: (){
final ImagePicker _picker = ImagePicker();
_picker.pickImage(source: ImageSource.camera).then((value){
2022-07-25 19:56:32 +05:30
//print("----- image---- ${value!.path}");
2022-07-14 23:10:24 +05:30
});
2022-06-27 12:15:54 +05:30
},
2022-07-14 23:10:24 +05:30
)
2022-06-27 12:15:54 +05:30
],
2022-07-14 23:10:24 +05:30
),
ElevatedButton(
onPressed: (){
if(indexController.currentAction.isNotEmpty){
2022-07-25 19:56:32 +05:30
//print(indexController.currentAction[0]);
2022-07-14 23:10:24 +05:30
indexController.currentAction[0][0]["checkin"] = true;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
2022-07-25 19:56:32 +05:30
//print("---temp---${temp}");
2022-07-14 23:10:24 +05:30
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
},
child: Text("checkin".tr)
)
],
)
:
ElevatedButton(
onPressed: (){
if(indexController.currentAction.isNotEmpty){
2022-07-25 19:56:32 +05:30
//print(indexController.currentAction[0]);
2022-07-14 23:10:24 +05:30
indexController.currentAction[0][0]["checkin"] = false;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
2022-07-25 19:56:32 +05:30
//print("---temp---${temp}");
2022-07-14 23:10:24 +05:30
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
},
child: Icon(
Icons.favorite, color: Colors.red)
2022-06-27 12:15:54 +05:30
2022-07-14 23:10:24 +05:30
,
)
],
2022-06-27 12:15:54 +05:30
)
],
);
}
2022-07-14 23:10:24 +05:30
2022-06-27 12:15:54 +05:30
2022-07-14 23:10:24 +05:30
Widget getDetails(BuildContext context, String label, String text, {bool isurl=false}){
2022-06-27 12:15:54 +05:30
return Row(
2022-07-14 23:10:24 +05:30
mainAxisAlignment: MainAxisAlignment.center,
2022-06-27 12:15:54 +05:30
children: [
2022-07-14 23:10:24 +05:30
Text(label),
2022-06-27 12:15:54 +05:30
SizedBox(width: 10.0,),
2022-07-15 21:50:14 +05:30
InkWell(
onTap: (){
if(isurl){
if(indexController.rog_mode == 0){
_launchURL(indexController.currentFeature[0].properties!["webcontents"]);
2022-07-14 23:10:24 +05:30
}
2022-07-15 21:50:14 +05:30
else {
indexController.currentDestinationFeature[0].webcontents;
}
}
},
2022-10-12 21:46:17 +05:30
child: Container(
width: MediaQuery.of(context).size.width - 160,
2022-10-30 21:43:29 +05:30
child: Text(text,
style: TextStyle(
color: isurl ? Colors.blue : Colors.black,
2022-10-12 21:46:17 +05:30
),
2022-10-30 21:43:29 +05:30
),
2022-10-12 21:46:17 +05:30
),
2022-07-15 21:50:14 +05:30
),
2022-06-27 12:15:54 +05:30
],
);
}
}