optimized and removed travel mode

This commit is contained in:
Mohamed Nouffer
2023-10-08 19:13:14 +05:30
parent 0e2a8f89f3
commit 0508c50b97
5 changed files with 270 additions and 323 deletions

View File

@ -85,10 +85,6 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
case AppLifecycleState.resumed: case AppLifecycleState.resumed:
//print("RESUMED"); //print("RESUMED");
restoreGame(); restoreGame();
if (destinationController.positionStream == null) {
//destinationController.startGPSTimer();
//destinationController.startGame();
}
break; break;
case AppLifecycleState.inactive: case AppLifecycleState.inactive:
//print("INACTIVE"); //print("INACTIVE");

View File

@ -1,7 +1,5 @@
import 'dart:io'; import 'dart:io';
import 'package:camera_camera/camera_camera.dart'; import 'package:camera_camera/camera_camera.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart'; import 'package:flutter_map/flutter_map.dart';
import 'package:geojson/geojson.dart'; import 'package:geojson/geojson.dart';
@ -30,6 +28,8 @@ import 'package:gallery_saver/gallery_saver.dart';
class DestinationController extends GetxController { class DestinationController extends GetxController {
late LocationSettings locationSettings; late LocationSettings locationSettings;
Timer? _GPStimer;
var destinationCount = 0.obs; var destinationCount = 0.obs;
List<Destination> destinations = <Destination>[].obs; List<Destination> destinations = <Destination>[].obs;
double currentLat = 0.0; double currentLat = 0.0;
@ -54,10 +54,6 @@ class DestinationController extends GetxController {
List<String> gps = <String>["-- stating --"].obs; List<String> gps = <String>["-- stating --"].obs;
List<String> locationPermission = <String>[" -- starting -- "].obs; List<String> locationPermission = <String>[" -- starting -- "].obs;
StreamSubscription<Position>? positionStream;
Timer? gpsTimer;
var travelMode = 0.obs; var travelMode = 0.obs;
bool skipGps = false; bool skipGps = false;
@ -68,7 +64,6 @@ class DestinationController extends GetxController {
final IndexController indexController = Get.find<IndexController>(); final IndexController indexController = Get.find<IndexController>();
Timer? _timer;
int _start = 0; int _start = 0;
int chekcs = 0; int chekcs = 0;
var rogainingCounted = false.obs; var rogainingCounted = false.obs;
@ -110,7 +105,7 @@ class DestinationController extends GetxController {
} }
Future<void> startTimerLocation(GeoJsonFeature fs, double distance) async { Future<void> startTimerLocation(GeoJsonFeature fs, double distance) async {
// print("---- in startTimer ----"); //print("---- in startTimer ----");
// print("---- is in rog is $is_in_rog ----"); // print("---- is in rog is $is_in_rog ----");
double checkinRadious = fs.properties!['checkin_radius'] ?? double.infinity; double checkinRadious = fs.properties!['checkin_radius'] ?? double.infinity;
if (checkinRadious >= distance) { if (checkinRadious >= distance) {
@ -125,7 +120,7 @@ class DestinationController extends GetxController {
} }
Future<void> startTimer(Destination d, double distance) async { Future<void> startTimer(Destination d, double distance) async {
//print("=== passed dest is ${d.location_id} ${d.checkedin} ===="); print("=== passed dest is ${d.location_id} ${d.checkedin} ====");
skipGps = true; skipGps = true;
//print("---- in startTimer ----"); //print("---- in startTimer ----");
@ -388,21 +383,12 @@ class DestinationController extends GetxController {
lastGoalAt = DateTime.fromMicrosecondsSinceEpoch(latgoal); lastGoalAt = DateTime.fromMicrosecondsSinceEpoch(latgoal);
//print("===== last goal : $last_goal_at ====="); //print("===== last goal : $last_goal_at =====");
} }
//deleteDBDestinations();
// currentSelectedDestinations.forEach((element) {
// deleteDestination(element);
// });
} }
void deleteAllDestinations() { void deleteAllDestinations() {
DatabaseHelper db = DatabaseHelper.instance; DatabaseHelper db = DatabaseHelper.instance;
db.deleteAllDestinations().then((value) { db.deleteAllDestinations().then((value) {
populateDestinations(); populateDestinations();
//startGPSTimer();
//startGame();
//initGPS();
}); });
} }
@ -510,13 +496,18 @@ class DestinationController extends GetxController {
} }
Future<void> checkForCheckin() async { Future<void> checkForCheckin() async {
//print("--- Start of checkForCheckin function ---"); print("--- Start of checkForCheckin function ---");
try { try {
//print("--- 000 ---- $skip_gps----"); //print("--- 000 ---- $skip_gps----");
await Future.delayed(const Duration(milliseconds: 2500)); await Future.delayed(const Duration(milliseconds: 2500));
final la = currentLat; Position position = await Geolocator.getCurrentPosition(
final ln = currentLon; desiredAccuracy: LocationAccuracy.bestForNavigation);
currentLat = position.latitude;
currentLon = position.longitude;
final la = position.latitude;
final ln = position.longitude;
for (GeoJsonFeature fs in indexController.locations[0].collection) { for (GeoJsonFeature fs in indexController.locations[0].collection) {
GeoJsonMultiPoint mp = fs.geometry as GeoJsonMultiPoint; GeoJsonMultiPoint mp = fs.geometry as GeoJsonMultiPoint;
LatLng pt = LatLng(mp.geoSerie!.geoPoints[0].latitude, LatLng pt = LatLng(mp.geoSerie!.geoPoints[0].latitude,
@ -525,10 +516,16 @@ class DestinationController extends GetxController {
double latFs = pt.latitude; double latFs = pt.latitude;
double lonFs = pt.longitude; double lonFs = pt.longitude;
var distanceFs = const Distance(); var distanceFs = const Distance();
//print("--- points : ${pt.latitude}, ${pt.longitude} ----");
//print("--- points : ${pt.latitude}, ${pt.longitude} ----");
double distFs = distanceFs.as( double distFs = distanceFs.as(
LengthUnit.Meter, LatLng(latFs, lonFs), LatLng(la, ln)); LengthUnit.Meter, LatLng(latFs, lonFs), LatLng(la, ln));
Destination des = festuretoDestination(fs); Destination des = festuretoDestination(fs);
print(
"--- position is ---- ${position.longitude}, --- ${position.longitude}----");
print("--- distFs ---- $distFs, --- ${des.checkin_radious}----");
if (distFs <= des.checkin_radious! && skipGps == false) { if (distFs <= des.checkin_radious! && skipGps == false) {
//print("--- 789 ---- $skip_gps----"); //print("--- 789 ---- $skip_gps----");
//near a location //near a location
@ -642,21 +639,18 @@ class DestinationController extends GetxController {
} }
Future<void> startGame() async { Future<void> startGame() async {
//print("------ starting game ------");
await checkForCheckin(); await checkForCheckin();
} }
@override @override
void onClose() { void onClose() {
positionStream?.cancel();
gpsTimer?.cancel();
super.onClose(); super.onClose();
super.onClose(); super.onClose();
} }
@override @override
void onInit() async { void onInit() async {
//initGPS();
//startGPSTimer();
startGame(); startGame();
super.onInit(); super.onInit();
} }
@ -697,7 +691,7 @@ class DestinationController extends GetxController {
void fixMapBound(String token) { void fixMapBound(String token) {
//String _token = indexController.currentUser[0]["token"]; //String _token = indexController.currentUser[0]["token"];
indexController.switchPage(AppPages.INITIAL); indexController.switchPage(AppPages.INDEX);
LocationService.getLocationsExt(token).then((value) { LocationService.getLocationsExt(token).then((value) {
if (value != null) { if (value != null) {
//print("--- loc ext is - $value ----"); //print("--- loc ext is - $value ----");

View File

@ -1,252 +1,252 @@
import 'package:flutter/material.dart'; // import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart'; // import 'package:geolocator/geolocator.dart';
import 'package:get/get.dart'; // import 'package:get/get.dart';
import 'package:latlong2/latlong.dart'; // import 'package:latlong2/latlong.dart';
import 'package:rogapp/pages/destination/destination_controller.dart'; // import 'package:rogapp/pages/destination/destination_controller.dart';
import 'package:rogapp/pages/destination_map/destination_map_page.dart'; // import 'package:rogapp/pages/destination_map/destination_map_page.dart';
import 'package:rogapp/pages/drawer/drawer_page.dart'; // import 'package:rogapp/pages/drawer/drawer_page.dart';
import 'package:rogapp/pages/index/index_controller.dart'; // import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/routes/app_pages.dart'; // import 'package:rogapp/routes/app_pages.dart';
import 'package:rogapp/widgets/destination_widget.dart'; // import 'package:rogapp/widgets/destination_widget.dart';
class XDestnationPage extends StatelessWidget { // class XDestnationPage extends StatelessWidget {
XDestnationPage({Key? key}) : super(key: key); // XDestnationPage({Key? key}) : super(key: key);
final DestinationController destinationController = // final DestinationController destinationController =
Get.find<DestinationController>(); // Get.find<DestinationController>();
final IndexController indexController = Get.find<IndexController>(); // final IndexController indexController = Get.find<IndexController>();
final List<int> _items = List<int>.generate(50, (int index) => index); // final List<int> _items = List<int>.generate(50, (int index) => index);
Future<void> showCurrentPosition() async { // Future<void> showCurrentPosition() async {
LocationPermission permission = await Geolocator.checkPermission(); // LocationPermission permission = await Geolocator.checkPermission();
if (permission != LocationPermission.whileInUse || // if (permission != LocationPermission.whileInUse ||
permission != LocationPermission.always) { // permission != LocationPermission.always) {
permission = await Geolocator.requestPermission(); // permission = await Geolocator.requestPermission();
} // }
Position position = await Geolocator.getCurrentPosition( // Position position = await Geolocator.getCurrentPosition(
desiredAccuracy: LocationAccuracy.high, // desiredAccuracy: LocationAccuracy.high,
forceAndroidLocationManager: true); // forceAndroidLocationManager: true);
indexController.rogMapController // indexController.rogMapController
.move(LatLng(position.latitude, position.longitude), 14); // .move(LatLng(position.latitude, position.longitude), 14);
} // }
Image getImage(int index) { // Image getImage(int index) {
if (destinationController.destinations[index].photos == null || // if (destinationController.destinations[index].photos == null ||
destinationController.destinations[index].photos == "") { // destinationController.destinations[index].photos == "") {
return const Image(image: AssetImage('assets/images/empty_image.png')); // return const Image(image: AssetImage('assets/images/empty_image.png'));
} else { // } else {
return Image( // return Image(
image: // image:
NetworkImage(destinationController.destinations[index].photos!)); // NetworkImage(destinationController.destinations[index].photos!));
} // }
} // }
Widget getRoutingImage(int route) { // Widget getRoutingImage(int route) {
switch (route) { // switch (route) {
case 0: // case 0:
return const Image( // return const Image(
image: AssetImage('assets/images/p4_9_man.png'), // image: AssetImage('assets/images/p4_9_man.png'),
width: 35.0, // width: 35.0,
); // );
case 1: // case 1:
return const Image( // return const Image(
image: AssetImage('assets/images/p4_8_car.png'), // image: AssetImage('assets/images/p4_8_car.png'),
width: 35.0, // width: 35.0,
); // );
case 2: // case 2:
return const Image( // return const Image(
image: AssetImage('assets/images/p4_10_train.png'), // image: AssetImage('assets/images/p4_10_train.png'),
width: 35.0, // width: 35.0,
); // );
default: // default:
return const Image( // return const Image(
image: AssetImage('assets/images/p4_9_man.png'), // image: AssetImage('assets/images/p4_9_man.png'),
width: 35.0, // width: 35.0,
); // );
} // }
} // }
@override // @override
Widget build(BuildContext context) { // Widget build(BuildContext context) {
return WillPopScope( // return WillPopScope(
onWillPop: () async { // onWillPop: () async {
indexController.switchPage(AppPages.INITIAL); // indexController.switchPage(AppPages.INITIAL);
return false; // return false;
}, // },
child: Scaffold( // child: Scaffold(
drawer: DrawerPage(), // drawer: DrawerPage(),
bottomNavigationBar: BottomAppBar( // bottomNavigationBar: BottomAppBar(
child: Row( // child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ // children: <Widget>[
Padding( // Padding(
padding: const EdgeInsets.only(left: 13.0), // padding: const EdgeInsets.only(left: 13.0),
child: InkWell( // child: InkWell(
child: Obx((() => getRoutingImage( // child: Obx((() => getRoutingImage(
destinationController.travelMode.value))), // destinationController.travelMode.value))),
onTap: () { // onTap: () {
Get.bottomSheet( // Get.bottomSheet(
Obx( // Obx(
() => ListView( // () => ListView(
children: [ // children: [
Padding( // Padding(
padding: const EdgeInsets.only( // padding: const EdgeInsets.only(
top: 30.0, bottom: 30), // top: 30.0, bottom: 30),
child: Center( // child: Center(
child: Text( // child: Text(
"select_travel_mode".tr, // "select_travel_mode".tr,
style: const TextStyle( // style: const TextStyle(
fontSize: 22.0, // fontSize: 22.0,
color: Colors.red, // color: Colors.red,
fontWeight: FontWeight.bold), // fontWeight: FontWeight.bold),
), // ),
), // ),
), // ),
ListTile( // ListTile(
selected: // selected:
destinationController.travelMode.value == // destinationController.travelMode.value ==
0 // 0
? true // ? true
: false, // : false,
selectedTileColor: Colors.amber.shade200, // selectedTileColor: Colors.amber.shade200,
leading: const Image( // leading: const Image(
image: AssetImage( // image: AssetImage(
'assets/images/p4_9_man.png'), // 'assets/images/p4_9_man.png'),
), // ),
title: Text("walking".tr), // title: Text("walking".tr),
onTap: () { // onTap: () {
destinationController.travelMode.value = 0; // destinationController.travelMode.value = 0;
destinationController // destinationController
.populateDestinations(); // .populateDestinations();
Get.back(); // Get.back();
}, // },
), // ),
ListTile( // ListTile(
selected: // selected:
destinationController.travelMode.value == // destinationController.travelMode.value ==
1 // 1
? true // ? true
: false, // : false,
selectedTileColor: Colors.amber.shade200, // selectedTileColor: Colors.amber.shade200,
leading: const Image( // leading: const Image(
image: AssetImage( // image: AssetImage(
'assets/images/p4_8_car.png'), // 'assets/images/p4_8_car.png'),
), // ),
title: Text("driving".tr), // title: Text("driving".tr),
onTap: () { // onTap: () {
destinationController.travelMode.value = 1; // destinationController.travelMode.value = 1;
destinationController // destinationController
.populateDestinations(); // .populateDestinations();
Get.back(); // Get.back();
}, // },
), // ),
// ListTile( // // ListTile(
// selected: destinationController.travelMode == 2 ? true : false, // // selected: destinationController.travelMode == 2 ? true : false,
// selectedTileColor: Colors.amber.shade200, // // selectedTileColor: Colors.amber.shade200,
// leading: Image(image: AssetImage('assets/images/p4_10_train.png'),), // // leading: Image(image: AssetImage('assets/images/p4_10_train.png'),),
// title: Text("transit".tr), // // title: Text("transit".tr),
// onTap:(){ // // onTap:(){
// destinationController.travelMode.value = 2; // // destinationController.travelMode.value = 2;
// destinationController.PopulateDestinations(); // // destinationController.PopulateDestinations();
// Get.back(); // // Get.back();
// }, // // },
// ), // // ),
], // ],
), // ),
), // ),
isScrollControlled: false, // isScrollControlled: false,
backgroundColor: Colors.white, // backgroundColor: Colors.white,
); // );
//destinationController.PopulateDestinations(); // //destinationController.PopulateDestinations();
}), // }),
), // ),
IconButton( // IconButton(
icon: const Icon( // icon: const Icon(
Icons.travel_explore, // Icons.travel_explore,
size: 35, // size: 35,
), // ),
onPressed: () { // onPressed: () {
indexController.switchPage(AppPages.INITIAL); // indexController.switchPage(AppPages.INITIAL);
}), // }),
], // ],
), // ),
), // ),
floatingActionButton: FloatingActionButton( // floatingActionButton: FloatingActionButton(
onPressed: () { // onPressed: () {
//print("######"); // //print("######");
indexController.toggleDestinationMode(); // indexController.toggleDestinationMode();
}, // },
tooltip: 'Increment', // tooltip: 'Increment',
elevation: 4.0, // elevation: 4.0,
child: Obx(() => indexController.desinationMode.value == 1 // child: Obx(() => indexController.desinationMode.value == 1
? const Image(image: AssetImage('assets/images/list2.png')) // ? const Image(image: AssetImage('assets/images/list2.png'))
: const Image(image: AssetImage('assets/images/map.png'))), // : const Image(image: AssetImage('assets/images/map.png'))),
), // ),
floatingActionButtonLocation: // floatingActionButtonLocation:
FloatingActionButtonLocation.centerDocked, // FloatingActionButtonLocation.centerDocked,
appBar: AppBar( // appBar: AppBar(
automaticallyImplyLeading: true, // automaticallyImplyLeading: true,
title: Text("app_title".tr), // title: Text("app_title".tr),
actions: [ // actions: [
InkWell( // InkWell(
onTap: () { // onTap: () {
Get.toNamed(AppPages.CAMERA_PAGE); // Get.toNamed(AppPages.CAMERA_PAGE);
}, // },
child: destinationController.isInRog.value == true // child: destinationController.isInRog.value == true
? Image.asset( // ? Image.asset(
"assets/images/basic-walking.gif", // "assets/images/basic-walking.gif",
height: 10.0, // height: 10.0,
) // )
: destinationController.isAtGoal.value == true // : destinationController.isAtGoal.value == true
? IconButton( // ? IconButton(
onPressed: () { // onPressed: () {
Get.toNamed(AppPages.CAMERA_PAGE); // Get.toNamed(AppPages.CAMERA_PAGE);
}, // },
icon: const Icon(Icons.assistant_photo), // icon: const Icon(Icons.assistant_photo),
) // )
: IconButton( // : IconButton(
onPressed: () { // onPressed: () {
Get.toNamed(AppPages.CAMERA_PAGE); // Get.toNamed(AppPages.CAMERA_PAGE);
}, // },
icon: const Icon(Icons.accessibility), // icon: const Icon(Icons.accessibility),
), // ),
), // ),
// Obx(() => // // Obx(() =>
// Text(indexController.connectionStatusName.value) // // Text(indexController.connectionStatusName.value)
// ), // // ),
Obx( // Obx(
() => ToggleButtons( // () => ToggleButtons(
disabledColor: Colors.grey.shade200, // disabledColor: Colors.grey.shade200,
selectedColor: Colors.red, // selectedColor: Colors.red,
onPressed: (int index) { // onPressed: (int index) {
destinationController.isGpsSelected.value = // destinationController.isGpsSelected.value =
!destinationController.isGpsSelected.value; // !destinationController.isGpsSelected.value;
if (destinationController.isGpsSelected.value) { // if (destinationController.isGpsSelected.value) {
destinationController.chekcs = 0; // destinationController.chekcs = 0;
destinationController.skipGps = false; // destinationController.skipGps = false;
//destinationController.resetRogaining(); // //destinationController.resetRogaining();
} // }
}, // },
isSelected: [destinationController.isGpsSelected.value], // isSelected: [destinationController.isGpsSelected.value],
children: const <Widget>[ // children: const <Widget>[
Icon( // Icon(
Icons.explore, // Icons.explore,
size: 35.0, // size: 35.0,
) // )
], // ],
), // ),
), // ),
// IconButton(onPressed: (){ // // IconButton(onPressed: (){
// showCurrentPosition(); // // showCurrentPosition();
// }, // // },
// icon: Icon(Icons.location_on_outlined)) // // icon: Icon(Icons.location_on_outlined))
], // ],
), // ),
body: Obx(() => indexController.desinationMode.value == 0 // body: Obx(() => indexController.desinationMode.value == 0
? DestinationWidget() // ? DestinationWidget()
: DestinationMapPage())), // : DestinationMapPage())),
); // );
} // }
} // }

View File

@ -10,15 +10,10 @@ import 'package:geojson/geojson.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:latlong2/latlong.dart'; import 'package:latlong2/latlong.dart';
import 'package:rogapp/model/destination.dart'; import 'package:rogapp/model/destination.dart';
import 'package:rogapp/pages/destination/destination_binding.dart';
import 'package:rogapp/pages/destination/destination_controller.dart'; import 'package:rogapp/pages/destination/destination_controller.dart';
import 'package:rogapp/pages/destination/destination_page.dart';
import 'package:rogapp/routes/app_pages.dart'; import 'package:rogapp/routes/app_pages.dart';
import 'package:rogapp/services/action_service.dart';
import 'package:rogapp/services/auth_service.dart'; import 'package:rogapp/services/auth_service.dart';
import 'package:rogapp/services/cat_service.dart';
import 'package:rogapp/services/location_service.dart'; import 'package:rogapp/services/location_service.dart';
import 'package:rogapp/services/perfecture_service.dart';
import 'package:rogapp/utils/database_helper.dart'; import 'package:rogapp/utils/database_helper.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
@ -68,8 +63,6 @@ class IndexController extends GetxController {
String areaDropdownValue = "-1"; String areaDropdownValue = "-1";
String cateogory = "-all-"; String cateogory = "-all-";
late Worker _ever;
ConnectivityResult connectionStatus = ConnectivityResult.none; ConnectivityResult connectionStatus = ConnectivityResult.none;
var connectionStatusName = "".obs; var connectionStatusName = "".obs;
final Connectivity _connectivity = Connectivity(); final Connectivity _connectivity = Connectivity();
@ -94,7 +87,7 @@ class IndexController extends GetxController {
void switchPage(String page) { void switchPage(String page) {
////print("######## ${currentUser[0]["user"]["id"]}"); ////print("######## ${currentUser[0]["user"]["id"]}");
switch (page) { switch (page) {
case AppPages.INITIAL: case AppPages.INDEX:
{ {
rogMode.value = 0; rogMode.value = 0;
//print("-- rog mode is ctrl is ${rog_mode.value}"); //print("-- rog mode is ctrl is ${rog_mode.value}");
@ -117,24 +110,13 @@ class IndexController extends GetxController {
default: default:
{ {
rogMode.value = 0; rogMode.value = 0;
Get.toNamed(AppPages.INITIAL); Get.toNamed(AppPages.INDEX);
} }
} }
} }
@override @override
void onInit() { void onInit() {
//_ever = ever(rogMode, (_) => print("$_ has been changed (ever)"));
// if (perfectures.isEmpty) {
// PerfectureService.loadPerfectures().then((value) {
// perfectures.add(value);
// loadAreaFor("9");
// //loadSubPerfFor("9");
// });
// }
_connectivitySubscription = _connectivitySubscription =
_connectivity.onConnectivityChanged.listen(_updateConnectionStatus); _connectivity.onConnectivityChanged.listen(_updateConnectionStatus);
super.onInit(); super.onInit();
@ -181,19 +163,6 @@ class IndexController extends GetxController {
return LatLngBounds(LatLng(x1!, y1!), LatLng(x0!, y0!)); return LatLngBounds(LatLng(x1!, y1!), LatLng(x0!, y0!));
} }
List<LatLng> getLocationsList() {
List<LatLng> locs = [];
for (int i = 0; i <= locations[0].collection.length - 1; i++) {
GeoJsonMultiPoint p =
locations[0].collection[i].geometry as GeoJsonMultiPoint;
LatLng latLng = LatLng(p.geoSerie!.geoPoints[0].latitude,
p.geoSerie!.geoPoints[0].longitude);
locs.add(latLng);
}
return locs;
}
void login(String email, String password, BuildContext context) { void login(String email, String password, BuildContext context) {
AuthService.login(email, password).then((value) { AuthService.login(email, password).then((value) {
//print("------- logged in user details ######## $value ###### --------"); //print("------- logged in user details ######## $value ###### --------");
@ -228,7 +197,7 @@ class IndexController extends GetxController {
if (rogMode.value == 1) { if (rogMode.value == 1) {
switchPage(AppPages.TRAVEL); switchPage(AppPages.TRAVEL);
} else { } else {
switchPage(AppPages.INITIAL); switchPage(AppPages.INDEX);
} }
} else { } else {
Get.snackbar( Get.snackbar(
@ -264,7 +233,7 @@ class IndexController extends GetxController {
currentUser.add(value); currentUser.add(value);
isLoading.value = false; isLoading.value = false;
Navigator.pop(context); Navigator.pop(context);
Get.toNamed(AppPages.INITIAL); Get.toNamed(AppPages.INDEX);
} else { } else {
isLoading.value = false; isLoading.value = false;
Get.snackbar( Get.snackbar(
@ -299,7 +268,7 @@ class IndexController extends GetxController {
} else { } else {
rogMode.value = 1; rogMode.value = 1;
} }
Get.toNamed(AppPages.INITIAL); Get.toNamed(AppPages.INDEX);
} }
loadUserDetailsForToken(String token) async { loadUserDetailsForToken(String token) async {
@ -370,18 +339,6 @@ class IndexController extends GetxController {
currentBound.add(bounds); currentBound.add(bounds);
} }
void zoomtoSubPerf(String id) {
////print("zooooom");
PerfectureService.getSubExt(id).then((value) {
LatLng lat1 = LatLng(value![1], value[0]);
LatLng lat2 = LatLng(value[3], value[2]);
LatLngBounds bound = LatLngBounds(lat1, lat2);
mapController.fitBounds(bound);
setBound(bound);
});
}
GeoJsonFeature? getFeatureForLatLong(double lat, double long) { GeoJsonFeature? getFeatureForLatLong(double lat, double long) {
if (locations.isNotEmpty) { if (locations.isNotEmpty) {
for (GeoJsonFeature i in locations[0].collection) { for (GeoJsonFeature i in locations[0].collection) {

View File

@ -26,7 +26,7 @@ part 'app_routes.dart';
class AppPages { class AppPages {
// ignore: constant_identifier_names // ignore: constant_identifier_names
static const INITIAL = Routes.INDEX; static const INDEX = Routes.INDEX;
// ignore: constant_identifier_names // ignore: constant_identifier_names
static const SPA = Routes.SPA; static const SPA = Routes.SPA;
static const LANDING = Routes.LANDING; static const LANDING = Routes.LANDING;