update
This commit is contained in:
@ -31,5 +31,7 @@
|
||||
<meta-data
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
<meta-data android:name="com.google.android.geo.API_KEY"
|
||||
android:value="AIzaSyBLgnwft3py6c4YkT-MxZ9y4zYGFgAEmRk"/>
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
@ -7,6 +7,14 @@ PODS:
|
||||
- FMDB/standard (2.7.5)
|
||||
- geolocator_apple (1.2.0):
|
||||
- Flutter
|
||||
- google_maps_flutter (0.0.1):
|
||||
- Flutter
|
||||
- GoogleMaps
|
||||
- GoogleMaps (4.1.0):
|
||||
- GoogleMaps/Maps (= 4.1.0)
|
||||
- GoogleMaps/Base (4.1.0)
|
||||
- GoogleMaps/Maps (4.1.0):
|
||||
- GoogleMaps/Base
|
||||
- image_picker (0.0.1):
|
||||
- Flutter
|
||||
- path_provider_ios (0.0.1):
|
||||
@ -23,6 +31,7 @@ DEPENDENCIES:
|
||||
- Flutter (from `Flutter`)
|
||||
- flutter_compass (from `.symlinks/plugins/flutter_compass/ios`)
|
||||
- geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`)
|
||||
- google_maps_flutter (from `.symlinks/plugins/google_maps_flutter/ios`)
|
||||
- image_picker (from `.symlinks/plugins/image_picker/ios`)
|
||||
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
|
||||
- permission_handler (from `.symlinks/plugins/permission_handler/ios`)
|
||||
@ -32,6 +41,7 @@ DEPENDENCIES:
|
||||
SPEC REPOS:
|
||||
trunk:
|
||||
- FMDB
|
||||
- GoogleMaps
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
Flutter:
|
||||
@ -40,6 +50,8 @@ EXTERNAL SOURCES:
|
||||
:path: ".symlinks/plugins/flutter_compass/ios"
|
||||
geolocator_apple:
|
||||
:path: ".symlinks/plugins/geolocator_apple/ios"
|
||||
google_maps_flutter:
|
||||
:path: ".symlinks/plugins/google_maps_flutter/ios"
|
||||
image_picker:
|
||||
:path: ".symlinks/plugins/image_picker/ios"
|
||||
path_provider_ios:
|
||||
@ -56,6 +68,8 @@ SPEC CHECKSUMS:
|
||||
flutter_compass: cbbd285cea1584c7ac9c4e0c3e1f17cbea55e855
|
||||
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
||||
geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401
|
||||
google_maps_flutter: c59fc576c0d0c7f4dc4bd63832c862d22d5a7c6d
|
||||
GoogleMaps: 008e2c80e38605b56b560e8deb73d4194ff30bef
|
||||
image_picker: 541dcbb3b9cf32d87eacbd957845d8651d6c62c3
|
||||
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
|
||||
permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0
|
||||
|
||||
@ -140,6 +140,7 @@
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
8340085CA329EF510409EEF4 /* [CP] Embed Pods Frameworks */,
|
||||
98C3810C530EA7CF0B7CC3E0 /* [CP] Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@ -265,6 +266,23 @@
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
||||
};
|
||||
98C3810C530EA7CF0B7CC3E0 /* [CP] Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
|
||||
);
|
||||
name = "[CP] Copy Pods Resources";
|
||||
outputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import UIKit
|
||||
import Flutter
|
||||
import GoogleMaps
|
||||
|
||||
@UIApplicationMain
|
||||
@objc class AppDelegate: FlutterAppDelegate {
|
||||
@ -7,6 +8,7 @@ import Flutter
|
||||
_ application: UIApplication,
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||
) -> Bool {
|
||||
GMSServices.provideAPIKey("AIzaSyBLgnwft3py6c4YkT-MxZ9y4zYGFgAEmRk")
|
||||
GeneratedPluginRegistrant.register(with: self)
|
||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||
}
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>io.flutter.embedded_views_preview</key>
|
||||
<true/>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
|
||||
@ -5,11 +5,13 @@ import 'package:get/get.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';
|
||||
|
||||
class DestinationController extends GetxController {
|
||||
|
||||
|
||||
List<dynamic> destinations = <dynamic>[].obs;
|
||||
Map<String, dynamic> matrix = {};
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
@ -24,8 +26,16 @@ class DestinationController extends GetxController {
|
||||
int user_id = indexController.currentUser[0]["user"]["id"] as int;
|
||||
//print(user_id);
|
||||
DestinationService.getDestinations(user_id).then((value){
|
||||
destinations.clear();
|
||||
destinations = value;
|
||||
|
||||
MatrixService.getDestinations(value).then((mat){
|
||||
print(mat);
|
||||
matrix = mat;
|
||||
|
||||
destinations.clear();
|
||||
destinations = value;
|
||||
|
||||
});
|
||||
|
||||
//var val = value[2]["location"]["id"];
|
||||
//print("-----current destinations ----- ${val}");
|
||||
});
|
||||
|
||||
@ -110,8 +110,8 @@ class _DestinationPageState extends State<DestinationPage> {
|
||||
startChild: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text("12:30"),
|
||||
Text("01:20"),
|
||||
Text(destinationController.matrix["rows"][0]["elements"][index]["distance"]["text"].toString()),
|
||||
Text(destinationController.matrix["rows"][0]["elements"][index]["duration"]["text"].toString())
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:flutter_map/plugin_api.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
@ -22,7 +25,6 @@ class IndexController extends GetxController {
|
||||
|
||||
List<Map<String, dynamic>> currentUser = <Map<String, dynamic>>[].obs;
|
||||
List<dynamic> currentAction = <dynamic>[].obs;
|
||||
|
||||
|
||||
var is_loading = false.obs;
|
||||
|
||||
@ -47,20 +49,19 @@ class IndexController extends GetxController {
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
|
||||
if(locations.length == 0){
|
||||
LocationService.loadLocations().then((value){
|
||||
locations.add(value!);
|
||||
//print(value);
|
||||
});
|
||||
}
|
||||
// if(locations.length == 0){
|
||||
// LocationService.loadLocations().then((value){
|
||||
// locations.add(value!);
|
||||
// //print(value);
|
||||
// });
|
||||
// }
|
||||
if(perfectures.length == 0){
|
||||
PerfectureService.loadPerfectures().then((value){
|
||||
perfectures.add(value);
|
||||
loadSubPerfFor("9");
|
||||
});
|
||||
}
|
||||
loadCats();
|
||||
|
||||
}
|
||||
//loadCats();
|
||||
}
|
||||
|
||||
void login(String email, String password, BuildContext context){
|
||||
@ -112,25 +113,51 @@ class IndexController extends GetxController {
|
||||
|
||||
}
|
||||
|
||||
void loadCats(){
|
||||
// void loadCats(){
|
||||
// dynamic initVal = {'category':'---'};
|
||||
// CatService.loadCats().then((value) {
|
||||
// //value!.add(initVal);
|
||||
// print("###########");
|
||||
// print(value);
|
||||
// cats.add(value);
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
|
||||
void loadCatsv2(){
|
||||
dynamic initVal = {'category':'---'};
|
||||
CatService.loadCats().then((value) {
|
||||
//value!.add(initVal);
|
||||
print("###########");
|
||||
print(value);
|
||||
cats.add(value);
|
||||
});
|
||||
LatLngBounds bounds = mapController!.bounds!;
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void refreshLocationForCat(){
|
||||
if(subDropdownValue == "-1"){
|
||||
LocationService.loadLocationsFor(dropdownValue, currentCat[0]);
|
||||
print("loading main------");
|
||||
}
|
||||
else{
|
||||
LocationService.loadLocationsSubFor(subDropdownValue, currentCat[0]);
|
||||
print("loading sub------");
|
||||
}
|
||||
loadLocationsBound();
|
||||
// if(subDropdownValue == "-1"){
|
||||
// LocationService.loadLocationsFor(dropdownValue, currentCat[0]).then((value){
|
||||
// locations.clear();
|
||||
// locations.add(value!);
|
||||
// is_loading.value = false;
|
||||
// });
|
||||
// print("loading main------");
|
||||
// }
|
||||
// else{
|
||||
// LocationService.loadLocationsSubFor(subDropdownValue, currentCat[0]).then((value){
|
||||
// locations.clear();
|
||||
// locations.add(value!);
|
||||
// is_loading.value = false;
|
||||
// });
|
||||
// print("loading sub------");
|
||||
// }
|
||||
}
|
||||
|
||||
void loadSubPerfFor(String perf){
|
||||
@ -158,18 +185,48 @@ class IndexController extends GetxController {
|
||||
}
|
||||
|
||||
void loadLocationforPerf(String perf, MapController mapController) async {
|
||||
String cat = currentCat.isNotEmpty == true ? currentCat[0] : "";
|
||||
print(currentCat);
|
||||
// LocationService.loadLocationsFor(perf, cat).then((value){
|
||||
// locations.clear();
|
||||
// locations.add(value!);
|
||||
// mapController.fitBounds(currentBound[0]);
|
||||
// });
|
||||
locations.clear();
|
||||
LocationService.loadLocationsFor(perf, currentCat[0]).then((value){
|
||||
mapController.fitBounds(currentBound[0]);
|
||||
}
|
||||
|
||||
void loadLocationforSubPerf(String subperf, MapController mapController) async {
|
||||
String cat = currentCat.isNotEmpty == true ? currentCat[0] : "";
|
||||
print(currentCat);
|
||||
LocationService.loadLocationsSubFor(subperf, cat).then((value){
|
||||
locations.clear();
|
||||
locations.add(value!);
|
||||
mapController.fitBounds(currentBound[0]);
|
||||
});
|
||||
}
|
||||
|
||||
void loadLocationforSubPerf(String subperf, MapController mapController) async {
|
||||
locations.clear();
|
||||
LocationService.loadLocationsSubFor(subperf, currentCat[0]).then((value){
|
||||
locations.add(value!);
|
||||
});
|
||||
void loadLocationsBound(){
|
||||
String cat = currentCat.isNotEmpty ? currentCat[0] : "";
|
||||
LatLngBounds bounds = mapController!.bounds!;
|
||||
print(currentCat);
|
||||
if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){
|
||||
LocationService.loadLocationsBound(bounds.southWest!.latitude, bounds.southWest!.longitude, bounds.northWest.latitude, bounds.northWest.longitude, bounds.northEast!.latitude, bounds.northEast!.longitude, bounds.southEast.latitude, bounds.southEast.longitude, cat).then((value){
|
||||
print("---value length ------ ${value!.collection.length}");
|
||||
if(value == null){
|
||||
return;
|
||||
}
|
||||
if(value != null && value.collection.isEmpty){
|
||||
Get.showSnackbar(GetSnackBar(message: "Too many points, please zoom in",));
|
||||
}
|
||||
if(value != null && value.collection.isNotEmpty){
|
||||
print("---- added---");
|
||||
locations.clear();
|
||||
locations.add(value);
|
||||
loadCatsv2();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void setBound(LatLngBounds bounds){
|
||||
@ -206,12 +263,14 @@ class IndexController extends GetxController {
|
||||
loadSubPerfFor(perf);
|
||||
loadLocationforPerf(perf, mapController);
|
||||
zoomtoMainPerf(perf);
|
||||
is_loading.value = false;
|
||||
}
|
||||
|
||||
void populateForSubPerf(String subperf, MapController mapController){
|
||||
subDropdownValue = subperf;
|
||||
loadLocationforSubPerf(subperf, mapController);
|
||||
zoomtoSubPerf(subperf);
|
||||
is_loading.value = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/drawer/drawer_page.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:rogapp/services/maxtrix_service.dart';
|
||||
import 'package:rogapp/widgets/bread_crum_widget.dart';
|
||||
import 'package:rogapp/widgets/cat_widget.dart';
|
||||
import 'package:rogapp/widgets/list_widget.dart';
|
||||
@ -72,7 +73,20 @@ class IndexPage extends GetView<IndexController> {
|
||||
BreadCrumbWidget(),
|
||||
Container(width: 24.0,),
|
||||
Obx(()=>
|
||||
indexController.currentCat.isNotEmpty ? Text(indexController.currentCat[0].toString()): Text("")
|
||||
Row(
|
||||
children: [
|
||||
indexController.currentCat.isNotEmpty ? Text(indexController.currentCat[0].toString()): Text(""),
|
||||
indexController.currentCat.isNotEmpty ?
|
||||
IconButton(
|
||||
onPressed: (){
|
||||
indexController.currentCat.clear();
|
||||
indexController.loadLocationsBound();
|
||||
},
|
||||
icon: Icon(Icons.cancel, color: Colors.red,)
|
||||
) :
|
||||
Container(width: 0, height: 0,)
|
||||
],
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
16
lib/pages/loading/loading_page.dart
Normal file
16
lib/pages/loading/loading_page.dart
Normal file
@ -0,0 +1,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LoadingPage extends StatelessWidget {
|
||||
const LoadingPage({ Key? key }) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
alignment: Alignment.topCenter,
|
||||
margin: EdgeInsets.only(top: 20),
|
||||
child: CircularProgressIndicator(
|
||||
value: 0.8,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,7 @@ import 'package:rogapp/pages/destination/destination_page.dart';
|
||||
import 'package:rogapp/pages/index/index_binding.dart';
|
||||
import 'package:rogapp/pages/index/index_page.dart';
|
||||
import 'package:rogapp/pages/landing/landing_page.dart';
|
||||
import 'package:rogapp/pages/loading/loading_page.dart';
|
||||
import 'package:rogapp/pages/login/login_page.dart';
|
||||
import 'package:rogapp/pages/register/register_page.dart';
|
||||
import 'package:rogapp/spa/spa_binding.dart';
|
||||
@ -21,6 +22,7 @@ class AppPages {
|
||||
static const LOGIN = Routes.LOGIN;
|
||||
static const REGISTER = Routes.REGISTER;
|
||||
static const TRAVEL = Routes.TRAVEL;
|
||||
static const LOADING = Routes.LOADING;
|
||||
|
||||
static final routes = [
|
||||
// GetPage(
|
||||
@ -62,6 +64,11 @@ class AppPages {
|
||||
name: Routes.TRAVEL,
|
||||
page: () => DestinationPage(),
|
||||
binding: DestinationBinding(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.LOADING,
|
||||
page: () => LoadingPage(),
|
||||
//binding: DestinationBinding(),
|
||||
)
|
||||
];
|
||||
}
|
||||
@ -12,4 +12,5 @@ abstract class Routes {
|
||||
static const LOGIN = '/login';
|
||||
static const REGISTER = '/register';
|
||||
static const TRAVEL = '/travel';
|
||||
static const LOADING = '/loading';
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ class ActionService{
|
||||
|
||||
static Future<Map<String, dynamic>> makeAction(int user_id, int location_id, bool wanttogo, bool like, bool checkin) async {
|
||||
Map<String, dynamic> cats = {};
|
||||
String url = "http://localhost:8100/api/makeaction/?user_id=${user_id}&location_id=${location_id}&wanttogo=${wanttogo}&like=${like}&checkin=${checkin}";
|
||||
String url = "http://container.intranet.sumasen.net:8100/api/makeaction/?user_id=${user_id}&location_id=${location_id}&wanttogo=${wanttogo}&like=${like}&checkin=${checkin}";
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
@ -23,7 +23,7 @@ class ActionService{
|
||||
|
||||
static Future<List<dynamic>?> userAction(int user_id, int location_id) async {
|
||||
List<dynamic> cats = [];
|
||||
String url = 'http://localhost:8100/api/useraction/?user_id=${user_id}&location_id=${location_id}';
|
||||
String url = 'http://container.intranet.sumasen.net:8100/api/useraction/?user_id=${user_id}&location_id=${location_id}';
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
|
||||
@ -6,7 +6,7 @@ class AuthService{
|
||||
|
||||
static Future<Map<String, dynamic>> login(String email, String password) async {
|
||||
Map<String, dynamic> cats = {};
|
||||
String url = 'http://localhost:8100/api/login/';
|
||||
String url = 'http://container.intranet.sumasen.net:8100/api/login/';
|
||||
final http.Response response = await http.post(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
@ -27,7 +27,7 @@ class AuthService{
|
||||
|
||||
static Future<Map<String, dynamic>> register(String email, String password) async {
|
||||
Map<String, dynamic> cats = {};
|
||||
String url = 'http://localhost:8100/api/register/';
|
||||
String url = 'http://container.intranet.sumasen.net:8100/api/register/';
|
||||
final http.Response response = await http.post(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
|
||||
@ -5,9 +5,12 @@ import 'package:http/http.dart' as http;
|
||||
|
||||
class CatService{
|
||||
|
||||
static Future<List<dynamic>?> loadCats() async {
|
||||
static Future<List<dynamic>?> loadCats(double lat1, double lon1, double lat2, double lon2, double lat3, double lon3, double lat4, double lon4) async {
|
||||
List<dynamic> cats = [];
|
||||
String url = 'http://localhost:8100/api/cats/';
|
||||
String url = 'http://container.intranet.sumasen.net: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',
|
||||
@ -26,3 +29,7 @@ class CatService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ class DestinationService{
|
||||
|
||||
static Future<List<dynamic>> getDestinations(int user_id) async {
|
||||
List<dynamic> cats = [];
|
||||
String url = "http://localhost:8100/api/destinations/?user_id=${user_id}";
|
||||
String url = "http://container.intranet.sumasen.net:8100/api/destinations/?user_id=${user_id}";
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
@ -22,7 +22,7 @@ class DestinationService{
|
||||
|
||||
static Future<int> updateOrder(int action_id, int order, String dir) async {
|
||||
int cats = 0;
|
||||
String url = "http://localhost:8100/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
|
||||
String url = "http://container.intranet.sumasen.net:8100/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
|
||||
@ -7,7 +7,7 @@ class LocationLineService{
|
||||
final geo = GeoJson();
|
||||
GeoJsonFeature? fs;
|
||||
|
||||
String url = 'http://localhost:8100/api/location_line/';
|
||||
String url = 'http://container.intranet.sumasen.net:8100/api/location_line/';
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
|
||||
@ -7,7 +7,7 @@ class LocationPolygonervice{
|
||||
final geo = GeoJson();
|
||||
GeoJsonFeature? fs;
|
||||
|
||||
String url = 'http://localhost:8100/api/location_polygon/';
|
||||
String url = 'http://container.intranet.sumasen.net:8100/api/location_polygon/';
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
|
||||
@ -6,7 +6,7 @@ import 'package:http/http.dart' as http;
|
||||
class LocationService{
|
||||
|
||||
static Future<GeoJsonFeatureCollection?> loadLocations() async {
|
||||
String url = 'http://localhost:8100/api/location/';
|
||||
String url = 'http://container.intranet.sumasen.net:8100/api/location/';
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -23,11 +23,12 @@ class LocationService{
|
||||
static Future<GeoJsonFeatureCollection?> loadLocationsFor(String perfecture, String cat) async {
|
||||
String url = "";
|
||||
if(cat.isNotEmpty){
|
||||
url = 'http://localhost:8100/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
||||
url = 'http://container.intranet.sumasen.net:8100/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
||||
}
|
||||
else{
|
||||
url = 'http://localhost:8100/api/inperf/?perf=' + perfecture;
|
||||
url = 'http://container.intranet.sumasen.net:8100/api/inperf/?perf=' + perfecture;
|
||||
}
|
||||
//print("----- url ---- ${url} --- ${cat}");
|
||||
//String url = 'http://localhost:8100/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
@ -47,10 +48,11 @@ class LocationService{
|
||||
static Future<GeoJsonFeatureCollection?> loadLocationsSubFor(String subperfecture, String cat) async {
|
||||
String url = "";
|
||||
if(cat.isNotEmpty){
|
||||
url = 'http://localhost:8100/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
|
||||
url = 'http://container.intranet.sumasen.net:8100/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
|
||||
}
|
||||
else{
|
||||
url = 'http://localhost:8100/api/insubperf?subperf=' + subperfecture;
|
||||
print("------ loading location in sub----");
|
||||
url = 'http://container.intranet.sumasen.net:8100/api/insubperf?subperf=' + subperfecture;
|
||||
}
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
@ -67,5 +69,38 @@ class LocationService{
|
||||
}
|
||||
|
||||
|
||||
static Future<GeoJsonFeatureCollection?> loadLocationsBound(double lat1, double lon1, double lat2, double lon2, double lat3, double lon3, double lat4, double lon4, String cat) async {
|
||||
String url = "";
|
||||
print("cat is ----- ${cat}");
|
||||
if(cat.isNotEmpty){
|
||||
url = 'http://container.intranet.sumasen.net:8100/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&cat=' + cat;
|
||||
}
|
||||
else{
|
||||
url = 'http://container.intranet.sumasen.net:8100/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
||||
}
|
||||
print("----url --- ${url}");
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
},
|
||||
);
|
||||
|
||||
if (response.statusCode == 500) {
|
||||
return GeoJsonFeatureCollection(); //featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
||||
}
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
GeoJsonFeatureCollection cc = await featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
||||
if(cc.collection.isEmpty){
|
||||
return null;
|
||||
}
|
||||
else{
|
||||
return cc;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
44
lib/services/maxtrix_service.dart
Normal file
44
lib/services/maxtrix_service.dart
Normal file
@ -0,0 +1,44 @@
|
||||
|
||||
import 'dart:convert';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
|
||||
class MatrixService{
|
||||
|
||||
static Future<Map<String, dynamic>> getDestinations(List<dynamic> destinations) async {
|
||||
|
||||
String locs = "";
|
||||
String origin = "";
|
||||
int i = 0;
|
||||
for(Map<String, dynamic> loc in destinations){
|
||||
|
||||
if(i==0){
|
||||
origin = "${loc["location"]["geometry"]["coordinates"][0][1]}, ${loc["location"]["geometry"]["coordinates"][0][0]}";
|
||||
}
|
||||
|
||||
print("lat is ${loc["location"]["geometry"]["coordinates"][0][1]}, long is ${loc["location"]["geometry"]["coordinates"][0][0]}");
|
||||
locs += "${loc["location"]["geometry"]["coordinates"][0][1]}, ${loc["location"]["geometry"]["coordinates"][0][0]}|";
|
||||
i++;
|
||||
}
|
||||
|
||||
//print(locs);
|
||||
|
||||
Map<String, dynamic> cats = {};
|
||||
String url = "https://maps.googleapis.com/maps/api/distancematrix/json?destinations=${locs}&origins=${origin}&key=AIzaSyBLgnwft3py6c4YkT-MxZ9y4zYGFgAEmRk";
|
||||
print(url);
|
||||
final http.Response 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ class PerfectureService{
|
||||
|
||||
static Future<List<dynamic>?> loadPerfectures() async {
|
||||
List<dynamic> perfs = [];
|
||||
String url = 'http://localhost:8100/api/perf_main/';
|
||||
String url = 'http://container.intranet.sumasen.net:8100/api/perf_main/';
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -22,7 +22,7 @@ class PerfectureService{
|
||||
|
||||
static Future<List<dynamic>?> loadSubPerfectures(String sub) async {
|
||||
List<dynamic> perfs = [];
|
||||
String url = 'http://localhost:8100/api/subperfinmain/?perf=' + sub;
|
||||
String url = 'http://container.intranet.sumasen.net:8100/api/subperfinmain/?perf=' + sub;
|
||||
//String url = 'http://container.intranet.sumasen.net:8100/api/insubperf/?perf=' + sub;
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
@ -40,7 +40,7 @@ class PerfectureService{
|
||||
|
||||
static Future<List<dynamic>?> getMainPerfExt(String id) async {
|
||||
List<dynamic> perfs = [];
|
||||
String url = 'http://localhost:8100/api/mainperfext/?perf=' + id;
|
||||
String url = 'http://container.intranet.sumasen.net:8100/api/mainperfext/?perf=' + id;
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -57,7 +57,7 @@ class PerfectureService{
|
||||
|
||||
static Future<List<dynamic>?> getSubExt(String id) async {
|
||||
List<dynamic> perfs = [];
|
||||
String url = 'http://localhost:8100/api/perfext/?sub_perf=' + id;
|
||||
String url = 'http://container.intranet.sumasen.net:8100/api/perfext/?sub_perf=' + id;
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
|
||||
@ -24,6 +24,7 @@ class _CatWidgetState extends State<CatWidget> {
|
||||
widget.indexController.refreshLocationForCat();
|
||||
setState(() {
|
||||
print(value);
|
||||
//widget.indexController.is_loading.value = true;
|
||||
defaultValue = value.toString();
|
||||
});
|
||||
},
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
import 'dart:async';
|
||||
import 'dart:ffi';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/plugin_api.dart';
|
||||
import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
|
||||
@ -16,16 +19,38 @@ class MapWidget extends StatelessWidget {
|
||||
|
||||
MapWidget({ Key? key}) : super(key: key);
|
||||
|
||||
StreamSubscription? subscription;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final PopupController _popupController = PopupController();
|
||||
return Stack(
|
||||
children: [
|
||||
Obx(() =>
|
||||
indexController.is_loading == true ? Padding(
|
||||
padding: const EdgeInsets.only(top: 60.0),
|
||||
child: CircularProgressIndicator(),
|
||||
):
|
||||
FlutterMap(
|
||||
//mapController: mapController,
|
||||
options: MapOptions(
|
||||
onMapCreated: (c){indexController.mapController = c;},
|
||||
onMapCreated: (c){
|
||||
indexController.mapController = c;
|
||||
|
||||
indexController.mapController!.onReady.then((_) {
|
||||
subscription = indexController.mapController!.mapEventStream.listen((MapEvent mapEvent) {
|
||||
if (mapEvent is MapEventMoveStart) {
|
||||
//print(DateTime.now().toString() + ' [MapEventMoveStart] START');
|
||||
// do something
|
||||
}
|
||||
if (mapEvent is MapEventMoveEnd) {
|
||||
//print(DateTime.now().toString() + ' [MapEventMoveStart] END');
|
||||
indexController.loadLocationsBound();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
//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)]),
|
||||
zoom: 1,
|
||||
@ -34,20 +59,75 @@ class MapWidget extends StatelessWidget {
|
||||
plugins: [
|
||||
MarkerClusterPlugin(),
|
||||
],
|
||||
|
||||
onPositionChanged: (MapPosition pos, isvalue){
|
||||
|
||||
// LatLng c1 = pos.center?? LatLng(0, 0);
|
||||
|
||||
// Timer(Duration(milliseconds:800), () {
|
||||
// print(pos.bounds!.center);
|
||||
// print("Yeah, this line is printed after 3 second");
|
||||
// LatLng c2 = pos.center?? LatLng(0, 0);
|
||||
// if(c1.latitude != 0 && c1.latitude == c2.latitude){
|
||||
// print("------ calling ----");
|
||||
// //indexController.loadLocationsBound();
|
||||
// }
|
||||
|
||||
// });
|
||||
|
||||
//
|
||||
},
|
||||
onTap: (_, __) =>
|
||||
_popupController
|
||||
.hideAllPopups(), // Hide popup when the map is tapped.
|
||||
),
|
||||
layers: [
|
||||
// MarkerLayerOptions(
|
||||
// markers: indexController.locations[0].collection.map((i) {
|
||||
// print("i si ${i.properties!['location_id']}");
|
||||
// GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
|
||||
// print("lat is ${p.geoSerie!.geoPoints[0].latitude} and lon is ${p.geoSerie!.geoPoints[0].longitude}");
|
||||
// return Marker(
|
||||
// anchorPos: AnchorPos.align(AnchorAlign.center),
|
||||
// height: 70.0,
|
||||
// width: 70.0,
|
||||
// point: LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude),
|
||||
// builder: (ctx) =>
|
||||
// IconButton(
|
||||
// icon: const Icon(Icons.pin_drop),
|
||||
// tooltip: 'Increase volume by 10',
|
||||
// onPressed: () {
|
||||
// GeoJsonFeature? fs = indexController.getFeatureForLatLong(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude);
|
||||
// print(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())
|
||||
// );
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
|
||||
// );
|
||||
// }).toList(),
|
||||
// ),
|
||||
],
|
||||
children: [
|
||||
BaseLayer(),
|
||||
LocationMarkerLayerWidget(),
|
||||
|
||||
indexController.locations.length > 0 ?
|
||||
MarkerClusterLayerWidget(
|
||||
options: MarkerClusterLayerOptions(
|
||||
spiderfyCircleRadius: 80,
|
||||
spiderfyCircleRadius: 0,
|
||||
spiderfySpiralDistanceMultiplier: 2,
|
||||
circleSpiralSwitchover: 12,
|
||||
maxClusterRadius: 20,
|
||||
maxClusterRadius: 0,
|
||||
rotate: true,
|
||||
onMarkerTap: (marker){
|
||||
GeoJsonFeature? fs = indexController.getFeatureForLatLong(marker.point.latitude, marker.point.longitude);
|
||||
|
||||
@ -69,6 +69,7 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
|
||||
onChanged: (String? newValue) {
|
||||
//setState(() {
|
||||
if(newValue != null){
|
||||
widget.indexController.is_loading.value = true;
|
||||
widget.indexController.dropdownValue = newValue;
|
||||
widget.indexController.populateForPerf(newValue, widget.mapController);
|
||||
}
|
||||
@ -92,6 +93,7 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
if(newValue != null){
|
||||
widget.indexController.is_loading.value = true;
|
||||
widget.indexController.populateForSubPerf(newValue, widget.mapController);
|
||||
//widget.indexController.loadLocationforSubPerf(newValue, widget.mapController);
|
||||
//widget.indexController.subDropdownValue = newValue;
|
||||
|
||||
35
pubspec.lock
35
pubspec.lock
@ -167,6 +167,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.5"
|
||||
flutter_polyline_points:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_polyline_points
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@ -261,6 +268,27 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.3.1"
|
||||
google_maps_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: google_maps_flutter
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.5"
|
||||
google_maps_flutter_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: google_maps_flutter_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.5"
|
||||
google_maps_webservice:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: google_maps_webservice
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.0.19"
|
||||
http:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -546,6 +574,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
stream_transform:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stream_transform
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
string_scanner:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@ -61,6 +61,9 @@ dependencies:
|
||||
url_launcher: ^6.0.20
|
||||
flutter_breadcrumb: ^1.0.1
|
||||
timeline_tile: ^2.0.0
|
||||
google_maps_flutter: ^2.1.5
|
||||
flutter_polyline_points: ^1.0.0
|
||||
google_maps_webservice: ^0.0.19
|
||||
|
||||
|
||||
dev_dependencies:
|
||||
|
||||
Reference in New Issue
Block a user