This commit is contained in:
Mohamed Nouffer
2022-07-27 19:43:12 +05:30
parent 3e001cc485
commit 16cf0e1434
3 changed files with 68 additions and 80 deletions

View File

@ -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<DestinationController>();
// print("---- destination index--- ${destinationController.destination_index_data} --------");
// }
// else {
// GeoJsonFeature<GeoJsonMultiPoint> pt = fs as GeoJsonFeature<GeoJsonMultiPoint>;
// 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();
}
}
}
}
}

View File

@ -87,26 +87,55 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
List<Marker> 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)
// )
// );
});