diff --git a/lib/pages/destination/destination_controller.dart b/lib/pages/destination/destination_controller.dart index d76ae38..3e7060e 100644 --- a/lib/pages/destination/destination_controller.dart +++ b/lib/pages/destination/destination_controller.dart @@ -235,11 +235,6 @@ class DestinationController extends GetxController { db.deleteDestination(d.location_id!).then((value){ PopulateDestinations(); }); - // DestinationService.deleteDestination(id).then((val){ - // destination_index_data.clear(); - // PopulateDestinations(); - // print("####### dest id : ${id}"); - // }); } // ---------- database ------------------/// @@ -296,29 +291,6 @@ class DestinationController extends GetxController { }); }); - - // if(indexController.currentUser.isNotEmpty){ - // int user_id = indexController.currentUser[0]["user"]["id"]; - // print(user_id); - // DestinationService.getDestinations(user_id).then((value){ - // destinations.clear(); - // destinations = value; - // destinationCount.value = 0; - // destinationCount.value = destinations.length; - - // MatrixService.getDestinations(value).then((mat){ - // print(mat); - // matrix = mat; - - // }); - - // //var val = value[2]["location"]["id"]; - // //print("-----current destinations ----- ${val}"); - // }); - // } - // else{ - // Get.toNamed(AppPages.LOGIN); - // } } @@ -355,40 +327,28 @@ class DestinationController extends GetxController { } - // void makePrevious(GeoJsonFeature fs){ - - // if(rog_mode == 1){ - // DestinationController destinationController = Get.find(); - // print("---- destination index--- ${destinationController.destination_index_data} --------"); - // } - // else { - - // GeoJsonFeature pt = fs as GeoJsonFeature; - - // for(int i=0; i<= locations[0].collection.length - 1; i++){ - // GeoJsonMultiPoint p = locations[0].collection[i].geometry as GeoJsonMultiPoint; - - // if(p.geoSerie!.geoPoints[0].latitude == pt.geometry!.geoSerie!.geoPoints[0].latitude && p.geoSerie!.geoPoints[0].longitude == pt.geometry!.geoSerie!.geoPoints[0].longitude ){ - - // if(currentFeature.length > 0){ - // currentFeature.clear(); - // } - // if(i == 0 ){ - // currentFeature.add(locations[0].collection[locations[0].collection.length -1] as GeoJsonFeature); - // getAction(); - // } - // else{ - // currentFeature.add(locations[0].collection[i - 1] as GeoJsonFeature); - // getAction(); - // } - // } - // } - // } - // } - + void makePrevious(Destination pt){ + for(int i=0; i<= destinations.length - 1; i++){ + Destination p = destinations[i]; + if(p.lat == pt.lat && p.lon == pt.lon ){ + + if(indexController.currentDestinationFeature.isNotEmpty){ + indexController.currentDestinationFeature.clear(); + } + if(i <= 0){ + indexController.currentDestinationFeature.add(destinations[destinations.length -1]); + //getAction(); + } + else{ + indexController.currentDestinationFeature.add(destinations[i - 1]); + //getAction(); + } + } + } + } } \ No newline at end of file diff --git a/lib/pages/destination_map/destination_map_page.dart b/lib/pages/destination_map/destination_map_page.dart index 683c893..7a76585 100644 --- a/lib/pages/destination_map/destination_map_page.dart +++ b/lib/pages/destination_map/destination_map_page.dart @@ -87,26 +87,55 @@ class _DestinationMapPageState extends State { List pts = []; for(Destination d in destinationController.destinations){ //print("-----lat ${lat}, ----- lon ${lan}"); - Marker m = Marker(point: LatLng(d.lat!, d.lon!), builder:(cts){ + Marker m = Marker( + point: LatLng(d.lat!, d.lon!), + anchorPos: AnchorPos.align(AnchorAlign.center), + builder:(cts){ + + return Container( + color: Colors.transparent, + child: new Container( + decoration: new BoxDecoration( + color: Colors.red, + borderRadius: new BorderRadius.only( + topLeft: const Radius.circular(40.0), + topRight: const Radius.circular(40.0), + ) + ), + child: new Center( + child: new Text("Hi modal sheet"), + ) + )); + //return Icon(Icons.pin_drop); - return IconButton( - onPressed: ()async { - Destination? fs = await destinationController.getDEstinationForLatLong(d.lat!, d.lon!); - print("-- Destination is --- ${fs!.name} ------"); - if(fs != null){ - if(indexController.currentDestinationFeature.length > 0) { - indexController.currentDestinationFeature.clear(); - } - indexController.currentDestinationFeature.add(fs); - //indexController.getAction(); + // return IconButton( + // onPressed: ()async { + // Destination? fs = await destinationController.getDEstinationForLatLong(d.lat!, d.lon!); + // print("-- Destination is --- ${fs!.name} ------"); + // if(fs != null){ + // if(indexController.currentDestinationFeature.length > 0) { + // indexController.currentDestinationFeature.clear(); + // } + // indexController.currentDestinationFeature.add(fs); + // //indexController.getAction(); - showModalBottomSheet(context: context, isScrollControlled: true, - //builder:((context) => BottomSheetWidget()) - builder:((context) => BottomSheetNew()) - ); - } - }, - icon: Icon(Icons.pin_drop)); + // showModalBottomSheet(context: context, isScrollControlled: true, + // //builder:((context) => BottomSheetWidget()) + // builder:((context) => BottomSheetNew()) + // ); + // } + // }, + // icon: Container( + // width: 60, + // height: 60, + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(d.checkin_radious ?? 0), + // color: Colors.transparent, + // border: BoxBorder() + // ), + // child: Icon(Icons.pin_drop) + // ) + // ); }); diff --git a/lib/widgets/bottom_sheet_new.dart b/lib/widgets/bottom_sheet_new.dart index b3c788b..764b177 100644 --- a/lib/widgets/bottom_sheet_new.dart +++ b/lib/widgets/bottom_sheet_new.dart @@ -85,7 +85,7 @@ class BottomSheetNew extends GetView { children: [ MaterialButton( onPressed: () { - indexController.makePrevious(indexController.currentFeature[0]); + destinationController.makePrevious(indexController.currentDestinationFeature[0]); }, color: Colors.blue, textColor: Colors.white, @@ -110,8 +110,7 @@ class BottomSheetNew extends GetView { ), MaterialButton( onPressed: () { - //print("----- next is ${indexController.currentFeature[0]} ------"); - //indexController.makeNext(indexController.currentFeature[0]); + destinationController.makeNext(indexController.currentDestinationFeature[0]); }, color: Colors.blue, textColor: Colors.white,