diff --git a/lib/pages/destination/destination_controller.dart b/lib/pages/destination/destination_controller.dart index 094284b..270713c 100644 --- a/lib/pages/destination/destination_controller.dart +++ b/lib/pages/destination/destination_controller.dart @@ -695,6 +695,43 @@ class DestinationController extends GetxController { }); } + buildShowDialog(BuildContext context) { + return showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return Center( + child: CircularProgressIndicator(), + ); + }); + } + + void destinationMatrixFromCurrentPoint(List points){ + buildShowDialog(Get.context!); + MatrixService.getDestinations(points).then((mat){ + print(" matrix is ------- ${mat}"); + matrix = mat; + + try{ + indexController.routePoints = []; + indexController.routePointLenght.value = 0; + DestinationService.getDestinationLine(points, matrix)?.then((value){ + indexController.routePoints = value; + indexController.routePointLenght.value = indexController.routePoints.length; + Get.toNamed(AppPages.TRAVEL); + }); + destinationCount.value = destinations.length; + } + catch(_){ + skip_gps = false; + return; + } + finally{ + Get.back(); + } + }); + } + void PopulateDestinations(){ print("--------- destination controller populsting destinations ----------- ::::::"); diff --git a/lib/pages/destination_map/destination_map_page.dart b/lib/pages/destination_map/destination_map_page.dart index 963a772..b50c623 100644 --- a/lib/pages/destination_map/destination_map_page.dart +++ b/lib/pages/destination_map/destination_map_page.dart @@ -136,7 +136,9 @@ class DestinationMapPage extends StatelessWidget { LatLngBounds bounds = c.bounds!; indexController.currentBound.clear(); indexController.currentBound.add(bounds); - indexController.loadLocationsBound(); + if(indexController.currentUser.length <= 0){ + indexController.loadLocationsBound(); + } } }); }); diff --git a/lib/pages/progress/progress.dart b/lib/pages/progress/progress.dart new file mode 100644 index 0000000..fb4549d --- /dev/null +++ b/lib/pages/progress/progress.dart @@ -0,0 +1,18 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/src/foundation/key.dart'; +import 'package:flutter/src/widgets/container.dart'; +import 'package:flutter/src/widgets/framework.dart'; + +class ProgressPage extends StatelessWidget { + const ProgressPage({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Container( + color: Colors.transparent, + child: Center( + child: CircularProgressIndicator(), + ), + ); + } +} \ No newline at end of file diff --git a/lib/routes/app_pages.dart b/lib/routes/app_pages.dart index 2cf72d0..2f48fdc 100644 --- a/lib/routes/app_pages.dart +++ b/lib/routes/app_pages.dart @@ -15,6 +15,7 @@ import 'package:rogapp/pages/loading/loading_page.dart'; import 'package:rogapp/pages/login/login_page.dart'; import 'package:rogapp/pages/mainperf/mainperf_page.dart'; import 'package:rogapp/pages/permission/permission.dart'; +import 'package:rogapp/pages/progress/progress.dart'; import 'package:rogapp/pages/register/register_page.dart'; import 'package:rogapp/pages/search/search_binding.dart'; import 'package:rogapp/pages/search/search_page.dart'; @@ -46,6 +47,7 @@ class AppPages { static const CATEGORY = Routes.CATEOGORY; static const CHANGE_PASSWORD = Routes.CHANGE_PASSWORD; static const CAMERA_PAGE = Routes.CAMERA_PAGE; + static const PROGRESS = Routes.PROGRESS; static final routes = [ // GetPage( @@ -135,6 +137,10 @@ class AppPages { GetPage( name: Routes.CAMERA_PAGE, page: () => CameraPage(), + ), + GetPage( + name: Routes.PROGRESS, + page: () => ProgressPage(), ) ]; } \ No newline at end of file diff --git a/lib/routes/app_routes.dart b/lib/routes/app_routes.dart index 62cf429..b48d014 100644 --- a/lib/routes/app_routes.dart +++ b/lib/routes/app_routes.dart @@ -23,4 +23,5 @@ abstract class Routes { static const CATEOGORY = '/category'; static const CHANGE_PASSWORD = '/change_password'; static const CAMERA_PAGE = '/camera_page'; + static const PROGRESS = '/progress'; } diff --git a/lib/utils/const.dart b/lib/utils/const.dart index 9010207..3127cee 100644 --- a/lib/utils/const.dart +++ b/lib/utils/const.dart @@ -7,6 +7,7 @@ class ConstValues{ static const dev_server = "http://localhost:8100"; static const dev_ip_server = "http://192.168.8.100:8100"; static const dev_home_ip_server = "http://172.20.10.9:8100"; + static const dev_home_ip_mserver = "http://192.168.1.10:8100"; static String currentServer(){ return server_uri; diff --git a/lib/widgets/bottom_sheet_new.dart b/lib/widgets/bottom_sheet_new.dart index 7dd3b6b..2eb2911 100644 --- a/lib/widgets/bottom_sheet_new.dart +++ b/lib/widgets/bottom_sheet_new.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_map/plugin_api.dart'; import 'package:geojson/geojson.dart'; +import 'package:geolocator/geolocator.dart'; import 'package:get/get.dart'; import 'package:get/get_state_manager/get_state_manager.dart'; import 'package:image_picker/image_picker.dart'; @@ -423,6 +425,25 @@ class BottomSheetNew extends GetView { ], ), ), + ElevatedButton( + onPressed:() async { + GeoJsonFeature mp = indexController.currentFeature[0] as GeoJsonFeature; + Position position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high); + Destination ds = Destination( + lat: position.latitude, + lon: position.longitude + ); + + Destination tp = Destination( + lat: mp.geometry!.geoSerie!.geoPoints[0].latitude, + lon: mp.geometry!.geoSerie!.geoPoints[0].longitude + ); + + Get.back(); + + destinationController.destinationMatrixFromCurrentPoint([ds, tp]); + }, + child:Text("ここへ行く")), ], ), SizedBox(height: 8.0,), @@ -522,7 +543,7 @@ class BottomSheetNew extends GetView { mainAxisAlignment: MainAxisAlignment.center, children: [ Row( - mainAxisAlignment: MainAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ indexController.rog_mode == 0 ? IconButton( @@ -640,9 +661,9 @@ class BottomSheetNew extends GetView { Container() ) - ) + ), ], - ) + ), ], ); } diff --git a/lib/widgets/map_widget.dart b/lib/widgets/map_widget.dart index 1ba3872..add34a8 100644 --- a/lib/widgets/map_widget.dart +++ b/lib/widgets/map_widget.dart @@ -83,7 +83,7 @@ class MapWidget extends StatelessWidget { //print(DateTime.now().toString() + ' [MapEventMoveStart] START'); // do something } - if (mapEvent is MapEventMoveEnd) { + if (mapEvent is MapEventMoveEnd && indexController.currentUser. length <= 0) { //print(DateTime.now().toString() + ' [MapEventMoveStart] END'); indexController.loadLocationsBound(); //indexController.rogMapController!.move(c.center, c.zoom);