This commit is contained in:
Mohamed Nouffer
2022-05-24 20:43:41 +05:30
parent ee0440e6b6
commit 3cb7865d3b
60 changed files with 342 additions and 100 deletions

View File

@ -32,6 +32,6 @@
android:name="flutterEmbedding" android:name="flutterEmbedding"
android:value="2" /> android:value="2" />
<meta-data android:name="com.google.android.geo.API_KEY" <meta-data android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyBLgnwft3py6c4YkT-MxZ9y4zYGFgAEmRk"/> android:value="AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE"/>
</application> </application>
</manifest> </manifest>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
assets/images/トイレ.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
assets/images/バス.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
assets/images/モール.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
assets/images/レース.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
assets/images/仏閣.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
assets/images/体験.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
assets/images/動物園.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
assets/images/博物館.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
assets/images/史跡.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
assets/images/名所.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
assets/images/喫茶店.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
assets/images/土産.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
assets/images/学校.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
assets/images/宿泊.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
assets/images/射撃.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
assets/images/役場.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
assets/images/文化.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
assets/images/旧跡.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
assets/images/景勝地.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
assets/images/植物園.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
assets/images/水族館.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
assets/images/温泉.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
assets/images/用品店.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
assets/images/発電所.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
assets/images/神社.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
assets/images/美術館.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
assets/images/遊園地.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
assets/images/酒蔵.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
assets/images/銀行.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
assets/images/食事処.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
assets/images/食材店.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
assets/images/駅.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
assets/images/駐車場.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -15,7 +15,7 @@ PODS:
- GoogleMaps/Base (4.1.0) - GoogleMaps/Base (4.1.0)
- GoogleMaps/Maps (4.1.0): - GoogleMaps/Maps (4.1.0):
- GoogleMaps/Base - GoogleMaps/Base
- image_picker (0.0.1): - image_picker_ios (0.0.1):
- Flutter - Flutter
- path_provider_ios (0.0.1): - path_provider_ios (0.0.1):
- Flutter - Flutter
@ -32,7 +32,7 @@ DEPENDENCIES:
- flutter_compass (from `.symlinks/plugins/flutter_compass/ios`) - flutter_compass (from `.symlinks/plugins/flutter_compass/ios`)
- geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`) - geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`)
- google_maps_flutter (from `.symlinks/plugins/google_maps_flutter/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`) - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
- permission_handler (from `.symlinks/plugins/permission_handler/ios`) - permission_handler (from `.symlinks/plugins/permission_handler/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`) - sqflite (from `.symlinks/plugins/sqflite/ios`)
@ -52,8 +52,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/geolocator_apple/ios" :path: ".symlinks/plugins/geolocator_apple/ios"
google_maps_flutter: google_maps_flutter:
:path: ".symlinks/plugins/google_maps_flutter/ios" :path: ".symlinks/plugins/google_maps_flutter/ios"
image_picker: image_picker_ios:
:path: ".symlinks/plugins/image_picker/ios" :path: ".symlinks/plugins/image_picker_ios/ios"
path_provider_ios: path_provider_ios:
:path: ".symlinks/plugins/path_provider_ios/ios" :path: ".symlinks/plugins/path_provider_ios/ios"
permission_handler: permission_handler:
@ -70,7 +70,7 @@ SPEC CHECKSUMS:
geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401 geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401
google_maps_flutter: c59fc576c0d0c7f4dc4bd63832c862d22d5a7c6d google_maps_flutter: c59fc576c0d0c7f4dc4bd63832c862d22d5a7c6d
GoogleMaps: 008e2c80e38605b56b560e8deb73d4194ff30bef GoogleMaps: 008e2c80e38605b56b560e8deb73d4194ff30bef
image_picker: 541dcbb3b9cf32d87eacbd957845d8651d6c62c3 image_picker_ios: b786a5dcf033a8336a657191401bfdf12017dabb
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02 path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904

View File

@ -8,7 +8,7 @@ import GoogleMaps
_ application: UIApplication, _ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool { ) -> Bool {
GMSServices.provideAPIKey("AIzaSyBLgnwft3py6c4YkT-MxZ9y4zYGFgAEmRk") GMSServices.provideAPIKey("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE")
GeneratedPluginRegistrant.register(with: self) GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions) return super.application(application, didFinishLaunchingWithOptions: launchOptions)
} }

View File

@ -11,6 +11,7 @@ class DestinationController extends GetxController {
List<dynamic> destinations = <dynamic>[].obs; List<dynamic> destinations = <dynamic>[].obs;
List<Map<String, dynamic>> destination_index_data = <Map<String, dynamic>>[].obs;
Map<String, dynamic> matrix = {}; Map<String, dynamic> matrix = {};
final IndexController indexController = Get.find<IndexController>(); final IndexController indexController = Get.find<IndexController>();

View File

@ -3,8 +3,10 @@ import 'dart:developer';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:rogapp/pages/destination/destination_controller.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/pages/index/index_controller.dart';
import 'package:rogapp/routes/app_pages.dart'; import 'package:rogapp/routes/app_pages.dart';
import 'package:rogapp/widgets/destination_widget.dart';
import 'package:timeline_tile/timeline_tile.dart'; import 'package:timeline_tile/timeline_tile.dart';
@ -56,12 +58,8 @@ class _DestinationPageState extends State<DestinationPage> {
), ),
floatingActionButton: FloatingActionButton( floatingActionButton: FloatingActionButton(
onPressed: (){ onPressed: (){
indexController.toggleMode(); //print("######");
if(indexController.currentCat.isNotEmpty){ indexController.toggleDestinationMode();
print("###############");
print(indexController.currentCat[0].toString());
}
}, },
tooltip: 'Increment', tooltip: 'Increment',
child: const Icon(Icons.document_scanner), child: const Icon(Icons.document_scanner),
@ -70,53 +68,39 @@ class _DestinationPageState extends State<DestinationPage> {
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
appBar:AppBar( appBar:AppBar(
title: Text("Iternery"), title: Text("Iternery"),
), actions: [
body:Obx(() => PopupMenuButton(
ReorderableListView.builder( icon: Icon(Icons.more_vert),
itemCount: destinationController.destinations.length, itemBuilder: (BuildContext context) => <PopupMenuEntry>[
onReorder: (int oldIndex, int newIndex){ const PopupMenuItem(
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( child: ListTile(
leading: getImage(index), leading: Icon(Icons.cut),
title: Text(destinationController.destinations[index]["location"]["properties"]["location_name"]), title: Text('Cut'),
subtitle: Text(destinationController.destinations[index]["location"]["properties"]["category"]),
), ),
), ),
const PopupMenuItem(
child: ListTile(
leading: Icon(Icons.paste),
title: Text('Paste'),
), ),
startChild: Column( ),
mainAxisAlignment: MainAxisAlignment.spaceEvenly, const PopupMenuItem(
children: [ child: ListTile(
Text(destinationController.matrix["rows"][0]["elements"][index]["distance"]["text"].toString()), leading: Icon(Icons.delete),
Text(destinationController.matrix["rows"][0]["elements"][index]["duration"]["text"].toString()) 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()
) )
); );

View File

@ -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<DestinationMapPage> createState() => _DestinationMapPageState();
}
class _DestinationMapPageState extends State<DestinationMapPage> {
final IndexController indexController = Get.find<IndexController>();
final DestinationController destinationController = Get.find<DestinationController>();
List<LatLng>? getPoints(){
//print("##### --- route point ${indexController.routePoints.length}");
List<LatLng> pts = [];
for(PointLatLng p in indexController.routePoints){
LatLng l = LatLng(p.latitude, p.longitude);
pts.add(l);
}
return pts;
}
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];
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),
],
),
],
)
));
}
}

View File

@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart'; import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map/plugin_api.dart'; import 'package:flutter_map/plugin_api.dart';
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
import 'package:geojson/geojson.dart'; import 'package:geojson/geojson.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:latlong2/latlong.dart'; import 'package:latlong2/latlong.dart';
@ -25,6 +26,7 @@ class IndexController extends GetxController {
List<Map<String, dynamic>> currentUser = <Map<String, dynamic>>[].obs; List<Map<String, dynamic>> currentUser = <Map<String, dynamic>>[].obs;
List<dynamic> currentAction = <dynamic>[].obs; List<dynamic> currentAction = <dynamic>[].obs;
List<PointLatLng> routePoints = <PointLatLng>[].obs;
var is_loading = false.obs; var is_loading = false.obs;
@ -32,12 +34,14 @@ class IndexController extends GetxController {
var mode = 0.obs; var mode = 0.obs;
var desination_mode = 0.obs;
String dropdownValue = "9"; String dropdownValue = "9";
String subDropdownValue = "-1"; String subDropdownValue = "-1";
void toggleMode(){ void toggleMode(){
if(mode==0){ if(mode.value==0){
mode += 1; mode += 1;
} }
else{ 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 @override
void onInit() { void onInit() {
super.onInit(); super.onInit();
@ -208,10 +221,10 @@ class IndexController extends GetxController {
void loadLocationsBound(){ void loadLocationsBound(){
String cat = currentCat.isNotEmpty ? currentCat[0] : ""; String cat = currentCat.isNotEmpty ? currentCat[0] : "";
LatLngBounds bounds = mapController!.bounds!; LatLngBounds bounds = mapController!.bounds!;
print(currentCat); //print(currentCat);
if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){ 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){ 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){ if(value == null){
return; return;
} }
@ -219,7 +232,7 @@ class IndexController extends GetxController {
Get.showSnackbar(GetSnackBar(message: "Too many points, please zoom in",)); Get.showSnackbar(GetSnackBar(message: "Too many points, please zoom in",));
} }
if(value != null && value.collection.isNotEmpty){ if(value != null && value.collection.isNotEmpty){
print("---- added---"); //print("---- added---");
locations.clear(); locations.clear();
locations.add(value); locations.add(value);
loadCatsv2(); loadCatsv2();

View File

@ -11,6 +11,8 @@ import 'package:rogapp/widgets/cat_widget.dart';
import 'package:rogapp/widgets/list_widget.dart'; import 'package:rogapp/widgets/list_widget.dart';
import 'package:rogapp/widgets/map_widget.dart'; import 'package:rogapp/widgets/map_widget.dart';
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
class IndexPage extends GetView<IndexController> { class IndexPage extends GetView<IndexController> {
IndexPage({Key? key}) : super(key: key); IndexPage({Key? key}) : super(key: key);
@ -24,7 +26,16 @@ class IndexPage extends GetView<IndexController> {
title: Text("app_title".tr), title: Text("app_title".tr),
actions: [ actions: [
ElevatedButton(onPressed: (){}, child: CatWidget(indexController: indexController,)), 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( bottomNavigationBar: BottomAppBar(

View File

@ -23,6 +23,7 @@ class AppPages {
static const REGISTER = Routes.REGISTER; static const REGISTER = Routes.REGISTER;
static const TRAVEL = Routes.TRAVEL; static const TRAVEL = Routes.TRAVEL;
static const LOADING = Routes.LOADING; static const LOADING = Routes.LOADING;
static const DESTINATION_MAP = Routes.DESTINATION_MAP;
static final routes = [ static final routes = [
// GetPage( // GetPage(
@ -69,6 +70,11 @@ class AppPages {
name: Routes.LOADING, name: Routes.LOADING,
page: () => LoadingPage(), page: () => LoadingPage(),
//binding: DestinationBinding(), //binding: DestinationBinding(),
) ),
GetPage(
name: Routes.DESTINATION_MAP,
page: () => DestinationPage(),
//binding: DestinationBinding(),
),
]; ];
} }

View File

@ -13,4 +13,5 @@ abstract class Routes {
static const REGISTER = '/register'; static const REGISTER = '/register';
static const TRAVEL = '/travel'; static const TRAVEL = '/travel';
static const LOADING = '/loading'; static const LOADING = '/loading';
static const DESTINATION_MAP = '/destination_map';
} }

View File

@ -1,4 +1,7 @@
import 'dart:convert'; 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; import 'package:http/http.dart' as http;
@ -36,6 +39,35 @@ class DestinationService{
return cats; return cats;
} }
static Future<List<PointLatLng>>? getDestinationLine(List<dynamic> 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<PolylineWayPoint> 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;
}
} }

View File

@ -24,7 +24,7 @@ class MatrixService{
//print(locs); //print(locs);
Map<String, dynamic> cats = {}; Map<String, dynamic> 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); print(url);
final http.Response response = await http.get( final http.Response response = await http.get(
Uri.parse(url), Uri.parse(url),

View File

@ -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<DestinationController>();
final IndexController indexController = Get.find<IndexController>();
final List<int> _items = List<int>.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<String, dynamic> 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())
],
),
);
}
);
}
}

View File

@ -162,6 +162,13 @@ class MapWidget extends StatelessWidget {
width: 70.0, width: 70.0,
point: LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude), point: LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude),
builder: (ctx) => Icon(Icons.pin_drop), 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(), }).toList(),
builder: (context, markers) { builder: (context, markers) {

View File

@ -56,14 +56,14 @@ packages:
name: cross_file name: cross_file
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.2" version: "0.3.3"
crypto: crypto:
dependency: transitive dependency: transitive
description: description:
name: crypto name: crypto
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.1" version: "3.0.2"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
@ -91,7 +91,7 @@ packages:
name: ffi name: ffi
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.2" version: "1.2.1"
file: file:
dependency: transitive dependency: transitive
description: description:
@ -145,7 +145,7 @@ packages:
name: flutter_map_location_marker name: flutter_map_location_marker
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.2" version: "3.1.0"
flutter_map_marker_cluster: flutter_map_marker_cluster:
dependency: "direct main" dependency: "direct main"
description: description:
@ -166,7 +166,7 @@ packages:
name: flutter_plugin_android_lifecycle name: flutter_plugin_android_lifecycle
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.5" version: "2.0.6"
flutter_polyline_points: flutter_polyline_points:
dependency: "direct main" dependency: "direct main"
description: description:
@ -204,42 +204,42 @@ packages:
name: geolocator name: geolocator
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "8.2.0" version: "8.2.1"
geolocator_android: geolocator_android:
dependency: transitive dependency: transitive
description: description:
name: geolocator_android name: geolocator_android
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.1.3" version: "3.1.8"
geolocator_apple: geolocator_apple:
dependency: transitive dependency: transitive
description: description:
name: geolocator_apple name: geolocator_apple
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.1+1" version: "2.1.3"
geolocator_platform_interface: geolocator_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: geolocator_platform_interface name: geolocator_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.0.4" version: "4.0.5"
geolocator_web: geolocator_web:
dependency: transitive dependency: transitive
description: description:
name: geolocator_web name: geolocator_web
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.4" version: "2.1.5"
geolocator_windows: geolocator_windows:
dependency: transitive dependency: transitive
description: description:
name: geolocator_windows name: geolocator_windows
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.0" version: "0.1.1"
geopoint: geopoint:
dependency: transitive dependency: transitive
description: description:
@ -267,7 +267,7 @@ packages:
name: google_fonts name: google_fonts
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.3.1" version: "2.3.3"
google_maps_flutter: google_maps_flutter:
dependency: "direct main" dependency: "direct main"
description: description:
@ -281,7 +281,7 @@ packages:
name: google_maps_flutter_platform_interface name: google_maps_flutter_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.5" version: "2.1.6"
google_maps_webservice: google_maps_webservice:
dependency: "direct main" dependency: "direct main"
description: description:
@ -302,28 +302,42 @@ packages:
name: http_parser name: http_parser
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.0.0" version: "4.0.1"
image_picker: image_picker:
dependency: "direct main" dependency: "direct main"
description: description:
name: image_picker name: image_picker
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted 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: image_picker_for_web:
dependency: transitive dependency: transitive
description: description:
name: image_picker_for_web name: image_picker_for_web
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted 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: image_picker_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: image_picker_platform_interface name: image_picker_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.4.4" version: "2.5.0"
intl: intl:
dependency: transitive dependency: transitive
description: description:
@ -414,49 +428,49 @@ packages:
name: path_provider name: path_provider
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.9" version: "2.0.10"
path_provider_android: path_provider_android:
dependency: transitive dependency: transitive
description: description:
name: path_provider_android name: path_provider_android
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.12" version: "2.0.14"
path_provider_ios: path_provider_ios:
dependency: transitive dependency: transitive
description: description:
name: path_provider_ios name: path_provider_ios
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.8" version: "2.0.9"
path_provider_linux: path_provider_linux:
dependency: transitive dependency: transitive
description: description:
name: path_provider_linux name: path_provider_linux
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.5" version: "2.1.6"
path_provider_macos: path_provider_macos:
dependency: transitive dependency: transitive
description: description:
name: path_provider_macos name: path_provider_macos
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.5" version: "2.0.6"
path_provider_platform_interface: path_provider_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: path_provider_platform_interface name: path_provider_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.3" version: "2.0.4"
path_provider_windows: path_provider_windows:
dependency: transitive dependency: transitive
description: description:
name: path_provider_windows name: path_provider_windows
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.5" version: "2.0.6"
pedantic: pedantic:
dependency: transitive dependency: transitive
description: description:
@ -526,7 +540,7 @@ packages:
name: quiver name: quiver
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.1+1" version: "3.1.0"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@ -552,14 +566,14 @@ packages:
name: sqflite name: sqflite
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.2" version: "2.0.2+1"
sqflite_common: sqflite_common:
dependency: transitive dependency: transitive
description: description:
name: sqflite_common name: sqflite_common
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.2.0" version: "2.2.1+1"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@ -594,7 +608,7 @@ packages:
name: synchronized name: synchronized
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.0" version: "3.0.0+2"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
@ -650,35 +664,35 @@ packages:
name: url_launcher name: url_launcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.0.20" version: "6.1.2"
url_launcher_android: url_launcher_android:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_android name: url_launcher_android
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.0.15" version: "6.0.17"
url_launcher_ios: url_launcher_ios:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_ios name: url_launcher_ios
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.0.15" version: "6.0.17"
url_launcher_linux: url_launcher_linux:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_linux name: url_launcher_linux
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.0" version: "3.0.1"
url_launcher_macos: url_launcher_macos:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_macos name: url_launcher_macos
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.0" version: "3.0.1"
url_launcher_platform_interface: url_launcher_platform_interface:
dependency: transitive dependency: transitive
description: description:
@ -692,14 +706,14 @@ packages:
name: url_launcher_web name: url_launcher_web
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.9" version: "2.0.11"
url_launcher_windows: url_launcher_windows:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_windows name: url_launcher_windows
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.0" version: "3.0.1"
vector_math: vector_math:
dependency: "direct main" dependency: "direct main"
description: description:
@ -713,7 +727,7 @@ packages:
name: win32 name: win32
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.4.1" version: "2.5.2"
wkt_parser: wkt_parser:
dependency: transitive dependency: transitive
description: description:

View File

@ -90,6 +90,7 @@ flutter:
# To add assets to your application, add an assets section, like this: # To add assets to your application, add an assets section, like this:
assets: assets:
- assets/images/
- assets/images/empty_image.png - assets/images/empty_image.png
- assets/gradient_japanese_temple.jpg - assets/gradient_japanese_temple.jpg
# - images/a_dot_ham.jpeg # - images/a_dot_ham.jpeg