update
This commit is contained in:
@ -1,15 +1,22 @@
|
||||
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:rogapp/services/destination_service.dart';
|
||||
import 'package:rogapp/services/maxtrix_service.dart';
|
||||
import 'package:rogapp/services/reacking_service.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
|
||||
class DestinationController extends GetxController {
|
||||
|
||||
late LocationSettings locationSettings;
|
||||
@ -17,21 +24,91 @@ class DestinationController extends GetxController {
|
||||
List<dynamic> destinations = <dynamic>[].obs;
|
||||
List<Map<String, dynamic>> destination_index_data = <Map<String, dynamic>>[].obs;
|
||||
|
||||
bool checking_in = false;
|
||||
List<bool> isSelected = [true].obs;
|
||||
BuildContext? context;
|
||||
|
||||
Map<String, dynamic> matrix = {};
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
|
||||
Future<GeoJsonFeature?> 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){
|
||||
var geom = d["location"]["geometry"];
|
||||
var props = d["location"]["properties"];
|
||||
print("--props- ${d["location"]["geometry"]["coordinates"][0][1]}");
|
||||
List<dynamic> geom_multi = [geom];
|
||||
Map<String, dynamic> final_geom = {"features":[{"id":d["id"],"type":"Feature", "geometry": geom, "properties": props}]};
|
||||
//print("----- geom : ${final_geom}");
|
||||
|
||||
String js = json.encode(final_geom);
|
||||
//print("---features-- ${js}-----");
|
||||
GeoJsonFeatureCollection features = await featuresFromGeoJson(js);
|
||||
GeoJsonMultiPoint p = features.collection[0].geometry as GeoJsonMultiPoint;
|
||||
if(lat == p.geoSerie!.geoPoints[0].latitude && long == p.geoSerie!.geoPoints[0].longitude){
|
||||
return features.collection[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkForCheckin(double la, double ln){
|
||||
for(final d in destinations){
|
||||
double lat = d["location"]["geometry"]["coordinates"][0][1] as double;
|
||||
double lon = d["location"]["geometry"]["coordinates"][0][0] as double;
|
||||
LatLng p = LatLng(lat, lon);
|
||||
getDEstinationForLatLong(lat, lon).then((value){
|
||||
var distance = Distance();
|
||||
double dist = distance.as(LengthUnit.Meter, LatLng(lat, lon), LatLng(la, ln));
|
||||
double rad = value!.properties!["checkin_radious"] ?? double.infinity;
|
||||
bool auto_checkin = value.properties!["auto_checkin"] ?? false;
|
||||
|
||||
indexController.currentFeature.add(value);
|
||||
indexController.getAction();
|
||||
|
||||
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;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
print("----- rad is ${rad}");
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
PopulateDestinations();
|
||||
|
||||
|
||||
|
||||
|
||||
if (defaultTargetPlatform == TargetPlatform.android) {
|
||||
locationSettings = AndroidSettings(
|
||||
accuracy: LocationAccuracy.high,
|
||||
distanceFilter: 1,
|
||||
distanceFilter: 30,
|
||||
forceLocationManager: true,
|
||||
intervalDuration: const Duration(seconds: 10),
|
||||
//(Optional) Set foreground notification config to keep the app alive
|
||||
@ -55,13 +132,20 @@ class DestinationController extends GetxController {
|
||||
} else {
|
||||
locationSettings = LocationSettings(
|
||||
accuracy: LocationAccuracy.high,
|
||||
distanceFilter: 1,
|
||||
distanceFilter: 30,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
StreamSubscription<Position> positionStream = Geolocator.getPositionStream(locationSettings: locationSettings).listen(
|
||||
(Position? position) {
|
||||
if(isSelected[0]){
|
||||
String user_id = indexController.currentUser[0]["user"]["id"].toString();
|
||||
TrackingService.addTrack(user_id, position!.latitude, position.longitude).then((val){
|
||||
//checkForCheckin(position!.latitude, position.longitude);
|
||||
});
|
||||
|
||||
}
|
||||
print(position == null ? 'Unknown' : 'current position is ${position.latitude.toString()}, ${position.longitude.toString()}');
|
||||
});
|
||||
|
||||
@ -80,7 +164,7 @@ class DestinationController extends GetxController {
|
||||
|
||||
void PopulateDestinations(){
|
||||
if(indexController.currentUser.isNotEmpty){
|
||||
int user_id = indexController.currentUser[0]["user"]["id"] as int;
|
||||
int user_id = indexController.currentUser[0]["user"]["id"];
|
||||
//print(user_id);
|
||||
DestinationService.getDestinations(user_id).then((value){
|
||||
|
||||
|
||||
@ -25,7 +25,6 @@ class _DestinationPageState extends State<DestinationPage> {
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
final List<int> _items = List<int>.generate(50, (int index) => index);
|
||||
List<bool> isSelected = [true];
|
||||
|
||||
Future<void> showCurrentPosition() async {
|
||||
LocationPermission permission = await Geolocator.checkPermission();
|
||||
@ -47,6 +46,12 @@ class _DestinationPageState extends State<DestinationPage> {
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
destinationController.context = context;
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ColorScheme colorScheme = Theme.of(context).colorScheme;
|
||||
@ -82,6 +87,12 @@ class _DestinationPageState extends State<DestinationPage> {
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
||||
appBar:AppBar(
|
||||
title: Text("Iternery"),
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back_ios),
|
||||
onPressed: (){
|
||||
indexController.switchPage(AppPages.INITIAL);
|
||||
},
|
||||
),
|
||||
actions: [
|
||||
ToggleButtons(
|
||||
disabledColor: Colors.grey.shade200,
|
||||
@ -91,10 +102,10 @@ class _DestinationPageState extends State<DestinationPage> {
|
||||
)],
|
||||
onPressed: (int index) {
|
||||
setState(() {
|
||||
isSelected[index] = !isSelected[index];
|
||||
destinationController.isSelected[index] = !destinationController.isSelected[index];
|
||||
});
|
||||
},
|
||||
isSelected: isSelected,
|
||||
isSelected: destinationController.isSelected,
|
||||
),
|
||||
IconButton(onPressed: (){
|
||||
showCurrentPosition();
|
||||
|
||||
@ -4,7 +4,9 @@ import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/plugin_api.dart';
|
||||
import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
|
||||
import 'package:flutter_map_marker_popup/flutter_map_marker_popup.dart';
|
||||
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
@ -12,10 +14,12 @@ import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
//import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/services/destination_service.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
|
||||
class DestinationMapPage extends StatefulWidget {
|
||||
DestinationMapPage({ Key? key }) : super(key: key);
|
||||
|
||||
|
||||
@override
|
||||
State<DestinationMapPage> createState() => _DestinationMapPageState();
|
||||
}
|
||||
@ -25,6 +29,69 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
||||
|
||||
final DestinationController destinationController = Get.find<DestinationController>();
|
||||
StreamSubscription? subscription;
|
||||
final PopupController _popupLayerController = PopupController();
|
||||
|
||||
|
||||
|
||||
Widget examplePopup(Marker marker){
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Container(
|
||||
constraints: const BoxConstraints(minWidth: 100, maxWidth: 200),
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
const Text(
|
||||
'Popup for a marker!',
|
||||
overflow: TextOverflow.fade,
|
||||
softWrap: false,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14.0,
|
||||
),
|
||||
),
|
||||
const Padding(padding: EdgeInsets.symmetric(vertical: 4.0)),
|
||||
Text(
|
||||
'Position: ${marker.point.latitude}, ${marker.point.longitude}',
|
||||
style: const TextStyle(fontSize: 12.0),
|
||||
),
|
||||
Text(
|
||||
'Marker size: ${marker.width}, ${marker.height}',
|
||||
style: const TextStyle(fontSize: 12.0),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
final List<LatLng> _markerPositions = [
|
||||
LatLng(35.728728732933455, 137.06878077038706),
|
||||
LatLng(35.958218259568305, 137.06187578986646),
|
||||
LatLng(35.76795686324816, 137.08949571194879),
|
||||
];
|
||||
|
||||
|
||||
|
||||
List<Marker> get _markers => _markerPositions
|
||||
.map(
|
||||
(markerPosition) => Marker(
|
||||
point: markerPosition,
|
||||
width: 40,
|
||||
height: 40,
|
||||
builder: (_) => const Icon(Icons.location_on, size: 40),
|
||||
anchorPos: AnchorPos.align(AnchorAlign.top),
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
|
||||
|
||||
|
||||
List<LatLng>? getPoints(){
|
||||
//print("##### --- route point ${indexController.routePoints.length}");
|
||||
@ -36,14 +103,34 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
||||
return pts;
|
||||
}
|
||||
|
||||
List<Marker>? getMarkers(){
|
||||
List<Marker>? getMarkers() {
|
||||
List<Marker> pts = [];
|
||||
for(dynamic d in destinationController.destinations){
|
||||
double lat = d["location"]["geometry"]["coordinates"][0][1];
|
||||
double lan = d["location"]["geometry"]["coordinates"][0][0];
|
||||
//print("-----lat ${lat}, ----- lon ${lan}");
|
||||
Marker m = Marker(point: LatLng(lat, lan), builder:(cts){
|
||||
return Icon(Icons.pin_drop);
|
||||
//return Icon(Icons.pin_drop);
|
||||
return IconButton(
|
||||
onPressed: ()async {
|
||||
GeoJsonFeature? fs = await destinationController.getDEstinationForLatLong(lat, lan);
|
||||
print("----fsf-----${fs}");
|
||||
if(fs != null){
|
||||
if(indexController.currentFeature.length > 0) {
|
||||
indexController.currentFeature.clear();
|
||||
}
|
||||
indexController.currentFeature.add(fs);
|
||||
indexController.getAction();
|
||||
|
||||
showModalBottomSheet(context: context, isScrollControlled: true,
|
||||
builder:((context) => BottomSheetWidget())
|
||||
);
|
||||
}
|
||||
},
|
||||
icon: Icon(Icons.pin_drop));
|
||||
|
||||
});
|
||||
|
||||
pts.add(m);
|
||||
}
|
||||
return pts;
|
||||
@ -85,15 +172,15 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
||||
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
|
||||
plugins: [LocationMarkerPlugin(),]
|
||||
),
|
||||
layers: [
|
||||
TileLayerOptions(
|
||||
urlTemplate:
|
||||
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
subdomains: ['a', 'b', 'c']),
|
||||
MarkerLayerOptions(
|
||||
markers: getMarkers()!,
|
||||
children: [
|
||||
TileLayerWidget(
|
||||
options: TileLayerOptions(
|
||||
urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
subdomains: ['a', 'b', 'c'],
|
||||
),
|
||||
),
|
||||
PolylineLayerOptions(
|
||||
PolylineLayerWidget(
|
||||
options: PolylineLayerOptions(
|
||||
polylines: [
|
||||
Polyline(
|
||||
points: getPoints()!,
|
||||
@ -101,8 +188,25 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
||||
color: Colors.purple),
|
||||
],
|
||||
),
|
||||
LocationMarkerLayerOptions(),
|
||||
),
|
||||
// PopupMarkerLayerWidget(
|
||||
// options: PopupMarkerLayerOptions(
|
||||
// popupController: _popupLayerController,
|
||||
// markers: _markers,
|
||||
// markerRotateAlignment:
|
||||
// PopupMarkerLayerOptions.rotationAlignmentFor(AnchorAlign.top),
|
||||
// popupBuilder: (BuildContext context, Marker marker) =>
|
||||
|
||||
// examplePopup(marker),
|
||||
// ),
|
||||
// ),
|
||||
MarkerLayerWidget(
|
||||
options: MarkerLayerOptions(
|
||||
markers: getMarkers()!
|
||||
),
|
||||
)
|
||||
],
|
||||
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
@ -21,6 +21,7 @@ class IndexController extends GetxController {
|
||||
List<LatLngBounds> currentBound = <LatLngBounds>[].obs;
|
||||
List<dynamic> subPerfs = <dynamic>[].obs;
|
||||
List<dynamic> areas = <dynamic>[].obs;
|
||||
List<dynamic> customAreas = <dynamic>[].obs;
|
||||
List<dynamic> cats = <dynamic>[].obs;
|
||||
|
||||
List<String> currentCat = <String>[].obs;
|
||||
@ -36,6 +37,8 @@ class IndexController extends GetxController {
|
||||
|
||||
var mode = 0.obs;
|
||||
|
||||
var rog_mode = 0.obs;
|
||||
|
||||
var desination_mode = 0.obs;
|
||||
|
||||
|
||||
@ -43,6 +46,8 @@ class IndexController extends GetxController {
|
||||
String subDropdownValue = "-1";
|
||||
String areaDropdownValue = "-1";
|
||||
|
||||
late Worker _ever;
|
||||
|
||||
void toggleMode(){
|
||||
if(mode.value==0){
|
||||
mode += 1;
|
||||
@ -61,9 +66,33 @@ class IndexController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
void switchPage(String page){
|
||||
//print("######## ${currentUser[0]["user"]["id"]}");
|
||||
switch (page) {
|
||||
case AppPages.INITIAL :{
|
||||
rog_mode.value = 0;
|
||||
Get.toNamed(page);
|
||||
}
|
||||
break;
|
||||
case AppPages.TRAVEL : {
|
||||
rog_mode.value = 1;
|
||||
Get.toNamed(page);
|
||||
}
|
||||
break;
|
||||
case AppPages.LOGIN :{
|
||||
rog_mode.value = 2;
|
||||
Get.toNamed(page);
|
||||
}
|
||||
break;
|
||||
default:{
|
||||
rog_mode.value = 0;
|
||||
Get.toNamed(AppPages.INITIAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
|
||||
// if(locations.length == 0){
|
||||
// LocationService.loadLocations().then((value){
|
||||
@ -71,23 +100,59 @@ class IndexController extends GetxController {
|
||||
// //print(value);
|
||||
// });
|
||||
// }
|
||||
|
||||
_ever = ever(rog_mode, (_) => print("$_ has been changed (ever)"));
|
||||
|
||||
if(perfectures.length == 0){
|
||||
PerfectureService.loadPerfectures().then((value){
|
||||
perfectures.add(value);
|
||||
loadAreaFor("9");
|
||||
|
||||
//loadSubPerfFor("9");
|
||||
});
|
||||
}
|
||||
//loadCats();
|
||||
}
|
||||
}
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
void login(String email, String password, BuildContext context){
|
||||
|
||||
LatLngBounds boundsFromLatLngList(List<LatLng> list) {
|
||||
double? x0, x1, y0, y1;
|
||||
for (LatLng latLng in list) {
|
||||
if (x0 == null || x1 == null || y0 == null || y1 == null) {
|
||||
x0 = x1 = latLng.latitude;
|
||||
y0 = y1 = latLng.longitude;
|
||||
} else {
|
||||
if (latLng.latitude > x1) x1 = latLng.latitude;
|
||||
if (latLng.latitude < x0) x0 = latLng.latitude;
|
||||
if (latLng.longitude > y1) y1 = latLng.longitude;
|
||||
if (latLng.longitude < y0) y0 = latLng.longitude;
|
||||
}
|
||||
}
|
||||
|
||||
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){
|
||||
AuthService.login(email, password).then((value){
|
||||
if(value.isNotEmpty){
|
||||
currentUser.clear();
|
||||
currentUser.add(value);
|
||||
is_loading.value = false;
|
||||
Navigator.pop(context);
|
||||
loadUserDetails();
|
||||
if(currentFeature.isNotEmpty){
|
||||
getAction();
|
||||
}
|
||||
@ -107,6 +172,7 @@ class IndexController extends GetxController {
|
||||
currentUser.add(value);
|
||||
is_loading.value = false;
|
||||
Navigator.pop(context);
|
||||
loadUserDetails();
|
||||
Get.toNamed(AppPages.INITIAL);
|
||||
}else{
|
||||
is_loading.value = false;
|
||||
@ -121,26 +187,13 @@ class IndexController extends GetxController {
|
||||
bool wanttogo = currentAction[0][0]["wanttogo"];
|
||||
bool like = currentAction[0][0]["like"];
|
||||
bool checkin = currentAction[0][0]["checkin"];
|
||||
print("----userid----${user_id}");
|
||||
if(user_id > 0){
|
||||
ActionService.makeAction(user_id, location_id, wanttogo, like, checkin).then((value){
|
||||
print("----action value----${value}");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// void loadCats(){
|
||||
// dynamic initVal = {'category':'---'};
|
||||
// CatService.loadCats().then((value) {
|
||||
// //value!.add(initVal);
|
||||
// print("###########");
|
||||
// print(value);
|
||||
// cats.add(value);
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
|
||||
void loadCatsv2(){
|
||||
dynamic initVal = {'category':'---'};
|
||||
@ -148,7 +201,6 @@ class IndexController extends GetxController {
|
||||
if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){
|
||||
cats.clear();
|
||||
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) {
|
||||
print("###########");
|
||||
print(value);
|
||||
cats.add(value);
|
||||
});
|
||||
@ -181,11 +233,30 @@ class IndexController extends GetxController {
|
||||
areas.clear();
|
||||
dynamic initVal = {'id':'-1', 'adm2_ja':'----'};
|
||||
PerfectureService.loadGifuAreas(perf).then((value){
|
||||
print(value);
|
||||
value!.add(initVal);
|
||||
areas.add(value);
|
||||
//loadSubPerfFor("9");
|
||||
//subDropdownValue = getSubInitialVal();
|
||||
});
|
||||
}
|
||||
|
||||
void loadUserDetails(){
|
||||
if(currentUser.length > 0){
|
||||
int user_id = currentUser[0]["user"]["id"] as int;
|
||||
AuthService.UserDetails(user_id).then((value){
|
||||
//print("--------- user details ----- ${value}");
|
||||
bool paid = value![0]["paid"] as bool;
|
||||
if(paid){
|
||||
loadCustomAreas();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void loadCustomAreas(){
|
||||
customAreas.clear();
|
||||
PerfectureService.loadCustomAreas().then((value){
|
||||
print("--- loading custom areas ${value}");
|
||||
customAreas.add(value);
|
||||
});
|
||||
}
|
||||
|
||||
@ -235,12 +306,20 @@ class IndexController extends GetxController {
|
||||
});
|
||||
}
|
||||
|
||||
void loadCustomLocation(String customarea, MapController mapController) async {
|
||||
void loadCustomLocation(String customarea) async {
|
||||
String cat = currentCat.isNotEmpty == true ? currentCat[0] : "";
|
||||
print(currentCat);
|
||||
LocationService.loadCustomLocations(cat).then((value){
|
||||
print("----- ${customarea}");
|
||||
LocationService.loadCustomLocations(customarea, cat).then((value){
|
||||
locations.clear();
|
||||
locations.add(value!);
|
||||
List<LatLng> locs = getLocationsList();
|
||||
LatLngBounds bounds = boundsFromLatLngList(locs);
|
||||
mapController!.fitBounds(bounds);
|
||||
setBound(bounds);
|
||||
Future.delayed(Duration(microseconds: 400), () {
|
||||
mapController!.fitBounds(bounds);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@ -312,8 +391,9 @@ class IndexController extends GetxController {
|
||||
is_loading.value = false;
|
||||
}
|
||||
|
||||
void populateForCustomArea(String customarea, MapController mapController){
|
||||
loadCustomLocation("cus", mapController);
|
||||
void populateSubPerForArea(String area, MapController mapController){
|
||||
loadSubPerfFor(area);
|
||||
//loadCustomLocation("cus", mapController);
|
||||
//zoomtoSubPerf(subperf);
|
||||
is_loading.value = false;
|
||||
}
|
||||
@ -337,6 +417,7 @@ class IndexController extends GetxController {
|
||||
return;
|
||||
}
|
||||
int user_id = currentUser[0]["user"]["id"] as int;
|
||||
print("---- loc id ${currentFeature[0].properties}");
|
||||
int location_id = currentFeature[0].properties!["location_id"] as int;
|
||||
ActionService.userAction(user_id, location_id).then((value){
|
||||
print("------${value}");
|
||||
|
||||
@ -37,10 +37,12 @@ class IndexPage extends GetView<IndexController> {
|
||||
const Expanded(child: Text('')),
|
||||
Expanded(child: IconButton(icon: const Icon(Icons.travel_explore), onPressed: (){
|
||||
if(indexController.currentUser.isNotEmpty){
|
||||
Get.toNamed(AppPages.TRAVEL);
|
||||
indexController.switchPage(AppPages.TRAVEL);
|
||||
//Get.toNamed(AppPages.TRAVEL);
|
||||
}
|
||||
else{
|
||||
Get.toNamed(AppPages.LOGIN);
|
||||
indexController.switchPage(AppPages.LOGIN);
|
||||
//Get.toNamed(AppPages.LOGIN);
|
||||
}
|
||||
}),),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user