update for routing
This commit is contained in:
@ -30,34 +30,33 @@ class DestinationController extends GetxController {
|
||||
List<Destination> currentSelectedDestinations = <Destination>[].obs;
|
||||
|
||||
bool checking_in = false;
|
||||
List<bool> isSelected = [true].obs;
|
||||
var isSelected = false.obs;
|
||||
BuildContext? context;
|
||||
|
||||
List<String> gps = <String>["-- stating --"].obs;
|
||||
List<String> locationPermission = <String>[" -- starting -- "].obs;
|
||||
|
||||
var travelMode = 0.obs;
|
||||
|
||||
|
||||
Map<String, dynamic> matrix = {};
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
void getRoutePoints() {
|
||||
indexController.routePoints = [];
|
||||
indexController.routePointLenght.value = 0;
|
||||
DestinationService.getDestinationLine(destinations)?.then((value){
|
||||
indexController.routePoints = value;
|
||||
indexController.routePointLenght.value = indexController.routePoints.length;
|
||||
});
|
||||
}
|
||||
|
||||
Future<Destination?> getDEstinationForLatLong(double lat, double long)async {
|
||||
|
||||
String jjjj = '{"id":1,"type":"Feature","geometry":{"type":"MultiPoint","coordinates":[[136.731357,35.370094]]},"properties":{"location_id":915101,"location_name":"柳津","category":"買い物","zip":"〒501-6100","address":"柳津町字仙右城7696-1"}}';
|
||||
|
||||
for(final d in destinations){
|
||||
// var geom = d["location"]["geometry"];
|
||||
// var props = d["location"]["properties"];
|
||||
// print("--props- ${d["location"]["geometry"]["coordinates"][0][1]}");
|
||||
// List<dynamic> geom_multi = [geom];
|
||||
// Map<String, dynamic> final_geom = {"features":[{"id":d["id"],"type":"Feature", "geometry": geom, "properties": props}]};
|
||||
// //print("----- geom : ${final_geom}");
|
||||
|
||||
// String js = json.encode(final_geom);
|
||||
// //print("---features-- ${js}-----");
|
||||
// GeoJsonFeatureCollection features = await featuresFromGeoJson(js);
|
||||
// GeoJsonMultiPoint p = features.collection[0].geometry as GeoJsonMultiPoint;
|
||||
if(lat == d.lat && long == d.lon){
|
||||
return d;
|
||||
}
|
||||
@ -145,11 +144,9 @@ class DestinationController extends GetxController {
|
||||
|
||||
@override
|
||||
void onInit() async {
|
||||
super.onInit();
|
||||
checkPermission();
|
||||
PopulateDestinations();
|
||||
|
||||
|
||||
//print("------ in iniit");
|
||||
|
||||
|
||||
@ -190,7 +187,7 @@ class DestinationController extends GetxController {
|
||||
StreamSubscription<Position> positionStream = Geolocator.getPositionStream(locationSettings: locationSettings).listen(
|
||||
|
||||
(Position? position) {
|
||||
if(isSelected[0]){
|
||||
if(isSelected.value){
|
||||
double czoom = indexController.rogMapController!.zoom;
|
||||
indexController.rogMapController!.move(LatLng(position!.latitude, position!.longitude), czoom);
|
||||
//String user_id = indexController.currentUser[0]["user"]["id"].toString();
|
||||
@ -209,6 +206,7 @@ class DestinationController extends GetxController {
|
||||
locationPermission.add(err.toString());
|
||||
}
|
||||
|
||||
super.onInit();
|
||||
|
||||
}
|
||||
|
||||
@ -266,10 +264,10 @@ class DestinationController extends GetxController {
|
||||
void PopulateDestinations(){
|
||||
print("--------- destination controller populsting destinations ----------- ::::::");
|
||||
|
||||
destinations.clear();
|
||||
destinationCount.value = 0;
|
||||
DatabaseHelper db = DatabaseHelper.instance;
|
||||
db.getDestinations().then((value){
|
||||
destinations.clear();
|
||||
destinationCount.value = 0;
|
||||
for(Destination d in value){
|
||||
for(Destination s in currentSelectedDestinations){
|
||||
if(d.location_id == s.location_id){
|
||||
@ -280,27 +278,24 @@ class DestinationController extends GetxController {
|
||||
destinations.add(d);
|
||||
}
|
||||
// destinationCount.value = 0;
|
||||
destinationCount.value = destinations.length;
|
||||
print("------ destination controller destinationcount-------- ${destinationCount}-------- :::::");
|
||||
|
||||
|
||||
MatrixService.getDestinations(value).then((mat){
|
||||
print(mat);
|
||||
print(" matrix is ------- ${mat}");
|
||||
matrix = mat;
|
||||
|
||||
getRoutePoints();
|
||||
destinationCount.value = destinations.length;
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
void makeOrder(int action_id, int order, String dir){
|
||||
DestinationService.updateOrder(action_id, order, dir).then((value){
|
||||
//print("----action value----${value}");
|
||||
PopulateDestinations();
|
||||
destination_index_data.clear();
|
||||
});
|
||||
|
||||
void makeOrder(String locationId){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -12,15 +12,9 @@ import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:rogapp/widgets/destination_widget.dart';
|
||||
import 'package:timeline_tile/timeline_tile.dart';
|
||||
|
||||
class DestnationPage extends StatelessWidget {
|
||||
DestnationPage({Key? key}) : super(key: key);
|
||||
|
||||
class DestinationPage extends StatefulWidget {
|
||||
DestinationPage({ Key? key }) : super(key: key);
|
||||
|
||||
@override
|
||||
State<DestinationPage> createState() => _DestinationPageState();
|
||||
}
|
||||
|
||||
class _DestinationPageState extends State<DestinationPage> {
|
||||
final DestinationController destinationController = Get.find<DestinationController>();
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
@ -47,14 +41,20 @@ class _DestinationPageState extends State<DestinationPage> {
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
//destinationController.context = context;
|
||||
//destinationController.PopulateDestinations();
|
||||
super.initState();
|
||||
Widget getRoutingImage(int route){
|
||||
switch (route) {
|
||||
case 0:
|
||||
return Image(image: AssetImage('assets/images/p4_9_man.png'), width: 35.0,);
|
||||
case 1:
|
||||
return Image(image: AssetImage('assets/images/p4_8_car.png'), width: 35.0,);
|
||||
case 2:
|
||||
return Image(image: AssetImage('assets/images/p4_10_train.png'), width: 35.0,);
|
||||
default:
|
||||
return Image(image: AssetImage('assets/images/p4_9_man.png'), width: 35.0,);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ColorScheme colorScheme = Theme.of(context).colorScheme;
|
||||
final Color oddItemColor = colorScheme.primary.withOpacity(0.05);
|
||||
@ -68,13 +68,72 @@ class _DestinationPageState extends State<DestinationPage> {
|
||||
drawer: DrawerPage(),
|
||||
bottomNavigationBar: BottomAppBar(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Expanded(child: Container(width: 0, height: 0,),),
|
||||
const Expanded(child: Text('')),
|
||||
Expanded(child: IconButton(icon: const Icon(Icons.travel_explore), onPressed: (){
|
||||
indexController.switchPage(AppPages.INITIAL);
|
||||
}),),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left:13.0),
|
||||
child: InkWell(
|
||||
child: Obx((() => getRoutingImage(destinationController.travelMode.value))),
|
||||
onTap: (){
|
||||
Get.bottomSheet(
|
||||
Obx(() =>
|
||||
ListView(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top:30.0, bottom: 30),
|
||||
child: Center(child: Text("select_travel_mode".tr, style: TextStyle(fontSize: 22.0, color:Colors.red, fontWeight:FontWeight.bold),),),
|
||||
),
|
||||
ListTile(
|
||||
selected: destinationController.travelMode == 0 ? true : false,
|
||||
selectedTileColor: Colors.amber.shade200,
|
||||
leading: Image(image: AssetImage('assets/images/p4_9_man.png'),),
|
||||
title: Text("walking".tr),
|
||||
onTap:(){
|
||||
destinationController.travelMode.value = 0;
|
||||
destinationController.PopulateDestinations();
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
selected: destinationController.travelMode == 1 ? true : false,
|
||||
selectedTileColor: Colors.amber.shade200,
|
||||
leading: Image(image: AssetImage('assets/images/p4_8_car.png'),),
|
||||
title: Text("driving".tr),
|
||||
onTap:(){
|
||||
destinationController.travelMode.value = 1;
|
||||
destinationController.PopulateDestinations();
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
selected: destinationController.travelMode == 2 ? true : false,
|
||||
selectedTileColor: Colors.amber.shade200,
|
||||
leading: Image(image: AssetImage('assets/images/p4_10_train.png'),),
|
||||
title: Text("transit".tr),
|
||||
onTap:(){
|
||||
destinationController.travelMode.value = 2;
|
||||
destinationController.PopulateDestinations();
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
),
|
||||
),
|
||||
isScrollControlled:false,
|
||||
backgroundColor: Colors.white,
|
||||
);
|
||||
//destinationController.PopulateDestinations();
|
||||
}
|
||||
),
|
||||
)
|
||||
,
|
||||
IconButton(
|
||||
icon: const Icon(Icons.travel_explore, size: 35,),
|
||||
onPressed: (){
|
||||
indexController.switchPage(AppPages.INITIAL);
|
||||
}
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -84,7 +143,12 @@ class _DestinationPageState extends State<DestinationPage> {
|
||||
indexController.toggleDestinationMode();
|
||||
},
|
||||
tooltip: 'Increment',
|
||||
child: const Icon(Icons.document_scanner),
|
||||
child: Obx(() =>
|
||||
indexController.desination_mode == 1 ?
|
||||
Image(image: AssetImage('assets/images/list2.png'))
|
||||
:
|
||||
Image(image: AssetImage('assets/images/map.png'))
|
||||
),
|
||||
elevation: 4.0,
|
||||
),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
||||
@ -92,21 +156,19 @@ class _DestinationPageState extends State<DestinationPage> {
|
||||
automaticallyImplyLeading: true,
|
||||
title: Text("app_title".tr),
|
||||
actions: [
|
||||
//Obx(() =>
|
||||
Obx(() =>
|
||||
ToggleButtons(
|
||||
disabledColor: Colors.grey.shade200,
|
||||
selectedColor: Colors.red,
|
||||
children: <Widget>[
|
||||
Icon(Icons.explore
|
||||
Icon(Icons.explore, size: 35.0,
|
||||
)],
|
||||
onPressed: (int index) {
|
||||
setState(() {
|
||||
destinationController.isSelected[index] = !destinationController.isSelected[index];
|
||||
});
|
||||
destinationController.isSelected.value = !destinationController.isSelected.value;
|
||||
},
|
||||
isSelected: destinationController.isSelected,
|
||||
isSelected: [destinationController.isSelected.value],
|
||||
),
|
||||
//),
|
||||
),
|
||||
// IconButton(onPressed: (){
|
||||
// showCurrentPosition();
|
||||
// },
|
||||
@ -122,4 +184,194 @@ class _DestinationPageState extends State<DestinationPage> {
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// class DestinationPage extends StatefulWidget {
|
||||
// DestinationPage({ Key? key }) : super(key: key);
|
||||
|
||||
// @override
|
||||
// State<DestinationPage> createState() => _DestinationPageState();
|
||||
// }
|
||||
|
||||
// class DestinationPage extends State<DestinationPage> {
|
||||
// final DestinationController destinationController = Get.find<DestinationController>();
|
||||
|
||||
// final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
// final List<int> _items = List<int>.generate(50, (int index) => index);
|
||||
|
||||
// DestinationWidget dest = DestinationWidget();
|
||||
// DestinationMapPage destMap = DestinationMapPage();
|
||||
|
||||
// Future<void> showCurrentPosition() async {
|
||||
// LocationPermission permission = await Geolocator.checkPermission();
|
||||
// if (permission != LocationPermission.whileInUse ||
|
||||
// permission != LocationPermission.always) {
|
||||
// permission = await Geolocator.requestPermission();
|
||||
// }
|
||||
// Position position = await Geolocator.getCurrentPosition(
|
||||
// desiredAccuracy: LocationAccuracy.high);
|
||||
// indexController.rogMapController?.move(LatLng(position.latitude, position.longitude), 14);
|
||||
// }
|
||||
|
||||
// Image getImage(int index){
|
||||
// if(destinationController.destinations[index].photos == null || destinationController.destinations[index].photos == ""){
|
||||
// return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
// }
|
||||
// else{
|
||||
// return Image(image: NetworkImage(destinationController.destinations[index].photos!));
|
||||
// }
|
||||
// }
|
||||
|
||||
// Widget getRoutingImage(int route){
|
||||
// switch (route) {
|
||||
// case 0:
|
||||
// return Image(image: AssetImage('assets/images/p4_9_man.png'), width: 27.0,);
|
||||
// case 1:
|
||||
// return Image(image: AssetImage('assets/images/p4_8_car.png'), width: 27.0,);
|
||||
// case 2:
|
||||
// return Image(image: AssetImage('assets/images/p4_10_train.png'), width: 27.0,);
|
||||
// default:
|
||||
// return Image(image: AssetImage('assets/images/p4_9_man.png'), width: 27.0,);
|
||||
// }
|
||||
// }
|
||||
|
||||
// @override
|
||||
// void initState() {
|
||||
// //destinationController.context = context;
|
||||
// //destinationController.PopulateDestinations();
|
||||
// super.initState();
|
||||
// }
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// final ColorScheme colorScheme = Theme.of(context).colorScheme;
|
||||
// final Color oddItemColor = colorScheme.primary.withOpacity(0.05);
|
||||
// final Color evenItemColor = colorScheme.primary.withOpacity(0.15);
|
||||
// return WillPopScope(
|
||||
// onWillPop: () async {
|
||||
// indexController.switchPage(AppPages.INITIAL);
|
||||
// return false;
|
||||
// },
|
||||
// child: Scaffold(
|
||||
// drawer: DrawerPage(),
|
||||
// bottomNavigationBar: BottomAppBar(
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: <Widget>[
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(left:13.0),
|
||||
// child: InkWell(
|
||||
// child: Obx((() => getRoutingImage(destinationController.travelMode.value))),
|
||||
// onTap: (){
|
||||
// Get.bottomSheet(
|
||||
// Obx(() =>
|
||||
// ListView(
|
||||
// children: [
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(top:30.0, bottom: 30),
|
||||
// child: Center(child: Text("select_travel_mode".tr, style: TextStyle(fontSize: 22.0, color:Colors.red, fontWeight:FontWeight.bold),),),
|
||||
// ),
|
||||
// ListTile(
|
||||
// selected: destinationController.travelMode == 0 ? true : false,
|
||||
// selectedTileColor: Colors.amber.shade200,
|
||||
// leading: Image(image: AssetImage('assets/images/p4_9_man.png'),),
|
||||
// title: Text("walking".tr),
|
||||
// onTap:(){
|
||||
// destinationController.travelMode.value = 0;
|
||||
// Get.back();
|
||||
// },
|
||||
// ),
|
||||
// ListTile(
|
||||
// selected: destinationController.travelMode == 1 ? true : false,
|
||||
// selectedTileColor: Colors.amber.shade200,
|
||||
// leading: Image(image: AssetImage('assets/images/p4_8_car.png'),),
|
||||
// title: Text("driving".tr),
|
||||
// onTap:(){
|
||||
// destinationController.travelMode.value = 1;
|
||||
// Get.back();
|
||||
// },
|
||||
// ),
|
||||
// ListTile(
|
||||
// selected: destinationController.travelMode == 2 ? true : false,
|
||||
// selectedTileColor: Colors.amber.shade200,
|
||||
// leading: Image(image: AssetImage('assets/images/p4_10_train.png'),),
|
||||
// title: Text("transit".tr),
|
||||
// onTap:(){
|
||||
// destinationController.travelMode.value = 2;
|
||||
// Get.back();
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
|
||||
// ),
|
||||
// ),
|
||||
// isScrollControlled:false,
|
||||
// backgroundColor: Colors.white,
|
||||
// );
|
||||
// destinationController.PopulateDestinations();
|
||||
// destMap.
|
||||
// }
|
||||
// ),
|
||||
// )
|
||||
// ,
|
||||
// IconButton(
|
||||
// icon: const Icon(Icons.travel_explore),
|
||||
// onPressed: (){
|
||||
// indexController.switchPage(AppPages.INITIAL);
|
||||
// }
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// floatingActionButton: FloatingActionButton(
|
||||
// onPressed: (){
|
||||
// //print("######");
|
||||
// indexController.toggleDestinationMode();
|
||||
// },
|
||||
// tooltip: 'Increment',
|
||||
// child: Obx(() =>
|
||||
// indexController.desination_mode == 1 ?
|
||||
// Image(image: AssetImage('assets/images/list2.png'))
|
||||
// :
|
||||
// Image(image: AssetImage('assets/images/map.png'))
|
||||
// ),
|
||||
// elevation: 4.0,
|
||||
// ),
|
||||
// floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
||||
// appBar:AppBar(
|
||||
// automaticallyImplyLeading: true,
|
||||
// title: Text("app_title".tr),
|
||||
// actions: [
|
||||
// //Obx(() =>
|
||||
// ToggleButtons(
|
||||
// disabledColor: Colors.grey.shade200,
|
||||
// selectedColor: Colors.red,
|
||||
// children: <Widget>[
|
||||
// Icon(Icons.explore
|
||||
// )],
|
||||
// onPressed: (int index) {
|
||||
// setState(() {
|
||||
// destinationController.isSelected[index] = !destinationController.isSelected[index];
|
||||
// });
|
||||
// },
|
||||
// isSelected: destinationController.isSelected,
|
||||
// ),
|
||||
// //),
|
||||
// // IconButton(onPressed: (){
|
||||
// // showCurrentPosition();
|
||||
// // },
|
||||
// // icon: Icon(Icons.location_on_outlined))
|
||||
// ],
|
||||
// ),
|
||||
// body: Obx(() =>
|
||||
// indexController.desination_mode.value == 0 ?
|
||||
// dest:
|
||||
// destMap
|
||||
// )
|
||||
// ),
|
||||
// );
|
||||
|
||||
// }
|
||||
// }
|
||||
@ -12,22 +12,16 @@ import 'package:get/get.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:rogapp/model/destination.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';
|
||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
import 'package:rogapp/widgets/bread_crum_widget.dart';
|
||||
|
||||
class DestinationMapPage extends StatefulWidget {
|
||||
DestinationMapPage({ Key? key }) : super(key: key);
|
||||
|
||||
class DestinationMapPage extends StatelessWidget {
|
||||
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>();
|
||||
@ -35,7 +29,7 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
||||
final PopupController _popupLayerController = PopupController();
|
||||
|
||||
List<LatLng>? getPoints(){
|
||||
//print("##### --- route point ${indexController.routePoints.length}");
|
||||
print("##### --- route point ${indexController.routePoints.length}");
|
||||
List<LatLng> pts = [];
|
||||
for(PointLatLng p in indexController.routePoints){
|
||||
LatLng l = LatLng(p.latitude, p.longitude);
|
||||
@ -63,8 +57,6 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
||||
int index = -1;
|
||||
for (int i = 0; i < destinationController.destinations.length; i++) {
|
||||
Destination d = destinationController.destinations[i];
|
||||
//for(Destination d in destinationController.destinations){
|
||||
//print("-----lat ${lat}, ----- lon ${lan}");
|
||||
Marker m = Marker(
|
||||
point: LatLng(d.lat!, d.lon!),
|
||||
anchorPos: AnchorPos.align(AnchorAlign.center),
|
||||
@ -80,8 +72,7 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
||||
indexController.currentDestinationFeature.add(d);
|
||||
//indexController.getAction();
|
||||
|
||||
showModalBottomSheet(context: context, isScrollControlled: true,
|
||||
//builder:((context) => BottomSheetWidget())
|
||||
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
|
||||
builder:((context) => BottomSheetNew())
|
||||
);
|
||||
}
|
||||
@ -111,36 +102,6 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
//return Icon(Icons.pin_drop);
|
||||
// return IconButton(
|
||||
// onPressed: ()async {
|
||||
// Destination? fs = await destinationController.getDEstinationForLatLong(d.lat!, d.lon!);
|
||||
// print("-- Destination is --- ${fs!.name} ------");
|
||||
// if(fs != null){
|
||||
// if(indexController.currentDestinationFeature.length > 0) {
|
||||
// indexController.currentDestinationFeature.clear();
|
||||
// }
|
||||
// indexController.currentDestinationFeature.add(fs);
|
||||
// //indexController.getAction();
|
||||
|
||||
// showModalBottomSheet(context: context, isScrollControlled: true,
|
||||
// //builder:((context) => BottomSheetWidget())
|
||||
// builder:((context) => BottomSheetNew())
|
||||
// );
|
||||
// }
|
||||
// },
|
||||
// icon: Container(
|
||||
// width: 60,
|
||||
// height: 60,
|
||||
// decoration: BoxDecoration(
|
||||
// borderRadius: BorderRadius.circular(d.checkin_radious ?? 0),
|
||||
// color: Colors.transparent,
|
||||
// border: BoxBorder()
|
||||
// ),
|
||||
// child: Icon(Icons.pin_drop)
|
||||
// )
|
||||
// );
|
||||
|
||||
});
|
||||
|
||||
@ -149,19 +110,6 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
||||
return pts;
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
||||
DestinationService.getDestinationLine(destinationController.destinations)?.then((value){
|
||||
//print("---- loading destination points ------ ${value}");
|
||||
indexController.routePoints.clear();
|
||||
setState(() {
|
||||
indexController.routePoints = value;
|
||||
});
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Obx((() =>
|
||||
@ -177,19 +125,6 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
||||
child:
|
||||
TravelMap(),
|
||||
),
|
||||
// Positioned(
|
||||
// bottom: 200,
|
||||
// left: 10,
|
||||
// child: Container(
|
||||
// color: Colors.white,
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Text(destinationController.gps[0]),
|
||||
// Text(destinationController.locationPermission[0])
|
||||
// ],
|
||||
// ),
|
||||
// )
|
||||
// ),
|
||||
],
|
||||
)
|
||||
));
|
||||
@ -204,14 +139,9 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
||||
indexController.is_rog_mapcontroller_loaded.value = true;
|
||||
subscription = indexController.rogMapController!.mapEventStream.listen((MapEvent mapEvent) {
|
||||
if (mapEvent is MapEventMoveStart) {
|
||||
//print(DateTime.now().toString() + ' [MapEventMoveStart] START');
|
||||
// do something
|
||||
}
|
||||
if (mapEvent is MapEventMoveEnd) {
|
||||
destinationController.isSelected.clear();
|
||||
destinationController.isSelected.add(false);
|
||||
//print(DateTime.now().toString() + ' [MapEventMoveStart] END');
|
||||
//indexController.loadLocationsBound();
|
||||
destinationController.isSelected.value = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -220,7 +150,6 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
||||
zoom: 1,
|
||||
maxZoom: 42,
|
||||
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
|
||||
//plugins: [LocationMarkerPlugin(),]
|
||||
),
|
||||
children: [
|
||||
TileLayerWidget(
|
||||
@ -229,32 +158,22 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
||||
subdomains: ['a', 'b', 'c'],
|
||||
),
|
||||
),
|
||||
//Obx(() =>
|
||||
indexController.routePoints.length > 0 ?
|
||||
Obx(() =>
|
||||
indexController.routePointLenght > 0 ?
|
||||
PolylineLayerWidget(
|
||||
options: PolylineLayerOptions(
|
||||
polylines: [
|
||||
Polyline(
|
||||
points: getPoints()!,
|
||||
strokeWidth: 6.0,
|
||||
color: Colors.indigo),
|
||||
color: Colors.indigo
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
:
|
||||
Container(),
|
||||
//),
|
||||
// PopupMarkerLayerWidget(
|
||||
// options: PopupMarkerLayerOptions(
|
||||
// popupController: _popupLayerController,
|
||||
// markers: _markers,
|
||||
// markerRotateAlignment:
|
||||
// PopupMarkerLayerOptions.rotationAlignmentFor(AnchorAlign.top),
|
||||
// popupBuilder: (BuildContext context, Marker marker) =>
|
||||
|
||||
// examplePopup(marker),
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
LocationMarkerLayerWidget(),
|
||||
MarkerLayerWidget(
|
||||
options: MarkerLayerOptions(
|
||||
@ -265,4 +184,261 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 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>();
|
||||
// StreamSubscription? subscription;
|
||||
// final PopupController _popupLayerController = PopupController();
|
||||
|
||||
// List<LatLng>? getPoints(List<PointLatLng> ptts){
|
||||
// //print("##### --- route point ${indexController.routePoints.length}");
|
||||
// List<LatLng> pts = [];
|
||||
// for(PointLatLng p in ptts){
|
||||
// LatLng l = LatLng(p.latitude, p.longitude);
|
||||
// pts.add(l);
|
||||
// }
|
||||
// return pts;
|
||||
// }
|
||||
|
||||
// String getDisplaytext(Destination dp){
|
||||
// String txt = "";
|
||||
// if(dp.cp! > 0){
|
||||
// txt = "${dp.cp}";
|
||||
// if(dp.checkin_point != null && dp.checkin_point! > 0){
|
||||
// txt = txt + "{${dp.checkin_point}}";
|
||||
// }
|
||||
// if(dp.buy_point != null && dp.buy_point! > 0){
|
||||
// txt = txt + "[${dp.buy_point}]";
|
||||
// }
|
||||
// }
|
||||
// return txt;
|
||||
// }
|
||||
|
||||
// List<Marker>? getMarkers() {
|
||||
// List<Marker> pts = [];
|
||||
// int index = -1;
|
||||
// for (int i = 0; i < destinationController.destinations.length; i++) {
|
||||
// Destination d = destinationController.destinations[i];
|
||||
// //for(Destination d in destinationController.destinations){
|
||||
// //print("-----lat ${lat}, ----- lon ${lan}");
|
||||
// Marker m = Marker(
|
||||
// point: LatLng(d.lat!, d.lon!),
|
||||
// anchorPos: AnchorPos.align(AnchorAlign.center),
|
||||
// builder:(cts){
|
||||
|
||||
// return InkWell(
|
||||
// onTap: (){
|
||||
// print("-- Destination is --- ${d.name} ------");
|
||||
// if(d != null){
|
||||
// if(indexController.currentDestinationFeature.length > 0) {
|
||||
// indexController.currentDestinationFeature.clear();
|
||||
// }
|
||||
// indexController.currentDestinationFeature.add(d);
|
||||
// //indexController.getAction();
|
||||
|
||||
// showModalBottomSheet(context: context, isScrollControlled: true,
|
||||
// //builder:((context) => BottomSheetWidget())
|
||||
// builder:((context) => BottomSheetNew())
|
||||
// );
|
||||
// }
|
||||
// },
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Container(
|
||||
// width:20,
|
||||
// height:20,
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.red,
|
||||
// shape: BoxShape.circle,
|
||||
// border: new Border.all(
|
||||
// color: Colors.white,
|
||||
// width: d.checkin_radious != null ? d.checkin_radious! : 1,
|
||||
// ),
|
||||
// ),
|
||||
// child: new Center(
|
||||
// child: new Text(
|
||||
// (i + 1).toString(),
|
||||
// style: TextStyle(color: Colors.white),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Container( color: Colors.yellow, child: Text(getDisplaytext(d), style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, overflow: TextOverflow.visible),)),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
|
||||
// //return Icon(Icons.pin_drop);
|
||||
// // return IconButton(
|
||||
// // onPressed: ()async {
|
||||
// // Destination? fs = await destinationController.getDEstinationForLatLong(d.lat!, d.lon!);
|
||||
// // print("-- Destination is --- ${fs!.name} ------");
|
||||
// // if(fs != null){
|
||||
// // if(indexController.currentDestinationFeature.length > 0) {
|
||||
// // indexController.currentDestinationFeature.clear();
|
||||
// // }
|
||||
// // indexController.currentDestinationFeature.add(fs);
|
||||
// // //indexController.getAction();
|
||||
|
||||
// // showModalBottomSheet(context: context, isScrollControlled: true,
|
||||
// // //builder:((context) => BottomSheetWidget())
|
||||
// // builder:((context) => BottomSheetNew())
|
||||
// // );
|
||||
// // }
|
||||
// // },
|
||||
// // icon: Container(
|
||||
// // width: 60,
|
||||
// // height: 60,
|
||||
// // decoration: BoxDecoration(
|
||||
// // borderRadius: BorderRadius.circular(d.checkin_radious ?? 0),
|
||||
// // color: Colors.transparent,
|
||||
// // border: BoxBorder()
|
||||
// // ),
|
||||
// // child: Icon(Icons.pin_drop)
|
||||
// // )
|
||||
// // );
|
||||
|
||||
// });
|
||||
|
||||
// pts.add(m);
|
||||
// }
|
||||
// return pts;
|
||||
// }
|
||||
|
||||
// @override
|
||||
// void initState() {
|
||||
|
||||
// //indexController.routePoints.clear();
|
||||
// DestinationService.getDestinationLine(destinationController.destinations)?.then((value){
|
||||
// //print("---- loading destination points ------ ${value}");
|
||||
// setState(() {
|
||||
// indexController.routePoints = value;
|
||||
// });
|
||||
// });
|
||||
// super.initState();
|
||||
// }
|
||||
|
||||
// void reload(){
|
||||
// setState(() {
|
||||
|
||||
// });
|
||||
// }
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Obx((() =>
|
||||
// Stack(
|
||||
// children: [
|
||||
// indexController.is_rog_mapcontroller_loaded.value == false ?
|
||||
// Center(child: CircularProgressIndicator())
|
||||
// :
|
||||
// BreadCrumbWidget(mapController:indexController.rogMapController),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(top:50.0),
|
||||
// //child: TravelMap(),
|
||||
// child:
|
||||
// TravelMap(indexController.routePoints),
|
||||
// ),
|
||||
// // Positioned(
|
||||
// // bottom: 200,
|
||||
// // left: 10,
|
||||
// // child: Container(
|
||||
// // color: Colors.white,
|
||||
// // child: Row(
|
||||
// // children: [
|
||||
// // Text(destinationController.gps[0]),
|
||||
// // Text(destinationController.locationPermission[0])
|
||||
// // ],
|
||||
// // ),
|
||||
// // )
|
||||
// // ),
|
||||
// ],
|
||||
// )
|
||||
// ));
|
||||
// }
|
||||
|
||||
// FlutterMap TravelMap(List<PointLatLng> ptts) {
|
||||
// return FlutterMap(
|
||||
// options: MapOptions(
|
||||
// onMapCreated: (c){
|
||||
// indexController.rogMapController = c;
|
||||
// indexController.rogMapController!.onReady.then((_) {
|
||||
// indexController.is_rog_mapcontroller_loaded.value = true;
|
||||
// subscription = indexController.rogMapController!.mapEventStream.listen((MapEvent mapEvent) {
|
||||
// if (mapEvent is MapEventMoveStart) {
|
||||
// //print(DateTime.now().toString() + ' [MapEventMoveStart] START');
|
||||
// // do something
|
||||
// }
|
||||
// if (mapEvent is MapEventMoveEnd) {
|
||||
// destinationController.isSelected.value = false;
|
||||
// //print(DateTime.now().toString() + ' [MapEventMoveStart] END');
|
||||
// //indexController.loadLocationsBound();
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
// } ,
|
||||
// bounds: indexController.currentBound.length > 0 ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]),
|
||||
// zoom: 1,
|
||||
// maxZoom: 42,
|
||||
// interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
|
||||
// //plugins: [LocationMarkerPlugin(),]
|
||||
// ),
|
||||
// children: [
|
||||
// TileLayerWidget(
|
||||
// options: TileLayerOptions(
|
||||
// urlTemplate: 'https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png',
|
||||
// subdomains: ['a', 'b', 'c'],
|
||||
// ),
|
||||
// ),
|
||||
// //Obx(() =>
|
||||
// indexController.routePoints.length > 0 ?
|
||||
// PolylineLayerWidget(
|
||||
// options: PolylineLayerOptions(
|
||||
// polylines: [
|
||||
// Polyline(
|
||||
// points: getPoints(ptts)!,
|
||||
// strokeWidth: 6.0,
|
||||
// color: Colors.indigo
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// )
|
||||
// :
|
||||
// Container(),
|
||||
// //),
|
||||
// // PopupMarkerLayerWidget(
|
||||
// // options: PopupMarkerLayerOptions(
|
||||
// // popupController: _popupLayerController,
|
||||
// // markers: _markers,
|
||||
// // markerRotateAlignment:
|
||||
// // PopupMarkerLayerOptions.rotationAlignmentFor(AnchorAlign.top),
|
||||
// // popupBuilder: (BuildContext context, Marker marker) =>
|
||||
|
||||
// // examplePopup(marker),
|
||||
// // ),
|
||||
// // ),
|
||||
// LocationMarkerLayerWidget(),
|
||||
// MarkerLayerWidget(
|
||||
// options: MarkerLayerOptions(
|
||||
// markers: getMarkers()!
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
|
||||
// );
|
||||
// }
|
||||
//}
|
||||
@ -1,14 +1,20 @@
|
||||
|
||||
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:rogapp/routes/app_pages.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class DrawerPage extends StatelessWidget {
|
||||
DrawerPage({ Key? key }) : super(key: key);
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
void _launchURL(url) async {
|
||||
if (!await launch(url)) throw 'Could not launch $url';
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SafeArea(
|
||||
@ -47,7 +53,7 @@ class DrawerPage extends StatelessWidget {
|
||||
leading: const Icon(Icons.login),
|
||||
title: Text("logout".tr),
|
||||
onTap: (){
|
||||
indexController.currentUser.clear();
|
||||
indexController.logout();
|
||||
Get.toNamed(AppPages.TRAVEL);
|
||||
},
|
||||
)
|
||||
@ -88,7 +94,9 @@ class DrawerPage extends StatelessWidget {
|
||||
ListTile(
|
||||
leading: const Icon(Icons.featured_video),
|
||||
title: Text("rog_web".tr),
|
||||
onTap: (){},
|
||||
onTap: (){
|
||||
_launchURL("https://www.gifuai.net/?page_id=4425");
|
||||
},
|
||||
) :
|
||||
Container(width: 0, height: 0,),
|
||||
// ListTile(
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
|
||||
import 'package:flutter_map/plugin_api.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
|
||||
class IndexBinding extends Bindings {
|
||||
|
||||
@ -11,7 +11,6 @@ import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/destination/destination_binding.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/destination/destination_page.dart';
|
||||
import 'package:rogapp/pages/destination_map/destination_map_page.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:rogapp/services/action_service.dart';
|
||||
import 'package:rogapp/services/auth_service.dart';
|
||||
@ -36,6 +35,7 @@ class IndexController extends GetxController {
|
||||
List<Map<String, dynamic>> currentUser = <Map<String, dynamic>>[].obs;
|
||||
List<dynamic> currentAction = <dynamic>[].obs;
|
||||
List<PointLatLng> routePoints = <PointLatLng>[].obs;
|
||||
var routePointLenght = 0.obs;
|
||||
|
||||
var is_loading = false.obs;
|
||||
|
||||
@ -94,7 +94,7 @@ class IndexController extends GetxController {
|
||||
case AppPages.TRAVEL : {
|
||||
rog_mode.value = 1;
|
||||
//Get.back();
|
||||
Get.off(DestinationPage(), binding: DestinationBinding());
|
||||
Get.off(DestnationPage(), binding: DestinationBinding());
|
||||
|
||||
}
|
||||
break;
|
||||
@ -199,6 +199,18 @@ void login(String email, String password, BuildContext context){
|
||||
});
|
||||
}
|
||||
|
||||
void logout() async{
|
||||
locations.clear();
|
||||
DatabaseHelper db = DatabaseHelper.instance;
|
||||
db.deleteAllDestinations().then((value){
|
||||
DestinationController destinationController = Get.find<DestinationController>();
|
||||
if(destinationController != null){
|
||||
destinationController.PopulateDestinations();
|
||||
}
|
||||
});
|
||||
currentUser.clear();
|
||||
}
|
||||
|
||||
void register(String email, String password, BuildContext context){
|
||||
AuthService.register(email, password).then((value){
|
||||
if(value.isNotEmpty){
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/drawer/drawer_page.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
@ -19,6 +20,7 @@ class IndexPage extends GetView<IndexController> {
|
||||
IndexPage({Key? key}) : super(key: key);
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
final DestinationController destinationController = Get.find<DestinationController>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -59,13 +61,31 @@ class IndexPage extends GetView<IndexController> {
|
||||
),
|
||||
bottomNavigationBar: BottomAppBar(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Expanded(child: Container(width: 0, height: 0,),),
|
||||
const Expanded(child: Text('')),
|
||||
Expanded(child: IconButton(icon: const Icon(Icons.travel_explore), onPressed: (){
|
||||
indexController.switchPage(AppPages.TRAVEL);
|
||||
}),),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0),
|
||||
child: InkWell(
|
||||
child:
|
||||
Obx(() =>
|
||||
destinationController.isSelected == true ?
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0),
|
||||
child: InkWell(
|
||||
child: Image(image: AssetImage('assets/images/route3_off.png'), width: 35, height: 35,),
|
||||
onTap: (){Get.toNamed(AppPages.DESTINATION_MAP);},
|
||||
),
|
||||
) :
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0),
|
||||
child: InkWell(
|
||||
child: Image(image: AssetImage('assets/images/route2_on.png'),width: 35, height: 35,),
|
||||
onTap: (){Get.toNamed(AppPages.DESTINATION_MAP);},
|
||||
),
|
||||
)
|
||||
)
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -78,7 +98,12 @@ class IndexPage extends GetView<IndexController> {
|
||||
|
||||
},
|
||||
tooltip: 'Increment',
|
||||
child: const Icon(Icons.document_scanner),
|
||||
child: Obx(() =>
|
||||
indexController.mode == 0 ?
|
||||
Image(image: AssetImage('assets/images/list2.png'))
|
||||
:
|
||||
Image(image: AssetImage('assets/images/map.png')),
|
||||
),
|
||||
elevation: 4.0,
|
||||
),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
||||
|
||||
@ -63,12 +63,6 @@ class LoginPage extends StatelessWidget {
|
||||
padding: EdgeInsets.only(top: 3,left: 3),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(40),
|
||||
border: Border(
|
||||
bottom: BorderSide(color: Colors.black),
|
||||
top: BorderSide(color: Colors.black),
|
||||
right: BorderSide(color: Colors.black),
|
||||
left: BorderSide(color: Colors.black)
|
||||
)
|
||||
),
|
||||
child: Obx((() =>
|
||||
indexController.is_loading == true ? MaterialButton(
|
||||
|
||||
@ -81,7 +81,7 @@ class AppPages {
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.TRAVEL,
|
||||
page: () => DestinationPage(),
|
||||
page: () => DestnationPage(),
|
||||
binding: DestinationBinding(),
|
||||
),
|
||||
GetPage(
|
||||
@ -91,7 +91,7 @@ class AppPages {
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.DESTINATION_MAP,
|
||||
page: () => DestinationPage(),
|
||||
page: () => DestnationPage(),
|
||||
//binding: DestinationBinding(),
|
||||
),
|
||||
GetPage(
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
|
||||
import 'package:get/get.dart';
|
||||
//import 'package:google_maps_webservice/directions.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
|
||||
import '../utils/const.dart';
|
||||
|
||||
@ -92,8 +94,20 @@ class DestinationService{
|
||||
wayPoints.add(pwp);
|
||||
i+=1;
|
||||
}
|
||||
|
||||
final DestinationController destinationController = Get.find<DestinationController>();
|
||||
int trav_mode = destinationController.travelMode.value;
|
||||
TravelMode _mode = TravelMode.walking;
|
||||
if(trav_mode == 1){
|
||||
_mode = TravelMode.driving;
|
||||
}
|
||||
else if(trav_mode == 2) {
|
||||
_mode = TravelMode.transit;
|
||||
}
|
||||
|
||||
|
||||
//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);
|
||||
PolylineResult result = await polylinePoints.getRouteBetweenCoordinates("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE", origin,dest, travelMode: _mode, wayPoints: wayPoints);
|
||||
//print("#####@@@@@ ${result.points}");
|
||||
return result.points;
|
||||
}
|
||||
|
||||
@ -1,13 +1,17 @@
|
||||
|
||||
import 'dart:convert';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
|
||||
|
||||
class MatrixService{
|
||||
|
||||
static Future<Map<String, dynamic>> getDestinations(List<Destination> destinations) async {
|
||||
|
||||
final DestinationController destinationController = Get.find<DestinationController>();
|
||||
|
||||
String locs = "";
|
||||
String origin = "";
|
||||
int i = 0;
|
||||
@ -24,10 +28,21 @@ class MatrixService{
|
||||
i++;
|
||||
}
|
||||
|
||||
//print(locs);
|
||||
String _mode = "walking";
|
||||
switch (destinationController.travelMode.value) {
|
||||
case 1:
|
||||
_mode = "driving";
|
||||
break;
|
||||
case 2:
|
||||
_mode = "transit";
|
||||
break;
|
||||
default:
|
||||
_mode = "walking";
|
||||
break;
|
||||
}
|
||||
|
||||
Map<String, dynamic> cats = {};
|
||||
String url = "https://maps.googleapis.com/maps/api/distancematrix/json?destinations=${locs}&origins=${origin}&key=AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE";
|
||||
String url = "https://maps.googleapis.com/maps/api/distancematrix/json?destinations=${locs}&mode=${_mode}&origins=${origin}&key=AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE";
|
||||
print(url);
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse(url),
|
||||
|
||||
@ -4,9 +4,10 @@
|
||||
class ConstValues{
|
||||
static const server_uri = "http://container.intranet.sumasen.net:8100";
|
||||
static const dev_server = "http://localhost:8100";
|
||||
static const dev_ip_server = "http://192.168.8.103:8100";
|
||||
static const dev_ip_server = "http://192.168.8.100:8100";
|
||||
static const dev_home_ip_server = "http://192.168.1.10:8100";
|
||||
|
||||
static String currentServer(){
|
||||
return dev_ip_server;
|
||||
return server_uri;
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,17 +66,22 @@ class DatabaseHelper{
|
||||
return destList;
|
||||
}
|
||||
|
||||
Future<int> deleteDestination(int location_id) async {
|
||||
Future<int> deleteDestination(int location_id) async {
|
||||
Database db = await instance.database;
|
||||
var dest = await db.delete('destination', where: "location_id = ${location_id}");
|
||||
int ret = dest > 0 ? dest : -1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
Future<void> deleteAllDestinations() async {
|
||||
Database db = await instance.database;
|
||||
await db.delete('destination');
|
||||
}
|
||||
|
||||
Future<bool>isAlreadyAvailable(int location_id) async{
|
||||
Database db = await instance.database;
|
||||
var dest = await db.delete('destination', where: "location_id = ${location_id}");
|
||||
return dest > 0 ? true : false;
|
||||
var dest = await db.query('destination', where: "location_id = ${location_id}");
|
||||
return dest.length > 0 ? true : false;
|
||||
}
|
||||
|
||||
Future<int> insertDestination(Destination dest) async {
|
||||
@ -108,6 +113,42 @@ class DatabaseHelper{
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> updateOrder(Destination d, int dir)async {
|
||||
Database db = await instance.database;
|
||||
var target = await db.query('destination', where: "list_order = ${d.list_order! + dir}");
|
||||
var dest = await db.query('destination', where: "location_id = ${d.location_id}");
|
||||
if(target.isNotEmpty){
|
||||
|
||||
List<Destination> target_indb = target.isNotEmpty
|
||||
? target.map((e) => Destination.fromMap(e)).toList() : [];
|
||||
|
||||
List<Destination> dest_indb = dest.isNotEmpty
|
||||
? dest.map((e) => Destination.fromMap(e)).toList() : [];
|
||||
|
||||
Map<String, dynamic> row_target = {
|
||||
"list_order": d.list_order
|
||||
};
|
||||
|
||||
Map<String, dynamic> row_des = {
|
||||
"list_order": dest_indb[0].list_order
|
||||
};
|
||||
|
||||
await db.update(
|
||||
"destination",
|
||||
row_target,
|
||||
where: 'location_id = ?',
|
||||
whereArgs: [target_indb[0]!.location_id]
|
||||
);
|
||||
|
||||
await db.update(
|
||||
"destination",
|
||||
row_des,
|
||||
where: 'location_id = ?',
|
||||
whereArgs: [dest_indb[0]!.location_id]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Future<int?> getPending() async{
|
||||
// Database db = await instance.database;
|
||||
// return await Sqflite.firstIntValue(await db.rawQuery("SELECT COUNT(*) FROM incidents"));
|
||||
|
||||
@ -31,7 +31,11 @@ class StringValues extends Translations{
|
||||
'no_values': 'No Values',
|
||||
'email_and_password_required': 'Email and password required',
|
||||
'rogaining_user_need_tosign_up': "Rogaining participants do need to sign up.",
|
||||
'add_location': 'Add Location'
|
||||
'add_location': 'Add Location',
|
||||
'select_travel_mode':'Select your travel mode',
|
||||
'walking':'Walking',
|
||||
'driving': 'Driving',
|
||||
'transit': 'Transit'
|
||||
},
|
||||
'ja_JP': {
|
||||
'drawer_title':'ロゲイニング参加者はログイン するとチェックポイントが参照 できます',
|
||||
@ -63,7 +67,11 @@ class StringValues extends Translations{
|
||||
'no_values': '値なし',
|
||||
'email_and_password_required': 'メールとパスワードが必要です',
|
||||
'rogaining_user_need_tosign_up': "ロゲイニング参加者はサインアップの必要はありません。",
|
||||
'add_location': '目的地選択'
|
||||
'add_location': '目的地選択',
|
||||
'select_travel_mode':'移動モードを選択してください',
|
||||
'walking':'ウォーキング',
|
||||
'driving': '運転中',
|
||||
'transit': 'トランジット'
|
||||
},
|
||||
};
|
||||
}
|
||||
@ -6,6 +6,7 @@ import 'package:get/get.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/utils/database_helper.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
import 'package:timeline_tile/timeline_tile.dart';
|
||||
@ -59,6 +60,11 @@ class DestinationWidget extends StatelessWidget {
|
||||
}
|
||||
|
||||
void moveUp() {
|
||||
for(Destination d in destinationController.destinations){
|
||||
// if(d.selected){
|
||||
|
||||
// }
|
||||
}
|
||||
destinationController.destination_index_data.forEach((element) {
|
||||
//print(element["index"]);
|
||||
//int action_id = destinationController.destinations[element["index"]]["id"] as int;
|
||||
@ -84,6 +90,11 @@ class DestinationWidget extends StatelessWidget {
|
||||
// });
|
||||
}
|
||||
|
||||
Future getIsLocationAvilable(int location_id) async {
|
||||
DatabaseHelper db = DatabaseHelper.instance;
|
||||
return await db.isAlreadyAvailable(location_id);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@ -97,7 +108,6 @@ class DestinationWidget extends StatelessWidget {
|
||||
padding: const EdgeInsets.only(top:45.0),
|
||||
child: ListView.builder(
|
||||
itemCount: destinationController.destinationCount.value,
|
||||
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return
|
||||
TimelineTile(
|
||||
@ -105,7 +115,10 @@ class DestinationWidget extends StatelessWidget {
|
||||
lineXY: 0.2,
|
||||
isFirst: index == 0 ? true : false,
|
||||
indicatorStyle: IndicatorStyle(
|
||||
color: index == 0 ? (Colors.red) : (Colors.grey[400])!
|
||||
indicator: CircleAvatar(
|
||||
child: Text(destinationController.destinations[index].list_order.toString(), style: TextStyle(color: Colors.white),),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
),
|
||||
key: Key(index.toString()),
|
||||
endChild: Card(
|
||||
@ -165,8 +178,8 @@ class DestinationWidget extends StatelessWidget {
|
||||
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())
|
||||
Text(destinationController.matrix["rows"][0]["elements"][index]["distance"] != null ? destinationController.matrix["rows"][0]["elements"][index]["distance"]["text"].toString(): ''),
|
||||
Text(destinationController.matrix["rows"][0]["elements"][index]["distance"] != null ? destinationController.matrix["rows"][0]["elements"][index]["duration"]["text"].toString() : '')
|
||||
],
|
||||
):
|
||||
Container()
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
@ -9,6 +11,7 @@ class ListWidget extends StatelessWidget {
|
||||
ListWidget({ Key? key }) : super(key: key);
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
final DestinationController destinationController = Get.find<DestinationController>();
|
||||
|
||||
Image getImage(int index){
|
||||
if(indexController.locations[0].collection[index].properties!["photos"] == null || indexController.locations[0].collection[index].properties!["photos"] == ""){
|
||||
@ -39,8 +42,18 @@ class ListWidget extends StatelessWidget {
|
||||
itemCount: indexController.locations[0].collection.length,
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (_, index){
|
||||
bool _is_found = false;
|
||||
for(Destination d in destinationController.destinations){
|
||||
if(indexController.locations[0].collection[index].properties!['location_id'] == d.location_id){
|
||||
_is_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Card(
|
||||
child: ListTile(
|
||||
selected: _is_found,
|
||||
|
||||
selectedTileColor: Colors.yellow.shade200,
|
||||
onTap: (){
|
||||
GeoJsonFeature gf = indexController.locations[0].collection[index];
|
||||
changeCurrentFeature(gf);
|
||||
@ -54,6 +67,7 @@ class ListWidget extends StatelessWidget {
|
||||
leading: getImage(index),
|
||||
title: indexController.locations[0].collection[index].properties!['location_name'] != null ? Text(indexController.locations[0].collection[index].properties!['location_name'].toString()) : Text(""),
|
||||
subtitle: indexController.locations[0].collection[index].properties!['category'] != null ? Text(indexController.locations[0].collection[index].properties!['category']) : Text(""),
|
||||
trailing: Text(indexController.locations[0].collection[index].properties!['sub_loc_id'] ),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user