diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index df78b3b..d606f64 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -32,6 +32,6 @@ android:name="flutterEmbedding" android:value="2" /> + android:value="AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE"/> diff --git a/assets/images/ケーブルカー.png b/assets/images/ケーブルカー.png new file mode 100644 index 0000000..5af9146 Binary files /dev/null and b/assets/images/ケーブルカー.png differ diff --git a/assets/images/コンビニ.png b/assets/images/コンビニ.png new file mode 100644 index 0000000..5cbc8ae Binary files /dev/null and b/assets/images/コンビニ.png differ diff --git a/assets/images/サービスエリア.png b/assets/images/サービスエリア.png new file mode 100644 index 0000000..eb21d9d Binary files /dev/null and b/assets/images/サービスエリア.png differ diff --git a/assets/images/スイーツ.png b/assets/images/スイーツ.png new file mode 100644 index 0000000..8940a33 Binary files /dev/null and b/assets/images/スイーツ.png differ diff --git a/assets/images/スーパー.png b/assets/images/スーパー.png new file mode 100644 index 0000000..c45c2ba Binary files /dev/null and b/assets/images/スーパー.png differ diff --git a/assets/images/タクシー.png b/assets/images/タクシー.png new file mode 100644 index 0000000..a9253f6 Binary files /dev/null and b/assets/images/タクシー.png differ diff --git a/assets/images/トイレ.png b/assets/images/トイレ.png new file mode 100644 index 0000000..1f0cf95 Binary files /dev/null and b/assets/images/トイレ.png differ diff --git a/assets/images/バス.png b/assets/images/バス.png new file mode 100644 index 0000000..80eca30 Binary files /dev/null and b/assets/images/バス.png differ diff --git a/assets/images/ファストフード.png b/assets/images/ファストフード.png new file mode 100644 index 0000000..f43fef2 Binary files /dev/null and b/assets/images/ファストフード.png differ diff --git a/assets/images/モール.png b/assets/images/モール.png new file mode 100644 index 0000000..05959a0 Binary files /dev/null and b/assets/images/モール.png differ diff --git a/assets/images/レンタカー.png b/assets/images/レンタカー.png new file mode 100644 index 0000000..3cf09f7 Binary files /dev/null and b/assets/images/レンタカー.png differ diff --git a/assets/images/レンタサイクル.png b/assets/images/レンタサイクル.png new file mode 100644 index 0000000..8bb107e Binary files /dev/null and b/assets/images/レンタサイクル.png differ diff --git a/assets/images/レース.png b/assets/images/レース.png new file mode 100644 index 0000000..38fa718 Binary files /dev/null and b/assets/images/レース.png differ diff --git a/assets/images/仏閣.png b/assets/images/仏閣.png new file mode 100644 index 0000000..fadc192 Binary files /dev/null and b/assets/images/仏閣.png differ diff --git a/assets/images/体験.png b/assets/images/体験.png new file mode 100644 index 0000000..b665158 Binary files /dev/null and b/assets/images/体験.png differ diff --git a/assets/images/動物園.png b/assets/images/動物園.png new file mode 100644 index 0000000..8dfe273 Binary files /dev/null and b/assets/images/動物園.png differ diff --git a/assets/images/博物館.png b/assets/images/博物館.png new file mode 100644 index 0000000..f753709 Binary files /dev/null and b/assets/images/博物館.png differ diff --git a/assets/images/史跡.png b/assets/images/史跡.png new file mode 100644 index 0000000..38c7bd2 Binary files /dev/null and b/assets/images/史跡.png differ diff --git a/assets/images/名所.png b/assets/images/名所.png new file mode 100644 index 0000000..c106f8c Binary files /dev/null and b/assets/images/名所.png differ diff --git a/assets/images/喫茶店.png b/assets/images/喫茶店.png new file mode 100644 index 0000000..82da8cc Binary files /dev/null and b/assets/images/喫茶店.png differ diff --git a/assets/images/土産.png b/assets/images/土産.png new file mode 100644 index 0000000..bd6aaca Binary files /dev/null and b/assets/images/土産.png differ diff --git a/assets/images/学校.png b/assets/images/学校.png new file mode 100644 index 0000000..06db1b6 Binary files /dev/null and b/assets/images/学校.png differ diff --git a/assets/images/宿泊.png b/assets/images/宿泊.png new file mode 100644 index 0000000..dcce09d Binary files /dev/null and b/assets/images/宿泊.png differ diff --git a/assets/images/射撃.png b/assets/images/射撃.png new file mode 100644 index 0000000..06d4069 Binary files /dev/null and b/assets/images/射撃.png differ diff --git a/assets/images/役場.png b/assets/images/役場.png new file mode 100644 index 0000000..200c152 Binary files /dev/null and b/assets/images/役場.png differ diff --git a/assets/images/文化.png b/assets/images/文化.png new file mode 100644 index 0000000..bdea2fe Binary files /dev/null and b/assets/images/文化.png differ diff --git a/assets/images/旧跡.png b/assets/images/旧跡.png new file mode 100644 index 0000000..369bad4 Binary files /dev/null and b/assets/images/旧跡.png differ diff --git a/assets/images/景勝地.png b/assets/images/景勝地.png new file mode 100644 index 0000000..bc85189 Binary files /dev/null and b/assets/images/景勝地.png differ diff --git a/assets/images/植物園.png b/assets/images/植物園.png new file mode 100644 index 0000000..7b8ea1b Binary files /dev/null and b/assets/images/植物園.png differ diff --git a/assets/images/水族館.png b/assets/images/水族館.png new file mode 100644 index 0000000..7219866 Binary files /dev/null and b/assets/images/水族館.png differ diff --git a/assets/images/温泉.png b/assets/images/温泉.png new file mode 100644 index 0000000..9e7a25d Binary files /dev/null and b/assets/images/温泉.png differ diff --git a/assets/images/用品店.png b/assets/images/用品店.png new file mode 100644 index 0000000..8c089b6 Binary files /dev/null and b/assets/images/用品店.png differ diff --git a/assets/images/発電所.png b/assets/images/発電所.png new file mode 100644 index 0000000..db42a53 Binary files /dev/null and b/assets/images/発電所.png differ diff --git a/assets/images/神社.png b/assets/images/神社.png new file mode 100644 index 0000000..3f2416a Binary files /dev/null and b/assets/images/神社.png differ diff --git a/assets/images/美術館.png b/assets/images/美術館.png new file mode 100644 index 0000000..354ef58 Binary files /dev/null and b/assets/images/美術館.png differ diff --git a/assets/images/観光案内所.png b/assets/images/観光案内所.png new file mode 100644 index 0000000..a2ab234 Binary files /dev/null and b/assets/images/観光案内所.png differ diff --git a/assets/images/遊園地.png b/assets/images/遊園地.png new file mode 100644 index 0000000..8c8fcac Binary files /dev/null and b/assets/images/遊園地.png differ diff --git a/assets/images/酒蔵.png b/assets/images/酒蔵.png new file mode 100644 index 0000000..c1ac80e Binary files /dev/null and b/assets/images/酒蔵.png differ diff --git a/assets/images/銀行.png b/assets/images/銀行.png new file mode 100644 index 0000000..8f0f12f Binary files /dev/null and b/assets/images/銀行.png differ diff --git a/assets/images/食事処.png b/assets/images/食事処.png new file mode 100644 index 0000000..788a94c Binary files /dev/null and b/assets/images/食事処.png differ diff --git a/assets/images/食材店.png b/assets/images/食材店.png new file mode 100644 index 0000000..aeb5e8c Binary files /dev/null and b/assets/images/食材店.png differ diff --git a/assets/images/駅.png b/assets/images/駅.png new file mode 100644 index 0000000..6deb46d Binary files /dev/null and b/assets/images/駅.png differ diff --git a/assets/images/駐車場.png b/assets/images/駐車場.png new file mode 100644 index 0000000..996323f Binary files /dev/null and b/assets/images/駐車場.png differ diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 1d34060..55d8e7f 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -15,7 +15,7 @@ PODS: - GoogleMaps/Base (4.1.0) - GoogleMaps/Maps (4.1.0): - GoogleMaps/Base - - image_picker (0.0.1): + - image_picker_ios (0.0.1): - Flutter - path_provider_ios (0.0.1): - Flutter @@ -32,7 +32,7 @@ DEPENDENCIES: - 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`) + - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`) - permission_handler (from `.symlinks/plugins/permission_handler/ios`) - sqflite (from `.symlinks/plugins/sqflite/ios`) @@ -52,8 +52,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/geolocator_apple/ios" google_maps_flutter: :path: ".symlinks/plugins/google_maps_flutter/ios" - image_picker: - :path: ".symlinks/plugins/image_picker/ios" + image_picker_ios: + :path: ".symlinks/plugins/image_picker_ios/ios" path_provider_ios: :path: ".symlinks/plugins/path_provider_ios/ios" permission_handler: @@ -70,7 +70,7 @@ SPEC CHECKSUMS: geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401 google_maps_flutter: c59fc576c0d0c7f4dc4bd63832c862d22d5a7c6d GoogleMaps: 008e2c80e38605b56b560e8deb73d4194ff30bef - image_picker: 541dcbb3b9cf32d87eacbd957845d8651d6c62c3 + image_picker_ios: b786a5dcf033a8336a657191401bfdf12017dabb path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02 permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 6f55dc6..143ef75 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -8,7 +8,7 @@ import GoogleMaps _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { - GMSServices.provideAPIKey("AIzaSyBLgnwft3py6c4YkT-MxZ9y4zYGFgAEmRk") + GMSServices.provideAPIKey("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE") GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } diff --git a/lib/pages/destination/destination_controller.dart b/lib/pages/destination/destination_controller.dart index 1f6718b..74a7002 100644 --- a/lib/pages/destination/destination_controller.dart +++ b/lib/pages/destination/destination_controller.dart @@ -11,6 +11,7 @@ class DestinationController extends GetxController { List destinations = [].obs; + List> destination_index_data = >[].obs; Map matrix = {}; final IndexController indexController = Get.find(); diff --git a/lib/pages/destination/destination_page.dart b/lib/pages/destination/destination_page.dart index f32b922..aa2c088 100644 --- a/lib/pages/destination/destination_page.dart +++ b/lib/pages/destination/destination_page.dart @@ -3,8 +3,10 @@ import 'dart:developer'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:rogapp/pages/destination/destination_controller.dart'; +import 'package:rogapp/pages/destination_map/destination_map_page.dart'; import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/routes/app_pages.dart'; +import 'package:rogapp/widgets/destination_widget.dart'; import 'package:timeline_tile/timeline_tile.dart'; @@ -56,12 +58,8 @@ class _DestinationPageState extends State { ), floatingActionButton: FloatingActionButton( onPressed: (){ - indexController.toggleMode(); - if(indexController.currentCat.isNotEmpty){ - print("###############"); - print(indexController.currentCat[0].toString()); - } - + //print("######"); + indexController.toggleDestinationMode(); }, tooltip: 'Increment', child: const Icon(Icons.document_scanner), @@ -70,53 +68,39 @@ class _DestinationPageState extends State { floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, appBar:AppBar( title: Text("Iternery"), - ), - body:Obx(() => - ReorderableListView.builder( - itemCount: destinationController.destinations.length, - onReorder: (int oldIndex, int newIndex){ - int action_id = destinationController.destinations[oldIndex]["id"] as int; - //print(action_id); - if(oldIndex > newIndex){ - destinationController.makeOrder(context, action_id, newIndex, "up"); - } - else if(oldIndex < newIndex){ - destinationController.makeOrder(context, action_id, newIndex, "down"); - } - - }, - itemBuilder: (BuildContext context, int index) { - return TimelineTile( - alignment: TimelineAlign.manual, - lineXY: 0.2, - isFirst: index == 0 ? true : false, - indicatorStyle: IndicatorStyle( - color: Colors.red //index == 0 ? (Colors.red)! : (Colors.grey[400])! - ), - key: Key(index.toString()), - endChild: Card( - child: Container( - constraints: const BoxConstraints( - minHeight: 80, - ), - child: ListTile( - leading: getImage(index), - title: Text(destinationController.destinations[index]["location"]["properties"]["location_name"]), - subtitle: Text(destinationController.destinations[index]["location"]["properties"]["category"]), + actions: [ + PopupMenuButton( + icon: Icon(Icons.more_vert), + itemBuilder: (BuildContext context) => [ + const PopupMenuItem( + child: ListTile( + leading: Icon(Icons.cut), + title: Text('Cut'), + ), ), - ), - - ), - startChild: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Text(destinationController.matrix["rows"][0]["elements"][index]["distance"]["text"].toString()), - Text(destinationController.matrix["rows"][0]["elements"][index]["duration"]["text"].toString()) + const PopupMenuItem( + child: ListTile( + leading: Icon(Icons.paste), + title: Text('Paste'), + ), + ), + const PopupMenuItem( + child: ListTile( + leading: Icon(Icons.delete), + title: Text('Delete'), + ), + ), + // const PopupMenuDivider(), + // const PopupMenuItem(child: Text('Item A')), + // const PopupMenuItem(child: Text('Item B')), ], ), - ); - } - ) + ], + ), + body: Obx(() => + indexController.desination_mode.value == 0 ? + DestinationWidget(): + DestinationMapPage() ) ); diff --git a/lib/pages/destination_map/destination_map_controller.dart b/lib/pages/destination_map/destination_map_controller.dart new file mode 100644 index 0000000..e69de29 diff --git a/lib/pages/destination_map/destination_map_page.dart b/lib/pages/destination_map/destination_map_page.dart new file mode 100644 index 0000000..f7e0686 --- /dev/null +++ b/lib/pages/destination_map/destination_map_page.dart @@ -0,0 +1,85 @@ + +import 'package:flutter/material.dart'; +import 'package:flutter_map/plugin_api.dart'; +import 'package:flutter_polyline_points/flutter_polyline_points.dart'; +import 'package:get/get.dart'; +import 'package:latlong2/latlong.dart'; +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'; + +class DestinationMapPage extends StatefulWidget { + DestinationMapPage({ Key? key }) : super(key: key); + + @override + State createState() => _DestinationMapPageState(); +} + +class _DestinationMapPageState extends State { + final IndexController indexController = Get.find(); + + final DestinationController destinationController = Get.find(); + + List? getPoints(){ + //print("##### --- route point ${indexController.routePoints.length}"); + List pts = []; + for(PointLatLng p in indexController.routePoints){ + LatLng l = LatLng(p.latitude, p.longitude); + pts.add(l); + } + return pts; + } + + List? getMarkers(){ + List pts = []; + for(dynamic d in destinationController.destinations){ + double lat = d["location"]["geometry"]["coordinates"][0][1]; + double lan = d["location"]["geometry"]["coordinates"][0][0]; + Marker m = Marker(point: LatLng(lat, lan), builder:(cts){ + return Icon(Icons.pin_drop); + }); + pts.add(m); + } + return pts; + } + + @override + void initState() { + DestinationService.getDestinationLine(destinationController.destinations)?.then((value){ + print("---- loading destination points ------ ${value}"); + indexController.routePoints.clear(); + indexController.routePoints = value; + }); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Obx((() => + FlutterMap( + options: MapOptions( + bounds: indexController.currentBound.length > 0 ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]), + zoom: 5.0, + ), + layers: [ + TileLayerOptions( + urlTemplate: + 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', + subdomains: ['a', 'b', 'c']), + MarkerLayerOptions( + markers: getMarkers()!, + ), + PolylineLayerOptions( + polylines: [ + Polyline( + points: getPoints()!, + strokeWidth: 4.0, + color: Colors.purple), + ], + ), + ], + ) + )); + } +} \ No newline at end of file diff --git a/lib/pages/index/index_controller.dart b/lib/pages/index/index_controller.dart index 4116660..e4de380 100644 --- a/lib/pages/index/index_controller.dart +++ b/lib/pages/index/index_controller.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_map/flutter_map.dart'; import 'package:flutter_map/plugin_api.dart'; +import 'package:flutter_polyline_points/flutter_polyline_points.dart'; import 'package:geojson/geojson.dart'; import 'package:get/get.dart'; import 'package:latlong2/latlong.dart'; @@ -25,6 +26,7 @@ class IndexController extends GetxController { List> currentUser = >[].obs; List currentAction = [].obs; + List routePoints = [].obs; var is_loading = false.obs; @@ -32,12 +34,14 @@ class IndexController extends GetxController { var mode = 0.obs; + var desination_mode = 0.obs; + String dropdownValue = "9"; String subDropdownValue = "-1"; void toggleMode(){ - if(mode==0){ + if(mode.value==0){ mode += 1; } else{ @@ -45,6 +49,15 @@ class IndexController extends GetxController { } } + void toggleDestinationMode(){ + if(desination_mode.value==0){ + desination_mode.value += 1; + } + else{ + desination_mode.value -= 1; + } + } + @override void onInit() { super.onInit(); @@ -208,10 +221,10 @@ class IndexController extends GetxController { void loadLocationsBound(){ String cat = currentCat.isNotEmpty ? currentCat[0] : ""; LatLngBounds bounds = mapController!.bounds!; - print(currentCat); + //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}"); + //print("---value length ------ ${value!.collection.length}"); if(value == null){ return; } @@ -219,7 +232,7 @@ class IndexController extends GetxController { Get.showSnackbar(GetSnackBar(message: "Too many points, please zoom in",)); } if(value != null && value.collection.isNotEmpty){ - print("---- added---"); + //print("---- added---"); locations.clear(); locations.add(value); loadCatsv2(); diff --git a/lib/pages/index/index_page.dart b/lib/pages/index/index_page.dart index 883035a..173aa02 100644 --- a/lib/pages/index/index_page.dart +++ b/lib/pages/index/index_page.dart @@ -11,6 +11,8 @@ import 'package:rogapp/widgets/cat_widget.dart'; import 'package:rogapp/widgets/list_widget.dart'; import 'package:rogapp/widgets/map_widget.dart'; +import 'package:flutter_polyline_points/flutter_polyline_points.dart'; + class IndexPage extends GetView { IndexPage({Key? key}) : super(key: key); @@ -24,7 +26,16 @@ class IndexPage extends GetView { title: Text("app_title".tr), actions: [ ElevatedButton(onPressed: (){}, child: CatWidget(indexController: indexController,)), - //CatWidget(indexController: indexController,), + CatWidget(indexController: indexController,), + ElevatedButton( + onPressed: () async{ + PolylinePoints polylinePoints = PolylinePoints(); + PolylineResult result = await polylinePoints.getRouteBetweenCoordinates("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE", PointLatLng(35.389282, 136.498027), PointLatLng(36.285848, 137.575186)); + print(result.points); + indexController.routePoints = result.points; + }, + child: Text("Google") + ) ], ), bottomNavigationBar: BottomAppBar( diff --git a/lib/routes/app_pages.dart b/lib/routes/app_pages.dart index 22bb17c..3f58fbf 100644 --- a/lib/routes/app_pages.dart +++ b/lib/routes/app_pages.dart @@ -23,6 +23,7 @@ class AppPages { static const REGISTER = Routes.REGISTER; static const TRAVEL = Routes.TRAVEL; static const LOADING = Routes.LOADING; + static const DESTINATION_MAP = Routes.DESTINATION_MAP; static final routes = [ // GetPage( @@ -69,6 +70,11 @@ class AppPages { name: Routes.LOADING, page: () => LoadingPage(), //binding: DestinationBinding(), - ) + ), + GetPage( + name: Routes.DESTINATION_MAP, + page: () => DestinationPage(), + //binding: DestinationBinding(), + ), ]; } \ No newline at end of file diff --git a/lib/routes/app_routes.dart b/lib/routes/app_routes.dart index 5d1985c..98a872c 100644 --- a/lib/routes/app_routes.dart +++ b/lib/routes/app_routes.dart @@ -13,4 +13,5 @@ abstract class Routes { static const REGISTER = '/register'; static const TRAVEL = '/travel'; static const LOADING = '/loading'; + static const DESTINATION_MAP = '/destination_map'; } diff --git a/lib/services/destination_service.dart b/lib/services/destination_service.dart index 239aff8..c66d6bb 100644 --- a/lib/services/destination_service.dart +++ b/lib/services/destination_service.dart @@ -1,4 +1,7 @@ import 'dart:convert'; +import 'dart:ffi'; +import 'package:flutter_polyline_points/flutter_polyline_points.dart'; +//import 'package:google_maps_webservice/directions.dart'; import 'package:http/http.dart' as http; @@ -36,6 +39,35 @@ class DestinationService{ return cats; } + static Future>? getDestinationLine(List destinations) async{ + PolylinePoints polylinePoints = PolylinePoints(); + + //print("##### @@@@@ ${destinations[0]["location"]["geometry"]["coordinates"][0][1]}"); + PointLatLng origin = PointLatLng(destinations[0]["location"]["geometry"]["coordinates"][0][1], destinations[0]["location"]["geometry"]["coordinates"][0][0]); + PointLatLng dest = PointLatLng(destinations[destinations.length -1]["location"]["geometry"]["coordinates"][0][1], destinations[destinations.length -1]["location"]["geometry"]["coordinates"][0][0]); + + + List wayPoints = []; + int i=0; + for(dynamic d in destinations){ + if(i == 0 || i == (destinations.length -1)){ + i+=1; + continue; + } + double la = d["location"]["geometry"]["coordinates"][0][1]as double; + double ln = d["location"]["geometry"]["coordinates"][0][0] as double; + PolylineWayPoint pwp = PolylineWayPoint(location: "${la},${ln}", stopOver: true); + //print("----- UUUUUU ${pwp}"); + //PointLatLng wp = PointLatLng(d["Location"]["geometry"][0][1], d["Location"]["geometry"][0][0]); + wayPoints.add(pwp); + i+=1; + } + //PolylineResult result = await polylinePoints.getRouteBetweenCoordinates("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE", PointLatLng(35.389282, 136.498027), PointLatLng(36.285848, 137.575186)); + PolylineResult result = await polylinePoints.getRouteBetweenCoordinates("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE", origin,dest, travelMode: TravelMode.driving, wayPoints: wayPoints); + //print("#####@@@@@ ${result.points}"); + return result.points; + } + } diff --git a/lib/services/maxtrix_service.dart b/lib/services/maxtrix_service.dart index dc5842c..16af169 100644 --- a/lib/services/maxtrix_service.dart +++ b/lib/services/maxtrix_service.dart @@ -24,7 +24,7 @@ class MatrixService{ //print(locs); Map cats = {}; - String url = "https://maps.googleapis.com/maps/api/distancematrix/json?destinations=${locs}&origins=${origin}&key=AIzaSyBLgnwft3py6c4YkT-MxZ9y4zYGFgAEmRk"; + String url = "https://maps.googleapis.com/maps/api/distancematrix/json?destinations=${locs}&origins=${origin}&key=AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE"; print(url); final http.Response response = await http.get( Uri.parse(url), diff --git a/lib/widgets/destination_widget.dart b/lib/widgets/destination_widget.dart new file mode 100644 index 0000000..92595e5 --- /dev/null +++ b/lib/widgets/destination_widget.dart @@ -0,0 +1,87 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:rogapp/pages/destination/destination_controller.dart'; +import 'package:rogapp/pages/index/index_controller.dart'; +import 'package:timeline_tile/timeline_tile.dart'; + +class DestinationWidget extends StatelessWidget { + DestinationWidget({ Key? key }) : super(key: key); + + final DestinationController destinationController = Get.find(); + + final IndexController indexController = Get.find(); + + final List _items = List.generate(50, (int index) => index); + + Image getImage(int index){ + if(destinationController.destinations[index]["location"]["properties"]["photos"] == null || destinationController.destinations[index]["location"]["properties"]["photos"] == ""){ + return Image(image: AssetImage('assets/images/empty_image.png')); + } + else{ + return Image(image: NetworkImage(destinationController.destinations[index]["location"]["properties"]["photos"])); + } + } + + @override + Widget build(BuildContext context) { + return + ReorderableListView.builder( + + itemCount: destinationController.destinations.length, + onReorder: (int oldIndex, int newIndex){ + int action_id = destinationController.destinations[oldIndex]["id"] as int; + //print(action_id); + if(oldIndex > newIndex){ + destinationController.makeOrder(context, action_id, newIndex, "up"); + } + else if(oldIndex < newIndex){ + destinationController.makeOrder(context, action_id, newIndex, "down"); + } + + }, + itemBuilder: (BuildContext context, int index) { + return TimelineTile( + alignment: TimelineAlign.manual, + lineXY: 0.2, + isFirst: index == 0 ? true : false, + indicatorStyle: IndicatorStyle( + color: index == 0 ? (Colors.red) : (Colors.grey[400])! + ), + key: Key(index.toString()), + endChild: Card( + child: Container( + constraints: const BoxConstraints( + minHeight: 80, + ), + child: ListTile( + onLongPress: (){ + print("----- selected index ${index}"); + var el = destinationController.destination_index_data.where((element) => + element["index"] == index + ); + if(el != null){ + destinationController.destination_index_data.remove(el); + } + print("------${el}---- index ${index}"); + Map indexed = {'index': index, 'selected':true}; + destinationController.destination_index_data.add(indexed); + }, + leading: getImage(index), + title: Text(destinationController.destinations[index]["location"]["properties"]["location_name"]), + subtitle: Text(destinationController.destinations[index]["location"]["properties"]["category"]), + ), + ), + + ), + startChild: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Text(destinationController.matrix["rows"][0]["elements"][index]["distance"]["text"].toString()), + Text(destinationController.matrix["rows"][0]["elements"][index]["duration"]["text"].toString()) + ], + ), + ); + } + ); + } +} \ No newline at end of file diff --git a/lib/widgets/map_widget.dart b/lib/widgets/map_widget.dart index 808fab6..6aa99be 100644 --- a/lib/widgets/map_widget.dart +++ b/lib/widgets/map_widget.dart @@ -162,6 +162,13 @@ class MapWidget extends StatelessWidget { width: 70.0, point: LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude), builder: (ctx) => Icon(Icons.pin_drop), + // builder: (ctx) => i.properties!["category"] != null ? + // ImageIcon( + // AssetImage("assets/images/${i.properties!["category"]}.png"), + // color: Color(0xFF3A5A98), + // ) + // : Icon(Icons.pin_drop), + ); }).toList(), builder: (context, markers) { diff --git a/pubspec.lock b/pubspec.lock index 72dd546..ade5f5b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -56,14 +56,14 @@ packages: name: cross_file url: "https://pub.dartlang.org" source: hosted - version: "0.3.2" + version: "0.3.3" crypto: dependency: transitive description: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "3.0.2" cupertino_icons: dependency: "direct main" description: @@ -91,7 +91,7 @@ packages: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.2.1" file: dependency: transitive description: @@ -145,7 +145,7 @@ packages: name: flutter_map_location_marker url: "https://pub.dartlang.org" source: hosted - version: "3.0.2" + version: "3.1.0" flutter_map_marker_cluster: dependency: "direct main" description: @@ -166,7 +166,7 @@ packages: name: flutter_plugin_android_lifecycle url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.0.6" flutter_polyline_points: dependency: "direct main" description: @@ -204,42 +204,42 @@ packages: name: geolocator url: "https://pub.dartlang.org" source: hosted - version: "8.2.0" + version: "8.2.1" geolocator_android: dependency: transitive description: name: geolocator_android url: "https://pub.dartlang.org" source: hosted - version: "3.1.3" + version: "3.1.8" geolocator_apple: dependency: transitive description: name: geolocator_apple url: "https://pub.dartlang.org" source: hosted - version: "2.1.1+1" + version: "2.1.3" geolocator_platform_interface: dependency: transitive description: name: geolocator_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "4.0.4" + version: "4.0.5" geolocator_web: dependency: transitive description: name: geolocator_web url: "https://pub.dartlang.org" source: hosted - version: "2.1.4" + version: "2.1.5" geolocator_windows: dependency: transitive description: name: geolocator_windows url: "https://pub.dartlang.org" source: hosted - version: "0.1.0" + version: "0.1.1" geopoint: dependency: transitive description: @@ -267,7 +267,7 @@ packages: name: google_fonts url: "https://pub.dartlang.org" source: hosted - version: "2.3.1" + version: "2.3.3" google_maps_flutter: dependency: "direct main" description: @@ -281,7 +281,7 @@ packages: name: google_maps_flutter_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.1.5" + version: "2.1.6" google_maps_webservice: dependency: "direct main" description: @@ -302,28 +302,42 @@ packages: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "4.0.0" + version: "4.0.1" image_picker: dependency: "direct main" description: name: image_picker url: "https://pub.dartlang.org" source: hosted - version: "0.8.4+10" + version: "0.8.5+3" + image_picker_android: + dependency: transitive + description: + name: image_picker_android + url: "https://pub.dartlang.org" + source: hosted + version: "0.8.4+13" image_picker_for_web: dependency: transitive description: name: image_picker_for_web url: "https://pub.dartlang.org" source: hosted - version: "2.1.6" + version: "2.1.8" + image_picker_ios: + dependency: transitive + description: + name: image_picker_ios + url: "https://pub.dartlang.org" + source: hosted + version: "0.8.5+5" image_picker_platform_interface: dependency: transitive description: name: image_picker_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.4.4" + version: "2.5.0" intl: dependency: transitive description: @@ -414,49 +428,49 @@ packages: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "2.0.9" + version: "2.0.10" path_provider_android: dependency: transitive description: name: path_provider_android url: "https://pub.dartlang.org" source: hosted - version: "2.0.12" + version: "2.0.14" path_provider_ios: dependency: transitive description: name: path_provider_ios url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.0.9" path_provider_linux: dependency: transitive description: name: path_provider_linux url: "https://pub.dartlang.org" source: hosted - version: "2.1.5" + version: "2.1.6" path_provider_macos: dependency: transitive description: name: path_provider_macos url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.0.6" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.3" + version: "2.0.4" path_provider_windows: dependency: transitive description: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.0.6" pedantic: dependency: transitive description: @@ -526,7 +540,7 @@ packages: name: quiver url: "https://pub.dartlang.org" source: hosted - version: "3.0.1+1" + version: "3.1.0" sky_engine: dependency: transitive description: flutter @@ -552,14 +566,14 @@ packages: name: sqflite url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.0.2+1" sqflite_common: dependency: transitive description: name: sqflite_common url: "https://pub.dartlang.org" source: hosted - version: "2.2.0" + version: "2.2.1+1" stack_trace: dependency: transitive description: @@ -594,7 +608,7 @@ packages: name: synchronized url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.0.0+2" term_glyph: dependency: transitive description: @@ -650,35 +664,35 @@ packages: name: url_launcher url: "https://pub.dartlang.org" source: hosted - version: "6.0.20" + version: "6.1.2" url_launcher_android: dependency: transitive description: name: url_launcher_android url: "https://pub.dartlang.org" source: hosted - version: "6.0.15" + version: "6.0.17" url_launcher_ios: dependency: transitive description: name: url_launcher_ios url: "https://pub.dartlang.org" source: hosted - version: "6.0.15" + version: "6.0.17" url_launcher_linux: dependency: transitive description: name: url_launcher_linux url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.0.1" url_launcher_macos: dependency: transitive description: name: url_launcher_macos url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.0.1" url_launcher_platform_interface: dependency: transitive description: @@ -692,14 +706,14 @@ packages: name: url_launcher_web url: "https://pub.dartlang.org" source: hosted - version: "2.0.9" + version: "2.0.11" url_launcher_windows: dependency: transitive description: name: url_launcher_windows url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.0.1" vector_math: dependency: "direct main" description: @@ -713,7 +727,7 @@ packages: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "2.4.1" + version: "2.5.2" wkt_parser: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index e433fc8..ee8e31b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -90,6 +90,7 @@ flutter: # To add assets to your application, add an assets section, like this: assets: + - assets/images/ - assets/images/empty_image.png - assets/gradient_japanese_temple.jpg # - images/a_dot_ham.jpeg