update to server location popup

This commit is contained in:
Mohamed Nouffer
2022-10-30 21:43:29 +05:30
parent 2d9f7a9633
commit d16d97f64f
17 changed files with 700 additions and 241 deletions

View File

@ -19,38 +19,9 @@ class CameraPage extends StatelessWidget {
}
}
// void finishRog(){
// destinationController.addToRogaining(destinationController.current_lat, destinationController.current_lon, destination_id)
// }
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("finishing_rogaining".tr),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Padding(
padding: 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
)
),
),
),
),
),
Row(
Widget getAction(BuildContext context){
if(destinationController.is_at_goal.value && destinationController.is_in_rog.value){
return Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
ElevatedButton(
@ -81,9 +52,12 @@ class CameraPage extends StatelessWidget {
print("---called ext api ${value['status']} ------");
if(value['status'] == 'OK'){
Get.back();
destinationController.skip_gps = false;
Get.snackbar("goal_saved", "goal_added_successfuly");
destinationController.resetRogaining();
}
else{
print("---- status ${value['status']} ---- ");
Get.snackbar("goal_not_added", "please_try_again");
}
});
@ -93,9 +67,127 @@ class CameraPage extends StatelessWidget {
Container()
)
],
)
],
);
}
else{
return ElevatedButton(
child: Text("Checking image"),
onPressed: (){
Get.back();
},
);
}
}
// void finishRog(){
// destinationController.addToRogaining(destinationController.current_lat, destinationController.current_lon, destination_id)
// }
@override
Widget build(BuildContext context) {
if(destinationController.is_at_goal.value){
return Scaffold(
appBar: AppBar(
title: Text("finishing_rogaining".tr),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Padding(
padding: 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
)
),
),
),
),
),
getAction(context),
],
),
);
}
else if(destinationController.rogaining_counted.value == true) {
return NotAtGoal();
}
else {
return StartRogaining();
}
}
}
class StartRogaining extends StatelessWidget {
StartRogaining({Key? key}) : super(key: key);
DestinationController destinationController = Get.find<DestinationController>();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Not started yet".tr,),
),
body: Container(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("You have not started rogaining yet.".tr, style: TextStyle(fontSize: 24)),
SizedBox(height: 40.0,),
ElevatedButton(
onPressed: (){
Get.back();
destinationController.skip_gps = false;
},
child: Text("Back"),
),
],
),
),
),
);
}
}
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: TextStyle(fontSize: 24)),
SizedBox(height: 40.0,),
ElevatedButton(
onPressed: (){
Get.back();
destinationController.skip_gps = false;
},
child: Text("Back"),
),
],
),
),
),
);
}
}

View File

@ -12,6 +12,7 @@ import 'package:get/get.dart';
import 'package:latlong2/latlong.dart';
import 'package:rogapp/model/Rogaining.dart';
import 'package:rogapp/model/destination.dart';
import 'package:rogapp/pages/camera/camera_page.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/routes/app_pages.dart';
import 'package:rogapp/services/action_service.dart';
@ -20,6 +21,7 @@ import 'package:rogapp/services/external_service.dart';
import 'package:rogapp/services/maxtrix_service.dart';
import 'package:rogapp/services/reacking_service.dart';
import 'package:rogapp/utils/database_helper.dart';
import 'package:rogapp/widgets/bottom_sheet_new.dart';
import 'dart:async';
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
@ -31,17 +33,19 @@ class DestinationController extends GetxController {
var destinationCount = 0.obs;
List<Destination> destinations = <Destination>[].obs;
List<Map<String, dynamic>> destination_index_data = <Map<String, dynamic>>[].obs;
double current_lat = 0.0;
double current_lon = 0.0;
List<Destination> currentSelectedDestinations = <Destination>[].obs;
List<Destination> currentSelectedDestinations = <Destination>[].obs;
var is_in_checkin = false.obs;
var is_in_rog = false.obs;
List<Rogaining> rogainings = <Rogaining>[].obs;
var is_at_start = false.obs;
var is_at_goal = false.obs;
//List<Rogaining> rogainings = <Rogaining>[].obs;
bool checking_in = false;
var isSelected = false.obs;
var is_gps_selected = true.obs;
BuildContext? context;
List<String> gps = <String>["-- stating --"].obs;
@ -49,6 +53,8 @@ class DestinationController extends GetxController {
var travelMode = 0.obs;
bool skip_gps = false;
Map<String, dynamic> matrix = {};
@ -57,34 +63,284 @@ class DestinationController extends GetxController {
final IndexController indexController = Get.find<IndexController>();
Timer? _timer;
int _start = 1;
int _start = 0;
int _chekcs = 0;
var rogaining_counted = false.obs;
void startTimer(Destination d, double distance) {
Destination festuretoDestination(GeoJsonFeature fs){
GeoJsonMultiPoint mp = fs.geometry as GeoJsonMultiPoint;
LatLng pt = LatLng(mp.geoSerie!.geoPoints[0].latitude, mp.geoSerie!.geoPoints[0].longitude);
//print("----- ${indexController.currentFeature[0].properties} -----");
return Destination(
name: fs.properties!["location_name"],
address: fs.properties!["address"],
phone: fs.properties!["phone"],
email: fs.properties!["email"],
webcontents: fs.properties!["webcontents"],
videos: fs.properties!["videos"],
category: fs.properties!["category"],
series: 1,
lat: pt.latitude,
lon: pt.longitude,
location_id: fs.properties!["location_id"],
list_order: 1,
photos: fs.properties!["photos"],
checkin_radious: fs.properties!["checkin_radius"],
auto_checkin: fs.properties!["auto_checkin"] == true ? 1 : 0,
cp: fs.properties!["cp"],
checkin_point: fs.properties!["checkin_point"],
buy_point: fs.properties!["buy_point"],
selected: false,
checkedin: false,
hidden_location: fs.properties!["hidden_location"] == true ?1 : 0
);
}
void startTimerLocation(GeoJsonFeature fs, double distance) {
print("---- in startTimer ----");
double checkin_radious = fs.properties!['checkin_radius'] ?? double.infinity;
if(checkin_radious >= distance){
indexController.currentDestinationFeature.clear();
Destination d = festuretoDestination(fs);
indexController.currentDestinationFeature.add(d);
print("---- before calling startTimer ----");
startTimer(d, distance);
}
}
void startTimer(Destination d, double distance) async {
skip_gps = true;
print("---- in startTimer ----");
double checkin_radious = d.checkin_radious ?? double.infinity;
bool auto_checkin = d.auto_checkin == 0 ? false : true;
bool location_already_checked_in = d.checkedin ?? false;
bool isUser_logged_in = indexController.currentUser.length > 0 ? true : false;
//make current destination
print("---- checkin_radious ${checkin_radious} ----");
print("---- distance ${distance} ----");
if(checkin_radious >= distance){
//currentSelectedDestinations.add(d);
indexController.currentDestinationFeature.clear();
indexController.currentDestinationFeature.add(d);
print("---- checked in as ${indexController.currentDestinationFeature[0].checkedin.toString()} ----");
}
else {
skip_gps = false;
return;
}
DatabaseHelper db = DatabaseHelper.instance;
List<Destination> ds = await db.getDestinationByLatLon(d.lat!, d.lon!);
if(ds.isEmpty){
print("----- in location popup cp - ${d.cp}----");
if(d.cp == -1){
_chekcs = 1;
//start
print("---- in start -----");
_chekcs = 1;
is_at_start.value = true;
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
builder:((context) => BottomSheetNew())
).whenComplete((){
skip_gps = false;
_chekcs = 0;
is_at_start.value = false;
});
}
else
{
print("----- in location popup checkin cp - ${d.cp}----");
_chekcs = 1;
//is_in_checkin.value = true;
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
builder:((context) => BottomSheetNew())
).whenComplete((){
skip_gps = false;
_chekcs = 0;
is_in_checkin.value = false;
});
}
}
print("---- location checkin radious ${d.checkin_radious} ----");
print("---- already checked in ${location_already_checked_in} ----");
if(checkin_radious >= distance && location_already_checked_in == false){
if(auto_checkin){
if(!checking_in){
makeCheckin(d, true);
if(d.cp != -1){
rogaining_counted.value =true;
}
skip_gps = false;
}
}
else{
// ask for checkin
if(d.hidden_location != null && d.hidden_location ==true && is_in_rog.value == true){
_chekcs = 1;
is_in_checkin.value = true;
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
builder:((context) => CameraPage())
).whenComplete((){
skip_gps = false;
_chekcs = 0;
is_in_checkin.value = false;
});
}
else if(is_in_rog.value == true){
_chekcs = 1;
is_in_checkin.value = true;
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
builder:((context) => BottomSheetNew())
).whenComplete((){
skip_gps = false;
_chekcs = 0;
is_in_checkin.value = false;
});
}
}
}
if(isUser_logged_in && d.cp == -1 && location_already_checked_in){
//check for rogaining
if(is_at_goal.value == false && rogaining_counted.value){
//goal
print("---- in goal -----");
_chekcs = 1;
is_at_goal.value = true;
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
builder:((context) => CameraPage())
).whenComplete((){
skip_gps = false;
_chekcs = 0;
is_at_goal.value = false;
});
}
else if(is_in_rog.value == false){
//start
print("---- in start -----");
_chekcs = 1;
is_at_start.value = true;
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
builder:((context) => BottomSheetNew())
).whenComplete((){
skip_gps = false;
_chekcs = 0;
is_at_start.value = false;
});
}
}
print("---- _chekcs ${_chekcs} ----");
if(_chekcs == 0){
skip_gps = false;
}
}
void startTimer2(Destination d, double distance) {
skip_gps = true;
print("---- in startTimer ----");
double checkin_radious = d.checkin_radious ?? double.infinity;
bool auto_checkin = d.auto_checkin == 0 ? false : true;
bool location_already_checked_id = d.checkedin ?? false;
bool isUser_logged_in = indexController.currentUser.length > 0 ? true : false;
//make current destination
print("---- checkin_radious ${checkin_radious} ----");
print("---- distance ${distance} ----");
if(checkin_radious >= distance){
//currentSelectedDestinations.add(d);
indexController.currentDestinationFeature.clear();
indexController.currentDestinationFeature.add(d);
print("---- checked in as ${indexController.currentDestinationFeature[0].checkedin.toString()} ----");
}
const oneSec = const Duration(seconds: 1);
_timer = Timer.periodic(
oneSec,
(Timer timer) {
if (_start == 0) {
if(is_in_rog.value == false){
is_in_rog.value = true;
addToRogaining(current_lat, current_lon, d.location_id!);
Get.snackbar("Rogaining Started ", "Rogaining session started");
//make checkin
print("---- location checkin radious ${d.checkin_radious} ----");
print("---- already checked in ${location_already_checked_id} ----");
if(checkin_radious >= distance && location_already_checked_id == false){
if(auto_checkin){
if(!checking_in){
makeCheckin(d, true);
if(d.cp != -1){
rogaining_counted.value =true;
}
skip_gps = false;
}
}
else{
// ask for checkin
_chekcs = 1;
is_in_checkin.value = true;
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
builder:((context) => BottomSheetNew())
).whenComplete((){
skip_gps = false;
_chekcs = 0;
is_in_checkin.value = false;
});
}
}
else{
//finish rogiain
if (rogaining_counted.value && distance <=250){
Get.toNamed(AppPages.CAMERA_PAGE);
if(isUser_logged_in && d.cp == -1 && location_already_checked_id){
//check for rogaining
if(is_at_goal.value == false && rogaining_counted.value){
//goal
print("---- in goal -----");
_chekcs = 1;
is_at_goal.value = true;
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
builder:((context) => BottomSheetNew())
).whenComplete((){
skip_gps = false;
_chekcs = 0;
is_at_goal.value = false;
});
}
else if(is_in_rog.value == false){
//start
print("---- in start -----");
_chekcs = 1;
is_at_start.value = true;
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
builder:((context) => BottomSheetNew())
).whenComplete((){
skip_gps = false;
_chekcs = 0;
is_at_start.value = false;
});
}
}
timer.cancel();
} else {
_start--;
}
print("---- _chekcs ${_chekcs} ----");
if(_chekcs == 0){
skip_gps = false;
}
},
);
}
void resetRogaining(){
is_in_checkin.value = false;
is_in_rog.value = false;
is_at_start.value = false;
is_at_goal.value = false;
_start = 0;
_chekcs = 0;
rogaining_counted.value = false;
}
void openCamera(BuildContext context) {
photos.clear();
Navigator.push(
@ -110,10 +366,8 @@ class DestinationController extends GetxController {
});
}
Future<Destination?> getDEstinationForLatLong(double lat, double long)async {
Future<Destination?> getDestinationForLatLong(double lat, double long)async {
String jjjj = '{"id":1,"type":"Feature","geometry":{"type":"MultiPoint","coordinates":[[136.731357,35.370094]]},"properties":{"location_id":915101,"location_name":"柳津","category":"買い物","zip":"〒501-6100","address":"柳津町字仙右城7696-1"}}';
for(final d in destinations){
if(lat == d.lat && long == d.lon){
return d;
@ -121,90 +375,67 @@ class DestinationController extends GetxController {
}
}
// void addToRogaining(Rogaining rog){
// DatabaseHelper db = DatabaseHelper.instance;
// db.insertRogaining(rog);
// }
void checkForCheckin(double la, double ln){
checkForCheckin(double la, double ln){
print("--- skip_gps ---- ${skip_gps}----");
for(final d in destinations){
print("-----loc_id- ${d.location_id}----");
print("--- check checkin for--loc_id- ${d.location_id}----");
if(!checking_in)
{
checking_in = true;
double lat = d.lat!;
double lon = d.lon!;
LatLng p = LatLng(lat, lon);
getDEstinationForLatLong(lat, lon).then((value){
getDestinationForLatLong(lat, lon).then((value){
var distance = Distance();
double dist = distance.as(LengthUnit.Meter, LatLng(lat, lon), LatLng(la, ln));
double rad = value!.checkin_radious ?? double.infinity;
bool auto_checkin = value.auto_checkin == 0 ? false : true;
//double checkin_radious = value!.checkin_radious ?? double.infinity;
//bool auto_checkin = value.auto_checkin == 0 ? false : true;
//bool location_already_checked_id = d.checkedin ?? false;
print("-----rogaining_counted---${rogaining_counted.value}-----");
print("-----is_in_rog---${is_in_rog}-----");
print("-----dist is ---${dist}-----");
// print("-----rogaining_counted---${rogaining_counted.value}-----");
// print("-----is_in_rog---${is_in_rog}-----");
// print("-----dist is ---${dist}-----");
//print("----- ${indexController.currentUser} ----");
if(d.cp != -1 && is_in_rog == true){
rogaining_counted.value == true;
}
if(d.cp == -1 && dist <= 250 && rogaining_counted.value == false){
if(dist <= 250 && skip_gps == false){
//near a destination
print("---- time with ${d.location_id} ----");
startTimer(d, dist);
}
indexController.currentDestinationFeature.add(value);
//indexController.getAction();
if(rad >= dist){
if(auto_checkin){
makeCheckin(value, true);
}
else{
// showModalBottomSheet(context: Get.context!, isScrollControlled: true,
// builder:((context) => BottomSheetWidget())
// ).whenComplete((){
// checking_in = false;
// });
}
}
// if(!checking_in){
// checking_in = true;
// if(rad >= dist){
// if(auto_checkin){
// if(indexController.currentAction.isNotEmpty){
// print(indexController.currentAction[0]);
// indexController.currentAction[0][0]["checkin"] = true;
// Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
// indexController.currentAction.clear();
// print("---temp---${temp}");
// indexController.currentAction.add([temp]);
// }
// indexController.makeAction(Get.context!);
// }
// else{
// showModalBottomSheet(context: Get.context!, isScrollControlled: true,
// builder:((context) => BottomSheetWidget())
// ).whenComplete((){
// checking_in = false;
// });
// }
// }
// }
});
}
}
//check for location in bounds
for(GeoJsonFeature fs in indexController.locations[0].collection){
GeoJsonMultiPoint mp = fs.geometry as GeoJsonMultiPoint;
LatLng pt = LatLng(mp.geoSerie!.geoPoints[0].latitude, mp.geoSerie!.geoPoints[0].longitude);
double lat_fs = pt.latitude;
double lon_fs = pt.longitude;
LatLng p_fs = LatLng(lat_fs, lon_fs);
var distance_fs = Distance();
double dist_fs = distance_fs.as(LengthUnit.Meter, LatLng(lat_fs, lon_fs), LatLng(la, ln));
if(dist_fs <= 250 && skip_gps == false){
//near a location
print("---- before call startTimerLocation ----");
startTimerLocation(fs, dist_fs);
}
}
}
void addToRogaining(double lat, double lon, int destination_id){
void addToRogaining(double lat, double lon, int destination_id) async {
DatabaseHelper db = DatabaseHelper.instance;
Destination d = await db.getDestinationById(destination_id);
if(d == null){
Destination df = festuretoDestination(indexController.currentFeature[0]);
makeCheckin(df, true);
}
Rogaining rog = Rogaining(
rog_id: null,
course_id: 1,
@ -214,7 +445,6 @@ class DestinationController extends GetxController {
lon:lon,
time_stamp: DateTime.now().toUtc().microsecondsSinceEpoch
);
DatabaseHelper db = DatabaseHelper.instance;
db.insertRogaining(rog).then((value){
print("----- inserted value ${value} ---------");
});
@ -224,15 +454,17 @@ class DestinationController extends GetxController {
// print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${action}@@@@@@@@@@@");
DatabaseHelper db = DatabaseHelper.instance;
int res = await db.updateAction(destination, action);
List<Destination> ddd = await db.getDestinationByLatLon(destination.lat!, destination.lon!);
// print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ddddd ${ddd[0].checkedin} @@@@@@@@@@@");
if(ddd.isEmpty){
await db.insertDestination(destination);
}
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ddddd ${ddd[0].checkedin} @@@@@@@@@@@");
// print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${res}@@@@@@@@@@@");
PopulateDestinations();
// print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ after populating ${res} @@@@@@@@@@@");
// print("---- database update resulr ------ res : ${res}-------");
PopulateDestinations();
/// post to NATNAT
if(indexController.currentUser.length > 0){
int cp_num = int.parse(destination.cp!.toString());
@ -252,14 +484,12 @@ class DestinationController extends GetxController {
//print("------ in iniit");
if (defaultTargetPlatform == TargetPlatform.android) {
locationSettings = AndroidSettings(
accuracy: LocationAccuracy.bestForNavigation,
distanceFilter: 00,
forceLocationManager: true,
intervalDuration: const Duration(seconds: 1),
intervalDuration: const Duration(seconds: 10),
//(Optional) Set foreground notification config to keep the app alive
//when going to the background
foregroundNotificationConfig: const ForegroundNotificationConfig(
@ -273,7 +503,7 @@ class DestinationController extends GetxController {
locationSettings = AppleSettings(
accuracy: LocationAccuracy.bestForNavigation,
activityType: ActivityType.fitness,
distanceFilter: 1,
distanceFilter: 30,
pauseLocationUpdatesAutomatically: false,
// Only set to true if our app will be started up in the background.
showBackgroundLocationIndicator: true
@ -293,7 +523,7 @@ class DestinationController extends GetxController {
current_lat = position != null ? position.latitude : 0;
current_lon = position != null ? position.longitude : 0;
if(isSelected.value){
if(is_gps_selected.value){
double czoom = indexController.rogMapController!.zoom;
indexController.rogMapController!.move(LatLng(position!.latitude, position!.longitude), czoom);
//String user_id = indexController.currentUser[0]["user"]["id"].toString();
@ -302,6 +532,8 @@ class DestinationController extends GetxController {
gps.clear();
gps.add("-- lat : ${position.latitude}, lon : ${position.longitude} --");
checkForCheckin(position!.latitude, position.longitude);
print("--- call check checkin");
print("---- skip gps is ${skip_gps.toString()} ----");
//});
}
@ -342,9 +574,9 @@ class DestinationController extends GetxController {
void deleteDestination(Destination d){
//int id = destinations[index].location_id!;
//print("---- index ${destinations[index].location_id!}-----");
for(Destination ss in currentSelectedDestinations){
for(Destination ss in destinations){
if(ss.location_id == d.location_id){
currentSelectedDestinations.remove(ss);
destinations.remove(ss);
break;
}
}
@ -365,7 +597,7 @@ class DestinationController extends GetxController {
void addDestinations(Destination dest){
print('------ destination controller in add destination ${dest.name} ---- :::::');
print('------ destination controller in add destination ${dest.checkin_radious} ---- :::::');
DatabaseHelper db = DatabaseHelper.instance;
db.getDestinationByLatLon(dest.lat!, dest.lon!).then((value){
@ -395,12 +627,12 @@ class DestinationController extends GetxController {
db.getDestinations().then((value){
destinationCount.value = 0;
for(Destination d in value){
for(Destination s in currentSelectedDestinations){
for(Destination s in destinations){
if(d.location_id == s.location_id){
d.selected = !d.selected!;
}
}
print("------ destination controller populating destination-------- ${d.checkedin}-------- :::::");
destinations.add(d);
}
// destinationCount.value = 0;

View File

@ -160,14 +160,32 @@ class DestnationPage extends StatelessWidget {
automaticallyImplyLeading: true,
title: Text("app_title".tr),
actions: [
TextButton(
onPressed: (){
//ExternalService().StartRogaining('team_name', "2222");
//destinationController.openCamera(context);
InkWell(
onTap: (){
Get.toNamed(AppPages.CAMERA_PAGE);
},
child: Icon(Icons.ac_unit),
},
child: destinationController.is_in_rog == true ?
Image.asset("assets/images/basic-walking.gif",height: 10.0,)
:
destinationController.is_at_goal == true ?
IconButton(
onPressed:(){Get.toNamed(AppPages.CAMERA_PAGE);},
icon: Icon(Icons.assistant_photo),
)
:
IconButton(
onPressed:(){Get.toNamed(AppPages.CAMERA_PAGE);},
icon: Icon(Icons.accessibility),
),
),
// TextButton(
// onPressed: (){
// //ExternalService().StartRogaining('team_name', "2222");
// //destinationController.openCamera(context);
// Get.toNamed(AppPages.CAMERA_PAGE);
// },
// child: Icon(Icons.ac_unit),
// ),
Obx(() =>
ToggleButtons(
disabledColor: Colors.grey.shade200,
@ -176,9 +194,12 @@ class DestnationPage extends StatelessWidget {
Icon(Icons.explore, size: 35.0,
)],
onPressed: (int index) {
destinationController.isSelected.value = !destinationController.isSelected.value;
destinationController.is_gps_selected.value = !destinationController.is_gps_selected.value;
if(destinationController.is_gps_selected.value){
destinationController.skip_gps = false;
}
},
isSelected: [destinationController.isSelected.value],
isSelected: [destinationController.is_gps_selected.value],
),
),
// IconButton(onPressed: (){

View File

@ -131,7 +131,12 @@ class DestinationMapPage extends StatelessWidget {
if (mapEvent is MapEventMoveStart) {
}
if (mapEvent is MapEventMoveEnd) {
destinationController.isSelected.value = false;
//destinationController.is_gps_selected.value = true;
//indexController.mapController!.move(c.center, c.zoom);
LatLngBounds bounds = c.bounds!;
indexController.currentBound.clear();
indexController.currentBound.add(bounds);
indexController.loadLocationsBound();
}
});
});

View File

@ -113,13 +113,6 @@ class IndexController extends GetxController {
@override
void onInit() {
// if(locations.length == 0){
// LocationService.loadLocations().then((value){
// locations.add(value!);
// //print(value);
// });
// }
_ever = ever(rog_mode, (_) => print("$_ has been changed (ever)"));
if(perfectures.length == 0){
@ -215,7 +208,6 @@ void login(String email, String password, BuildContext context){
else{
switchPage(AppPages.INITIAL);
}
//Get.toNamed(AppPages.INITIAL);
}else{
Get.snackbar(
'failed'.tr,
@ -587,7 +579,6 @@ void login(String email, String password, BuildContext context){
if(rog_mode == 1){
DestinationController destinationController = Get.find<DestinationController>();
print("---- destination index--- ${destinationController.destination_index_data} --------");
}
else {
GeoJsonFeature<GeoJsonMultiPoint> pt = fs as GeoJsonFeature<GeoJsonMultiPoint>;
@ -620,7 +611,6 @@ void login(String email, String password, BuildContext context){
if(rog_mode == 1){
DestinationController destinationController = Get.find<DestinationController>();
print("---- destination index--- ${destinationController.destination_index_data} --------");
}
else {

View File

@ -68,19 +68,23 @@ class IndexPage extends GetView<IndexController> {
child: InkWell(
child:
Obx(() =>
destinationController.isSelected == true ?
destinationController.is_gps_selected == true ?
Padding(
padding: const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0),
child: InkWell(
child: Image(image: AssetImage('assets/images/route3_off.png'), width: 35, height: 35,),
onTap: (){Get.toNamed(AppPages.DESTINATION_MAP);},
onTap: (){
indexController.switchPage(AppPages.TRAVEL);
},
),
) :
Padding(
padding: const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0),
child: InkWell(
child: Image(image: AssetImage('assets/images/route2_on.png'),width: 35, height: 35,),
onTap: (){Get.toNamed(AppPages.DESTINATION_MAP);},
onTap: (){
indexController.switchPage(AppPages.TRAVEL);
},
),
)
)