This commit is contained in:
Mohamed Nouffer
2022-07-25 19:56:32 +05:30
parent 7739fecdf7
commit ff018a56fe
8 changed files with 106 additions and 44 deletions

View File

@ -182,7 +182,7 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
} , } ,
bounds: indexController.currentBound.length > 0 ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]), bounds: indexController.currentBound.length > 0 ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]),
zoom: 1, zoom: 1,
maxZoom: 20, maxZoom: 42,
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag, interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
//plugins: [LocationMarkerPlugin(),] //plugins: [LocationMarkerPlugin(),]
), ),
@ -193,15 +193,20 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
subdomains: ['a', 'b', 'c'], subdomains: ['a', 'b', 'c'],
), ),
), ),
PolylineLayerWidget( Obx(() =>
options: PolylineLayerOptions( indexController.routePoints.length > 0 ?
polylines: [ PolylineLayerWidget(
Polyline( options: PolylineLayerOptions(
points: getPoints()!, polylines: [
strokeWidth: 4.0, Polyline(
color: Colors.purple), points: getPoints()!,
], strokeWidth: 4.0,
), color: Colors.purple),
],
),
)
:
Container(),
), ),
// PopupMarkerLayerWidget( // PopupMarkerLayerWidget(
// options: PopupMarkerLayerOptions( // options: PopupMarkerLayerOptions(

View File

@ -241,7 +241,27 @@ void login(String email, String password, BuildContext context){
CatService.loadCats(bounds.southWest!.latitude, bounds.southWest!.longitude, bounds.northWest.latitude, bounds.northWest.longitude, bounds.northEast!.latitude, bounds.northEast!.longitude, bounds.southEast.latitude, bounds.southEast.longitude).then((value) { CatService.loadCats(bounds.southWest!.latitude, bounds.southWest!.longitude, bounds.northWest.latitude, bounds.northWest.longitude, bounds.northEast!.latitude, bounds.northEast!.longitude, bounds.southEast.latitude, bounds.southEast.longitude).then((value) {
cats.clear(); cats.clear();
cats.add(initVal); cats.add(initVal);
cats.addAll(value!); for(dynamic cat in value!){
if(cat['category'] != null){
cats.add(cat!);
}
}
});
}
}
void loadCatForCity(String city){
dynamic initVal = {'category':'-all-'};
LatLngBounds bounds = mapController!.bounds!;
if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){
CatService.loadCatByCity(city).then((value) {
cats.clear();
cats.add(initVal);
for(dynamic cat in value!){
if(cat['category'] != null){
cats.add(cat!);
}
}
}); });
} }
} }
@ -338,7 +358,9 @@ void login(String email, String password, BuildContext context){
void loadLocationforSubPerf(String subperf, MapController mapController) async { void loadLocationforSubPerf(String subperf, MapController mapController) async {
String cat = currentCat.isNotEmpty == true ? currentCat[0] : ""; String cat = currentCat.isNotEmpty == true ? currentCat[0] : "";
print(currentCat); if(currentCat[0] == "-all-"){
cat = "";
}
LocationService.loadLocationsSubFor(subperf, cat).then((value){ LocationService.loadLocationsSubFor(subperf, cat).then((value){
locations.clear(); locations.clear();
locations.add(value!); locations.add(value!);
@ -420,6 +442,8 @@ void login(String email, String password, BuildContext context){
void zoomtoSubPerf(String id){ void zoomtoSubPerf(String id){
print("zooooom");
PerfectureService.getSubExt(id).then((value){ PerfectureService.getSubExt(id).then((value){
LatLng lat1 = LatLng(value![1], value[0]); LatLng lat1 = LatLng(value![1], value[0]);
LatLng lat2 = LatLng(value[3], value[2]); LatLng lat2 = LatLng(value[3], value[2]);
@ -439,7 +463,7 @@ void login(String email, String password, BuildContext context){
} }
void populateForSubPerf(String subperf, MapController mapController){ void populateForSubPerf(String subperf, MapController mapController){
subDropdownValue = subperf; //subDropdownValue = subperf;
loadLocationforSubPerf(subperf, mapController); loadLocationforSubPerf(subperf, mapController);
zoomtoSubPerf(subperf); zoomtoSubPerf(subperf);
is_loading.value = false; is_loading.value = false;

View File

@ -112,20 +112,20 @@ class IndexPage extends GetView<IndexController> {
: :
BreadCrumbWidget(mapController: indexController.mapController), BreadCrumbWidget(mapController: indexController.mapController),
Container(width: 24.0,), Container(width: 24.0,),
Row( // Row(
children: [ // children: [
indexController.currentCat.isNotEmpty ? Text(indexController.currentCat[0].toString()): Text(""), // indexController.currentCat.isNotEmpty ? Text(indexController.currentCat[0].toString()): Text(""),
indexController.currentCat.isNotEmpty ? // indexController.currentCat.isNotEmpty ?
IconButton( // IconButton(
onPressed: (){ // onPressed: (){
indexController.currentCat.clear(); // indexController.currentCat.clear();
indexController.loadLocationsBound(); // indexController.loadLocationsBound();
}, // },
icon: Icon(Icons.cancel, color: Colors.red,) // icon: Icon(Icons.cancel, color: Colors.red,)
) : // ) :
Container(width: 0, height: 0,) // Container(width: 0, height: 0,)
], // ],
) // )
], ],
) )
), ),

View File

@ -30,6 +30,27 @@ class CatService{
} }
static Future<List<dynamic>?> loadCatByCity(String cityname)async {
List<dynamic> cats = [];
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/catbycity/?${cityname}';
//String url = 'http://localhost:8100/api/cats/?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
//String url = 'http://container.intranet.sumasen.net:8100/api/cats/';
print("---- cat url is ${url}");
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
},
);
if (response.statusCode == 200) {
cats = json.decode(utf8.decode(response.bodyBytes));
}
return cats;
}
} }

View File

@ -10,8 +10,13 @@ class BaseLayer extends StatelessWidget {
options: TileLayerOptions( options: TileLayerOptions(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
//urlTemplate: 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
subdomains: ['a', 'b', 'c'], subdomains: ['a', 'b', 'c'],
), ),
); );
} }
} }
// var Esri_WorldImagery = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
// attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
// });

View File

@ -25,7 +25,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
return Image(image: AssetImage('assets/images/empty_image.png')); return Image(image: AssetImage('assets/images/empty_image.png'));
} }
else{ else{
print("@@@@@@@@@@@@@ rog mode -------------------- ${indexController.currentDestinationFeature[0].photos} @@@@@@@@@@@"); //print("@@@@@@@@@@@@@ rog mode -------------------- ${indexController.currentDestinationFeature[0].photos} @@@@@@@@@@@");
return Image(image: NetworkImage( return Image(image: NetworkImage(
indexController.currentDestinationFeature[0].photos!, indexController.currentDestinationFeature[0].photos!,
), ),
@ -110,7 +110,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
), ),
MaterialButton( MaterialButton(
onPressed: () { onPressed: () {
print("----- next is ${indexController.currentFeature[0]} ------"); //print("----- next is ${indexController.currentFeature[0]} ------");
//indexController.makeNext(indexController.currentFeature[0]); //indexController.makeNext(indexController.currentFeature[0]);
}, },
color: Colors.blue, color: Colors.blue,
@ -222,7 +222,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
), ),
MaterialButton( MaterialButton(
onPressed: () { onPressed: () {
print("----- next is ${indexController.currentFeature[0]} ------"); //print("----- next is ${indexController.currentFeature[0]} ------");
indexController.makeNext(indexController.currentFeature[0]); indexController.makeNext(indexController.currentFeature[0]);
}, },
color: Colors.blue, color: Colors.blue,
@ -267,7 +267,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
); );
}, },
), ),
indexController.currentFeature[0].properties!["location_name"] != null && (indexController.currentFeature[0].properties!["address"] as String).isNotEmpty ? indexController.currentFeature[0].properties!["location_name"] != null && (indexController.currentFeature[0].properties!["location_name"] as String).isNotEmpty ?
Flexible(child: Text(indexController.currentFeature[0].properties!["location_name"])) Flexible(child: Text(indexController.currentFeature[0].properties!["location_name"]))
: :
Container(width: 0.0, height: 0,), Container(width: 0.0, height: 0,),
@ -398,7 +398,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
Destination dest = indexController.currentDestinationFeature[0]!; Destination dest = indexController.currentDestinationFeature[0]!;
//print("------ curent destination is ${dest!.checkedIn}-------"); //print("------ curent destination is ${dest!.checkedIn}-------");
if(dest != null){ if(dest != null){
print("------ curent destination is ${dest!.checkedin}-------::::::::::"); //print("------ curent destination is ${dest!.checkedin}-------::::::::::");
destinationController.makeCheckin(dest, !dest.checkedin!); destinationController.makeCheckin(dest, !dest.checkedin!);
} }
}, },
@ -419,7 +419,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
Widget getCheckin(BuildContext context){ Widget getCheckin(BuildContext context){
print("------ currentAction ----- ${indexController.currentAction}-----"); //print("------ currentAction ----- ${indexController.currentAction}-----");
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -437,7 +437,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
child: Text("Image"), onPressed: (){ child: Text("Image"), onPressed: (){
final ImagePicker _picker = ImagePicker(); final ImagePicker _picker = ImagePicker();
_picker.pickImage(source: ImageSource.camera).then((value){ _picker.pickImage(source: ImageSource.camera).then((value){
print("----- image---- ${value!.path}"); //print("----- image---- ${value!.path}");
}); });
}, },
) )
@ -446,11 +446,11 @@ class BottomSheetNew extends GetView<BottomSheetController> {
ElevatedButton( ElevatedButton(
onPressed: (){ onPressed: (){
if(indexController.currentAction.isNotEmpty){ if(indexController.currentAction.isNotEmpty){
print(indexController.currentAction[0]); //print(indexController.currentAction[0]);
indexController.currentAction[0][0]["checkin"] = true; indexController.currentAction[0][0]["checkin"] = true;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]); Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear(); indexController.currentAction.clear();
print("---temp---${temp}"); //print("---temp---${temp}");
indexController.currentAction.add([temp]); indexController.currentAction.add([temp]);
} }
indexController.makeAction(context); indexController.makeAction(context);
@ -463,11 +463,11 @@ class BottomSheetNew extends GetView<BottomSheetController> {
ElevatedButton( ElevatedButton(
onPressed: (){ onPressed: (){
if(indexController.currentAction.isNotEmpty){ if(indexController.currentAction.isNotEmpty){
print(indexController.currentAction[0]); //print(indexController.currentAction[0]);
indexController.currentAction[0][0]["checkin"] = false; indexController.currentAction[0][0]["checkin"] = false;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]); Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear(); indexController.currentAction.clear();
print("---temp---${temp}"); //print("---temp---${temp}");
indexController.currentAction.add([temp]); indexController.currentAction.add([temp]);
} }
indexController.makeAction(context); indexController.makeAction(context);

View File

@ -57,7 +57,7 @@ class MapWidget extends StatelessWidget {
//center: LatLng(37.15319600454702, 139.58765950528198), //center: LatLng(37.15319600454702, 139.58765950528198),
bounds: indexController.currentBound.length > 0 ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]), bounds: indexController.currentBound.length > 0 ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]),
zoom: 1, zoom: 1,
maxZoom: 20, maxZoom: 24,
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag, interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
plugins: [ plugins: [
MarkerClusterPlugin(), MarkerClusterPlugin(),

View File

@ -105,7 +105,7 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
//print("--------cats ------############### ${widget.indexController.cats.toString()} -------------"); //print("--------cats ------############### ${widget.indexController.cats.toString()} -------------");
for(dynamic d in widget.indexController.cats){ for(dynamic d in widget.indexController.cats){
print("-------- ddd ------############### ${d} --------dddd-----"); //print("-------- ddd ------############### ${d} --------dddd-----");
var newDropdown = DropdownMenuItem(child: Text(d['category'].toString()), value: d['category'].toString()); var newDropdown = DropdownMenuItem(child: Text(d['category'].toString()), value: d['category'].toString());
//print("--------cats ------############### ${d['category'].toString()} -------------"); //print("--------cats ------############### ${d['category'].toString()} -------------");
dropDownItems.add(newDropdown); dropDownItems.add(newDropdown);
@ -187,10 +187,11 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
onChanged: (String? newValue) { onChanged: (String? newValue) {
setState(() { setState(() {
if(newValue != null){ if(newValue != null){
widget.indexController.is_loading.value = true; //widget.indexController.is_loading.value = true;
widget.indexController.populateForSubPerf(newValue, widget.mapController); //widget.indexController.populateForSubPerf(newValue, widget.mapController);
//widget.indexController.loadLocationforSubPerf(newValue, widget.mapController); //widget.indexController.loadLocationforSubPerf(newValue, widget.mapController);
//widget.indexController.subDropdownValue = newValue; widget.indexController.subDropdownValue = newValue;
widget.indexController.loadCatForCity(newValue);
} }
}); });
}, },
@ -199,6 +200,7 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
) : ) :
const Text(""), const Text(""),
//CatWidget(indexController: widget.indexController,), //CatWidget(indexController: widget.indexController,),
widget.indexController.cats.length > 0 ?
DropdownButton<String>( DropdownButton<String>(
value: widget.indexController.cateogory, value: widget.indexController.cateogory,
icon: const Icon(Icons.arrow_downward), icon: const Icon(Icons.arrow_downward),
@ -213,7 +215,10 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
setState(() { setState(() {
if(newValue != null){ if(newValue != null){
widget.indexController.is_loading.value = true; widget.indexController.is_loading.value = true;
widget.indexController.populateForSubPerf(newValue, widget.mapController); widget.indexController.cateogory = newValue;
widget.indexController.currentCat.clear();
widget.indexController.currentCat.add(newValue);
widget.indexController.populateForSubPerf(widget.indexController.subDropdownValue, widget.mapController);
//widget.indexController.loadLocationforSubPerf(newValue, widget.mapController); //widget.indexController.loadLocationforSubPerf(newValue, widget.mapController);
//widget.indexController.subDropdownValue = newValue; //widget.indexController.subDropdownValue = newValue;
} }
@ -222,6 +227,8 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
items: items:
getCategory(), getCategory(),
) )
:
Container(),
], ],
), ),