updated and fix checking, buy point
This commit is contained in:
@ -25,6 +25,8 @@ class Destination {
|
||||
int? hidden_location;
|
||||
String? checkin_image;
|
||||
String? buypoint_image;
|
||||
bool forced_checkin = false;
|
||||
int recipt_times = 0;
|
||||
|
||||
Destination({
|
||||
this.name,
|
||||
@ -50,13 +52,16 @@ class Destination {
|
||||
this.buy_point,
|
||||
this.hidden_location,
|
||||
this.checkin_image,
|
||||
this.buypoint_image
|
||||
this.buypoint_image,
|
||||
this.forced_checkin = false,
|
||||
this.recipt_times = 0
|
||||
});
|
||||
|
||||
factory Destination.fromMap(Map<String, dynamic> json) {
|
||||
|
||||
bool selec = json['selected'] == 0 ? false : true;
|
||||
bool checkin = json['checkedin'] == 0 ? false : true;
|
||||
bool _forced_checkin = json['forced_checkin'] == 0 ? false : true;
|
||||
|
||||
return Destination(
|
||||
name: json['name'],
|
||||
@ -82,13 +87,16 @@ class Destination {
|
||||
buy_point: json['buy_point'],
|
||||
hidden_location: json['hidden_location'],
|
||||
checkin_image: json['checkin_image'],
|
||||
buypoint_image: json["buypoint_image"]
|
||||
buypoint_image: json["buypoint_image"],
|
||||
forced_checkin: _forced_checkin,
|
||||
recipt_times: json["recipt_times"]
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap(){
|
||||
int sel = selected == false ? 0 : 1;
|
||||
int check = checkedin == false ? 0 : 1;
|
||||
int _forced_checkin = forced_checkin == false ? 0 : 1;
|
||||
return {
|
||||
'name':name,
|
||||
'address': address,
|
||||
@ -113,7 +121,9 @@ class Destination {
|
||||
'buy_point' : buy_point,
|
||||
'hidden_location' : hidden_location,
|
||||
'checkin_image': checkin_image,
|
||||
'buypoint_image' : buypoint_image
|
||||
'buypoint_image' : buypoint_image,
|
||||
'forced_checkin' : _forced_checkin,
|
||||
'recipt_times' : recipt_times
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -8,11 +8,23 @@ import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/services/external_service.dart';
|
||||
|
||||
ImageProvider getFinishImage() {
|
||||
DestinationController destinationController =
|
||||
Get.find<DestinationController>();
|
||||
if (destinationController.photos.isNotEmpty) {
|
||||
return FileImage(destinationController.photos[0]);
|
||||
} else {
|
||||
return const AssetImage('assets/images/empty_image.png');
|
||||
}
|
||||
}
|
||||
|
||||
class CameraPage extends StatelessWidget {
|
||||
bool? manulaCheckin = false;
|
||||
bool? buyPointPhoto = false;
|
||||
Destination? destination;
|
||||
Destination? dbDest;
|
||||
CameraPage({Key? key, this.destination, this.dbDest}) : super(key: key);
|
||||
CameraPage({Key? key, this.destination, this.dbDest, this.manulaCheckin, this.buyPointPhoto})
|
||||
: super(key: key);
|
||||
DestinationController destinationController =
|
||||
Get.find<DestinationController>();
|
||||
IndexController indexController = Get.find<IndexController>();
|
||||
@ -21,17 +33,40 @@ class CameraPage extends StatelessWidget {
|
||||
|
||||
Timer? timer;
|
||||
|
||||
ImageProvider getFinishImage() {
|
||||
if (destinationController.photos.isNotEmpty) {
|
||||
return FileImage(destinationController.photos[0]);
|
||||
} else {
|
||||
return const AssetImage('assets/images/empty_image.png');
|
||||
}
|
||||
}
|
||||
|
||||
Widget getAction(BuildContext context) {
|
||||
|
||||
print("----cccheckin is --- ${dbDest?.checkedin} ----");
|
||||
//print("----cccheckin is --- ${dbDest?.checkedin} ----");
|
||||
if (manulaCheckin == true) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Obx(() => ElevatedButton(
|
||||
onPressed: () {
|
||||
destinationController.openCamera(context, destination);
|
||||
},
|
||||
child: destinationController.photos.isNotEmpty
|
||||
? const Text("再撮影")
|
||||
: const Text("撮影"))),
|
||||
Obx(() => destinationController.photos.isNotEmpty
|
||||
? ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(backgroundColor: Colors.red),
|
||||
onPressed: () async {
|
||||
print(
|
||||
"##### current destination ${indexController.currentDestinationFeature[0].sub_loc_id} #######");
|
||||
await destinationController.makeCheckin(
|
||||
destination!,
|
||||
true,
|
||||
destinationController.photos[0].path);
|
||||
Get.back();
|
||||
destinationController.rogaining_counted.value = true;
|
||||
destinationController.skip_gps = false;
|
||||
destinationController.is_photo_shoot.value = false;
|
||||
Get.snackbar("チェックインした", "正常にチェックインしました");
|
||||
},
|
||||
child: const Text("チェックイン"))
|
||||
: Container())
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
if (destinationController.is_at_goal.value &&
|
||||
destinationController.is_in_rog.value) {
|
||||
@ -41,7 +76,7 @@ class CameraPage extends StatelessWidget {
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
if (settingGoal.value == false) {
|
||||
destinationController.openCamera(context);
|
||||
destinationController.openCamera(context, destination);
|
||||
}
|
||||
},
|
||||
child: Text("take_photo of the clock".tr)),
|
||||
@ -117,7 +152,7 @@ class CameraPage extends StatelessWidget {
|
||||
children: [
|
||||
Obx(() => ElevatedButton(
|
||||
onPressed: () {
|
||||
destinationController.openCamera(context);
|
||||
destinationController.openCamera(context, destination);
|
||||
},
|
||||
child: destinationController.photos.isNotEmpty
|
||||
? const Text("再撮影")
|
||||
@ -129,8 +164,7 @@ class CameraPage extends StatelessWidget {
|
||||
print(
|
||||
"##### current destination ${indexController.currentDestinationFeature[0].sub_loc_id} #######");
|
||||
await destinationController.makeBuyPoint(
|
||||
destination!,
|
||||
destinationController.photos[0].path);
|
||||
destination!, destinationController.photos[0].path);
|
||||
Get.back();
|
||||
destinationController.rogaining_counted.value = true;
|
||||
destinationController.skip_gps = false;
|
||||
@ -147,7 +181,7 @@ class CameraPage extends StatelessWidget {
|
||||
children: [
|
||||
Obx(() => ElevatedButton(
|
||||
onPressed: () {
|
||||
destinationController.openCamera(context);
|
||||
destinationController.openCamera(context, destination);
|
||||
},
|
||||
child: destinationController.photos.isNotEmpty
|
||||
? const Text("再撮影")
|
||||
@ -167,19 +201,6 @@ class CameraPage extends StatelessWidget {
|
||||
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){
|
||||
// print("---called ext api ${value['status']} ------");
|
||||
// if(value['status'] == 'OK'){
|
||||
// Get.back();
|
||||
// destinationController.skip_gps = false;
|
||||
// Get.snackbar("Checked in", "Checked in successfuly");
|
||||
// }
|
||||
// else{
|
||||
// print("---- status ${value['status']} ---- ");
|
||||
// Get.snackbar("Checkin not added", "please_try_again");
|
||||
// }
|
||||
// });
|
||||
},
|
||||
child: const Text("チェックイン"))
|
||||
: Container())
|
||||
@ -194,7 +215,12 @@ class CameraPage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (destinationController.is_in_rog.value) {
|
||||
if(buyPointPhoto == true){
|
||||
print("--- buy point camera ${destination.toString()}");
|
||||
return BuyPointCamera(destination: destination!);
|
||||
}
|
||||
else if (destinationController.is_in_rog.value) {
|
||||
print("--- in normal camera ${destination.toString()}");
|
||||
return Scaffold(
|
||||
appBar: destinationController.is_in_rog.value &&
|
||||
destinationController.rogaining_counted.value == true
|
||||
@ -284,8 +310,50 @@ class StartRogaining extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class NotAtGoal extends StatelessWidget {
|
||||
NotAtGoal({Key? key}) : super(key: key);
|
||||
// class NotAtGoal extends StatelessWidget {
|
||||
// NotAtGoal({Key? key}) : super(key: key);
|
||||
|
||||
// DestinationController destinationController =
|
||||
// Get.find<DestinationController>();
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Scaffold(
|
||||
// appBar: AppBar(
|
||||
// title: Text(
|
||||
// "Not reached the goal yet".tr,
|
||||
// ),
|
||||
// ),
|
||||
// body: Container(
|
||||
// child: Center(
|
||||
// child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// Text("You have not reached the goal yet.".tr,
|
||||
// style: const TextStyle(fontSize: 24)),
|
||||
// const SizedBox(
|
||||
// height: 40.0,
|
||||
// ),
|
||||
// ElevatedButton(
|
||||
// onPressed: () {
|
||||
// Get.back();
|
||||
// destinationController.skip_gps = false;
|
||||
// },
|
||||
// child: const Text("Back"),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
class BuyPointCamera extends StatelessWidget {
|
||||
BuyPointCamera({Key? key, required this.destination}) : super(key: key);
|
||||
|
||||
Destination destination;
|
||||
|
||||
DestinationController destinationController =
|
||||
Get.find<DestinationController>();
|
||||
@ -295,29 +363,57 @@ class NotAtGoal extends StatelessWidget {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
"Not reached the goal yet".tr,
|
||||
"CPです。撮影してください。\n ${destination.sub_loc_id} : ${destination.location_id}",
|
||||
),
|
||||
),
|
||||
body: Container(
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
body: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Text("You have not reached the goal yet.".tr,
|
||||
style: const TextStyle(fontSize: 24)),
|
||||
const SizedBox(
|
||||
height: 40.0,
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Center(
|
||||
child: Obx(
|
||||
() => Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: 370,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: getFinishImage(), fit: BoxFit.cover)),
|
||||
),
|
||||
ElevatedButton(
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: const Text("チェックインしました。"),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Obx(() => ElevatedButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
destinationController.skip_gps = false;
|
||||
destinationController.openCamera(context, destination);
|
||||
},
|
||||
child: const Text("Back"),
|
||||
),
|
||||
child: destinationController.photos.isNotEmpty
|
||||
? const Text("再撮影")
|
||||
: const Text("撮影"))),
|
||||
Obx(() => destinationController.photos.isNotEmpty
|
||||
? ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(backgroundColor: Colors.red),
|
||||
onPressed: () async {
|
||||
await destinationController.makeBuyPoint(
|
||||
destination, destinationController.photos[0].path);
|
||||
Get.back();
|
||||
destinationController.rogaining_counted.value = true;
|
||||
destinationController.skip_gps = false;
|
||||
destinationController.is_photo_shoot.value = false;
|
||||
Get.snackbar("追加した", "領収書の写真を追加しました");
|
||||
},
|
||||
child: const Text("チェックイン"))
|
||||
: Container())
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -132,20 +132,23 @@ class DestinationController extends GetxController {
|
||||
|
||||
Future<void> startTimer(Destination d, double distance) async {
|
||||
print("=== passed dest is ${d.location_id} ${d.checkedin} ====");
|
||||
//skip_gps = true;
|
||||
skip_gps = true;
|
||||
print("---- in startTimer ----");
|
||||
|
||||
DatabaseHelper db = DatabaseHelper.instance;
|
||||
List<Destination> ds = await db.getDestinationByLatLon(d.lat!, d.lon!);
|
||||
Destination? dss;
|
||||
if(ds.isNotEmpty){
|
||||
if (ds.isNotEmpty) {
|
||||
dss = ds.first;
|
||||
}
|
||||
|
||||
double checkinRadious = d.checkin_radious ?? double.infinity;
|
||||
bool autoCheckin = d.auto_checkin == 0 ? false : true;
|
||||
bool buyPoint = dss != null && dss.buy_point != null && dss.buy_point! > 0 ? true : false;
|
||||
bool buyPointImageAdded = dss != null && dss.buypoint_image != null ? true : false;
|
||||
bool buyPoint = dss != null && dss.buy_point != null && dss.buy_point! > 0
|
||||
? true
|
||||
: false;
|
||||
bool buyPointImageAdded =
|
||||
dss != null && dss.buypoint_image != null ? true : false;
|
||||
bool locationAlreadyCheckedIn =
|
||||
ds.length > 0 && ds[0].checkedin == true ? true : false;
|
||||
bool isuserLoggedIn = indexController.currentUser.isNotEmpty ? true : false;
|
||||
@ -170,7 +173,8 @@ class DestinationController extends GetxController {
|
||||
constraints: BoxConstraints.loose(Size(Get.width, Get.height * 0.75)),
|
||||
context: Get.context!,
|
||||
isScrollControlled: true,
|
||||
builder: ((context) => CameraPage())).whenComplete(() {
|
||||
builder: ((context) =>
|
||||
CameraPage(destination: dss))).whenComplete(() {
|
||||
skip_gps = false;
|
||||
chekcs = 0;
|
||||
is_in_checkin.value = false;
|
||||
@ -192,7 +196,9 @@ class DestinationController extends GetxController {
|
||||
BoxConstraints.loose(Size(Get.width, Get.height * 0.75)),
|
||||
context: Get.context!,
|
||||
isScrollControlled: true,
|
||||
builder: ((context) => BottomSheetNew())).whenComplete(() {
|
||||
builder: ((context) => BottomSheetNew(
|
||||
destination: d,
|
||||
))).whenComplete(() {
|
||||
skip_gps = false;
|
||||
chekcs = 0;
|
||||
is_at_start.value = false;
|
||||
@ -208,7 +214,9 @@ class DestinationController extends GetxController {
|
||||
BoxConstraints.loose(Size(Get.width, Get.height * 0.75)),
|
||||
context: Get.context!,
|
||||
isScrollControlled: true,
|
||||
builder: ((context) => BottomSheetNew())).whenComplete(() {
|
||||
builder: ((context) => BottomSheetNew(
|
||||
destination: d,
|
||||
))).whenComplete(() {
|
||||
skip_gps = false;
|
||||
chekcs = 0;
|
||||
is_in_checkin.value = false;
|
||||
@ -265,7 +273,9 @@ class DestinationController extends GetxController {
|
||||
expand: true,
|
||||
context: Get.context!,
|
||||
backgroundColor: Colors.transparent,
|
||||
builder: (context) => BottomSheetNew()).whenComplete(() {
|
||||
builder: (context) => BottomSheetNew(
|
||||
destination: d,
|
||||
)).whenComplete(() {
|
||||
skip_gps = false;
|
||||
chekcs = 0;
|
||||
is_in_checkin.value = false;
|
||||
@ -296,7 +306,8 @@ class DestinationController extends GetxController {
|
||||
context: Get.context!,
|
||||
isScrollControlled: true,
|
||||
builder: ((context) => CameraPage(
|
||||
destination: d,
|
||||
buyPointPhoto: true,
|
||||
destination: dss,
|
||||
dbDest: ds.first,
|
||||
))).whenComplete(() {
|
||||
skip_gps = false;
|
||||
@ -329,7 +340,7 @@ class DestinationController extends GetxController {
|
||||
context: Get.context!,
|
||||
isScrollControlled: true,
|
||||
builder: ((context) => CameraPage(
|
||||
destination: d,
|
||||
destination: dss,
|
||||
))).whenComplete(() {
|
||||
skip_gps = false;
|
||||
chekcs = 0;
|
||||
@ -348,7 +359,9 @@ class DestinationController extends GetxController {
|
||||
BoxConstraints.loose(Size(Get.width, Get.height * 0.75)),
|
||||
context: Get.context!,
|
||||
isScrollControlled: true,
|
||||
builder: ((context) => BottomSheetNew())).whenComplete(() {
|
||||
builder: ((context) => BottomSheetNew(
|
||||
destination: d,
|
||||
))).whenComplete(() {
|
||||
print("----- finished start -------");
|
||||
skip_gps = false;
|
||||
chekcs = 0;
|
||||
@ -402,7 +415,7 @@ class DestinationController extends GetxController {
|
||||
});
|
||||
}
|
||||
|
||||
void openCamera(BuildContext context) {
|
||||
void openCamera(BuildContext context, Destination? destination) {
|
||||
photos.clear();
|
||||
Navigator.push(
|
||||
context,
|
||||
@ -437,17 +450,15 @@ class DestinationController extends GetxController {
|
||||
return null;
|
||||
}
|
||||
|
||||
void CallforCheckin(Destination d) {
|
||||
Future<void> CallforCheckin(Destination d) async {
|
||||
bool autoCheckin = d.auto_checkin == 0 ? false : true;
|
||||
print("---- f- checkin ${d.sub_loc_id} ----");
|
||||
if (autoCheckin) {
|
||||
if (!checking_in) {
|
||||
print(
|
||||
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ make checkin ${d.sub_loc_id}@@@@@@@@@@@");
|
||||
makeCheckin(d, true, "");
|
||||
if (d.cp != -1) {
|
||||
rogaining_counted.value = true;
|
||||
}
|
||||
skip_gps = false;
|
||||
}
|
||||
} else {
|
||||
print("--- hidden loc ${d.hidden_location} ----");
|
||||
@ -460,19 +471,47 @@ class DestinationController extends GetxController {
|
||||
chekcs = 3;
|
||||
is_in_checkin.value = true;
|
||||
photos.clear();
|
||||
showModalBottomSheet(
|
||||
await showModalBottomSheet(
|
||||
constraints:
|
||||
BoxConstraints.loose(Size(Get.width, Get.height * 0.75)),
|
||||
context: Get.context!,
|
||||
isScrollControlled: true,
|
||||
builder: ((context) => CameraPage(
|
||||
manulaCheckin: true,
|
||||
destination: d,
|
||||
))).whenComplete(() async {
|
||||
if (d.buy_point != null && d.buy_point! > 0) {
|
||||
skip_gps = true;
|
||||
photos.clear();
|
||||
DatabaseHelper db = DatabaseHelper.instance;
|
||||
List<Destination> ds =
|
||||
await db.getDestinationByLatLon(d.lat!, d.lon!);
|
||||
Destination? dss;
|
||||
if (ds.isNotEmpty) {
|
||||
dss = ds.first;
|
||||
}
|
||||
|
||||
await showModalBottomSheet(
|
||||
constraints:
|
||||
BoxConstraints.loose(Size(Get.width, Get.height * 0.75)),
|
||||
context: Get.context!,
|
||||
isScrollControlled: true,
|
||||
builder: ((context) => CameraPage(
|
||||
buyPointPhoto: true,
|
||||
destination: d,
|
||||
dbDest: dss,
|
||||
))).whenComplete(() {
|
||||
skip_gps = false;
|
||||
//rogaining_counted.value = true;
|
||||
rogaining_counted.value = true;
|
||||
chekcs = 0;
|
||||
is_in_checkin.value = false;
|
||||
});
|
||||
} else {
|
||||
skip_gps = false;
|
||||
chekcs = 0;
|
||||
is_in_checkin.value = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Get.snackbar("始まっていない", "ロゲイニングを始める必要があります");
|
||||
}
|
||||
@ -504,7 +543,7 @@ class DestinationController extends GetxController {
|
||||
//near a location
|
||||
print("---- before call startTimerLocation ----");
|
||||
await startTimerLocation(fs, distFs);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
print("--- 123 ---- $skip_gps----");
|
||||
|
||||
@ -58,7 +58,7 @@ class DestinationMapPage extends StatelessWidget {
|
||||
isScrollControlled: true,
|
||||
constraints: BoxConstraints.loose(
|
||||
Size(Get.width, Get.height * 0.75)),
|
||||
builder: ((context) => BottomSheetNew())).whenComplete(() {
|
||||
builder: ((context) => BottomSheetNew(destination: d,))).whenComplete(() {
|
||||
print("---- set skip gps to false -----");
|
||||
destinationController.skip_gps = false;
|
||||
});
|
||||
|
||||
@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_typeahead/flutter_typeahead.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/pages/search/search_controller.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||
@ -84,6 +86,8 @@ class SearchPage extends StatelessWidget {
|
||||
onSuggestionSelected: (GeoJsonFeature suggestion) {
|
||||
indexController.currentFeature.clear();
|
||||
indexController.currentFeature.add(suggestion);
|
||||
DestinationController destinationController = Get.find<DestinationController>();
|
||||
Destination des = destinationController.festuretoDestination(suggestion);
|
||||
Get.back();
|
||||
showModalBottomSheet(
|
||||
constraints:
|
||||
@ -91,7 +95,7 @@ class SearchPage extends StatelessWidget {
|
||||
isScrollControlled: true,
|
||||
context: context,
|
||||
//builder: (context) => BottomSheetWidget(),
|
||||
builder: ((context) => BottomSheetNew()));
|
||||
builder: ((context) => BottomSheetNew(destination: des,)));
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
@ -50,7 +50,9 @@ class DatabaseHelper{
|
||||
buy_point REAL,
|
||||
hidden_location INTEGER,
|
||||
checkin_image TEXT,
|
||||
buypoint_image TEXT
|
||||
buypoint_image TEXT,
|
||||
forced_checkin INTEGER,
|
||||
recipt_times INTEGER
|
||||
)
|
||||
''');
|
||||
|
||||
|
||||
@ -17,11 +17,12 @@ 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);
|
||||
BottomSheetNew({Key? key, required this.destination}) : super(key: key);
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
final DestinationController destinationController =
|
||||
Get.find<DestinationController>();
|
||||
Destination destination;
|
||||
|
||||
Image getImage() {
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
@ -108,7 +109,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
print('---- rog_mode ----- ${indexController.rog_mode} -----');
|
||||
return indexController.rog_mode == 0
|
||||
? detailsSheet(context)
|
||||
: Container(width: 200, height: 250, color: Colors.purple,); //destinationSheet(context);
|
||||
: destinationSheet(context);
|
||||
}
|
||||
|
||||
// Show destination detais
|
||||
@ -555,22 +556,18 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
backgroundColor:
|
||||
Theme.of(context).colorScheme.secondary),
|
||||
onPressed: () async {
|
||||
final Destination dd =
|
||||
destinationController.festuretoDestination(
|
||||
indexController.currentFeature[0]);
|
||||
print("----- name of dest ${dd.name} ----");
|
||||
if (dd.cp == -1) {
|
||||
if (destination.cp == -1) {
|
||||
destinationController.is_in_rog.value = true;
|
||||
destinationController.addToRogaining(
|
||||
destinationController.current_lat,
|
||||
destinationController.current_lon,
|
||||
dd.location_id!);
|
||||
destination.location_id!);
|
||||
saveGameState();
|
||||
ExternalService()
|
||||
.StartRogaining()
|
||||
.then((value) => Get.back());
|
||||
} else {
|
||||
destinationController.CallforCheckin(dd);
|
||||
await destinationController.CallforCheckin(destination);
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
|
||||
@ -198,7 +198,7 @@ class DestinationWidget extends StatelessWidget {
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
//builder:((context) => BottomSheetWidget())
|
||||
builder: ((context) => BottomSheetNew()));
|
||||
builder: ((context) => BottomSheetNew(destination: fs,)));
|
||||
}
|
||||
},
|
||||
onLongPress: () {
|
||||
|
||||
@ -115,6 +115,7 @@ class _ListWidgetState extends State<ListWidget> {
|
||||
onTap: () {
|
||||
GeoJsonFeature gf =
|
||||
indexController.locations[0].collection[index];
|
||||
Destination des = destinationController.festuretoDestination(gf);
|
||||
changeCurrentFeature(gf);
|
||||
showModalBottomSheet(
|
||||
constraints: BoxConstraints.loose(
|
||||
@ -122,7 +123,7 @@ class _ListWidgetState extends State<ListWidget> {
|
||||
isScrollControlled: true,
|
||||
context: context,
|
||||
//builder: (context) => BottomSheetWidget(),
|
||||
builder: ((context) => BottomSheetNew()));
|
||||
builder: ((context) => BottomSheetNew(destination: des,)));
|
||||
},
|
||||
leading: getImage(index),
|
||||
title: indexController.locations[0].collection[index]
|
||||
|
||||
@ -7,6 +7,7 @@ import 'package:flutter_polyline_points/flutter_polyline_points.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/utils/text_util.dart';
|
||||
@ -41,13 +42,15 @@ class MapWidget extends StatelessWidget {
|
||||
//print("----- fs is ${fs.properties!['photos']}");
|
||||
indexController.getAction();
|
||||
|
||||
Destination des = destinationController.festuretoDestination(fs);
|
||||
|
||||
showModalBottomSheet(
|
||||
constraints:
|
||||
BoxConstraints.loose(Size(Get.width, Get.height * 0.75)),
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
isDismissible: true,
|
||||
builder: ((context) => BottomSheetNew())
|
||||
builder: ((context) => BottomSheetNew(destination: des,))
|
||||
//builder:((context) => BottomSheetWidget())
|
||||
).whenComplete(() {
|
||||
destinationController.skip_gps = false;
|
||||
|
||||
Reference in New Issue
Block a user