update for routing
BIN
assets/images/list2.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
assets/images/list2_off.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
assets/images/map.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
assets/images/map2.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
assets/images/map3.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
assets/images/map_off.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
assets/images/p4_10_train.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
assets/images/p4_13_position__down.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
assets/images/p4_13_position_map2.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
assets/images/p4_6_map_destination_icon.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
assets/images/p4_8_car.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
assets/images/p4_9_man.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
assets/images/route2_off.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
assets/images/route2_on.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
assets/images/route3_off.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
assets/images/route3_on.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
assets/images/viaicon.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
@ -9,7 +9,7 @@ PODS:
|
|||||||
- FMDB/standard (2.7.5)
|
- FMDB/standard (2.7.5)
|
||||||
- geolocator_apple (1.2.0):
|
- geolocator_apple (1.2.0):
|
||||||
- Flutter
|
- Flutter
|
||||||
- google_maps_flutter (0.0.1):
|
- google_maps_flutter_ios (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- GoogleMaps
|
- GoogleMaps
|
||||||
- GoogleMaps (4.1.0):
|
- GoogleMaps (4.1.0):
|
||||||
@ -34,7 +34,7 @@ DEPENDENCIES:
|
|||||||
- flutter_compass (from `.symlinks/plugins/flutter_compass/ios`)
|
- flutter_compass (from `.symlinks/plugins/flutter_compass/ios`)
|
||||||
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
|
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/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_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`)
|
||||||
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/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_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
|
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
|
||||||
@ -55,8 +55,8 @@ EXTERNAL SOURCES:
|
|||||||
:path: ".symlinks/plugins/flutter_keyboard_visibility/ios"
|
:path: ".symlinks/plugins/flutter_keyboard_visibility/ios"
|
||||||
geolocator_apple:
|
geolocator_apple:
|
||||||
:path: ".symlinks/plugins/geolocator_apple/ios"
|
:path: ".symlinks/plugins/geolocator_apple/ios"
|
||||||
google_maps_flutter:
|
google_maps_flutter_ios:
|
||||||
:path: ".symlinks/plugins/google_maps_flutter/ios"
|
:path: ".symlinks/plugins/google_maps_flutter_ios/ios"
|
||||||
image_picker_ios:
|
image_picker_ios:
|
||||||
:path: ".symlinks/plugins/image_picker_ios/ios"
|
:path: ".symlinks/plugins/image_picker_ios/ios"
|
||||||
path_provider_ios:
|
path_provider_ios:
|
||||||
@ -74,7 +74,7 @@ SPEC CHECKSUMS:
|
|||||||
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
|
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
|
||||||
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
||||||
geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401
|
geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401
|
||||||
google_maps_flutter: c59fc576c0d0c7f4dc4bd63832c862d22d5a7c6d
|
google_maps_flutter_ios: 66201f392bf62d500f07670a30488a247b9bb5b9
|
||||||
GoogleMaps: 008e2c80e38605b56b560e8deb73d4194ff30bef
|
GoogleMaps: 008e2c80e38605b56b560e8deb73d4194ff30bef
|
||||||
image_picker_ios: b786a5dcf033a8336a657191401bfdf12017dabb
|
image_picker_ios: b786a5dcf033a8336a657191401bfdf12017dabb
|
||||||
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
|
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
|
||||||
|
|||||||
@ -30,34 +30,33 @@ class DestinationController extends GetxController {
|
|||||||
List<Destination> currentSelectedDestinations = <Destination>[].obs;
|
List<Destination> currentSelectedDestinations = <Destination>[].obs;
|
||||||
|
|
||||||
bool checking_in = false;
|
bool checking_in = false;
|
||||||
List<bool> isSelected = [true].obs;
|
var isSelected = false.obs;
|
||||||
BuildContext? context;
|
BuildContext? context;
|
||||||
|
|
||||||
List<String> gps = <String>["-- stating --"].obs;
|
List<String> gps = <String>["-- stating --"].obs;
|
||||||
List<String> locationPermission = <String>[" -- starting -- "].obs;
|
List<String> locationPermission = <String>[" -- starting -- "].obs;
|
||||||
|
|
||||||
|
var travelMode = 0.obs;
|
||||||
|
|
||||||
|
|
||||||
Map<String, dynamic> matrix = {};
|
Map<String, dynamic> matrix = {};
|
||||||
|
|
||||||
final IndexController indexController = Get.find<IndexController>();
|
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 {
|
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"}}';
|
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){
|
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){
|
if(lat == d.lat && long == d.lon){
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
@ -145,11 +144,9 @@ class DestinationController extends GetxController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() async {
|
void onInit() async {
|
||||||
super.onInit();
|
|
||||||
checkPermission();
|
checkPermission();
|
||||||
PopulateDestinations();
|
PopulateDestinations();
|
||||||
|
|
||||||
|
|
||||||
//print("------ in iniit");
|
//print("------ in iniit");
|
||||||
|
|
||||||
|
|
||||||
@ -190,7 +187,7 @@ class DestinationController extends GetxController {
|
|||||||
StreamSubscription<Position> positionStream = Geolocator.getPositionStream(locationSettings: locationSettings).listen(
|
StreamSubscription<Position> positionStream = Geolocator.getPositionStream(locationSettings: locationSettings).listen(
|
||||||
|
|
||||||
(Position? position) {
|
(Position? position) {
|
||||||
if(isSelected[0]){
|
if(isSelected.value){
|
||||||
double czoom = indexController.rogMapController!.zoom;
|
double czoom = indexController.rogMapController!.zoom;
|
||||||
indexController.rogMapController!.move(LatLng(position!.latitude, position!.longitude), czoom);
|
indexController.rogMapController!.move(LatLng(position!.latitude, position!.longitude), czoom);
|
||||||
//String user_id = indexController.currentUser[0]["user"]["id"].toString();
|
//String user_id = indexController.currentUser[0]["user"]["id"].toString();
|
||||||
@ -209,6 +206,7 @@ class DestinationController extends GetxController {
|
|||||||
locationPermission.add(err.toString());
|
locationPermission.add(err.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
super.onInit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,10 +264,10 @@ class DestinationController extends GetxController {
|
|||||||
void PopulateDestinations(){
|
void PopulateDestinations(){
|
||||||
print("--------- destination controller populsting destinations ----------- ::::::");
|
print("--------- destination controller populsting destinations ----------- ::::::");
|
||||||
|
|
||||||
destinations.clear();
|
|
||||||
destinationCount.value = 0;
|
|
||||||
DatabaseHelper db = DatabaseHelper.instance;
|
DatabaseHelper db = DatabaseHelper.instance;
|
||||||
db.getDestinations().then((value){
|
db.getDestinations().then((value){
|
||||||
|
destinations.clear();
|
||||||
|
destinationCount.value = 0;
|
||||||
for(Destination d in value){
|
for(Destination d in value){
|
||||||
for(Destination s in currentSelectedDestinations){
|
for(Destination s in currentSelectedDestinations){
|
||||||
if(d.location_id == s.location_id){
|
if(d.location_id == s.location_id){
|
||||||
@ -280,26 +278,23 @@ class DestinationController extends GetxController {
|
|||||||
destinations.add(d);
|
destinations.add(d);
|
||||||
}
|
}
|
||||||
// destinationCount.value = 0;
|
// destinationCount.value = 0;
|
||||||
destinationCount.value = destinations.length;
|
|
||||||
print("------ destination controller destinationcount-------- ${destinationCount}-------- :::::");
|
print("------ destination controller destinationcount-------- ${destinationCount}-------- :::::");
|
||||||
|
|
||||||
|
|
||||||
MatrixService.getDestinations(value).then((mat){
|
MatrixService.getDestinations(value).then((mat){
|
||||||
print(mat);
|
print(" matrix is ------- ${mat}");
|
||||||
matrix = mat;
|
matrix = mat;
|
||||||
|
|
||||||
|
getRoutePoints();
|
||||||
|
destinationCount.value = destinations.length;
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void makeOrder(int action_id, int order, String dir){
|
void makeOrder(String locationId){
|
||||||
DestinationService.updateOrder(action_id, order, dir).then((value){
|
|
||||||
//print("----action value----${value}");
|
|
||||||
PopulateDestinations();
|
|
||||||
destination_index_data.clear();
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,15 +12,9 @@ import 'package:rogapp/routes/app_pages.dart';
|
|||||||
import 'package:rogapp/widgets/destination_widget.dart';
|
import 'package:rogapp/widgets/destination_widget.dart';
|
||||||
import 'package:timeline_tile/timeline_tile.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 DestinationController destinationController = Get.find<DestinationController>();
|
||||||
|
|
||||||
final IndexController indexController = Get.find<IndexController>();
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
@ -47,14 +41,20 @@ class _DestinationPageState extends State<DestinationPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
Widget getRoutingImage(int route){
|
||||||
void initState() {
|
switch (route) {
|
||||||
//destinationController.context = context;
|
case 0:
|
||||||
//destinationController.PopulateDestinations();
|
return Image(image: AssetImage('assets/images/p4_9_man.png'), width: 35.0,);
|
||||||
super.initState();
|
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) {
|
Widget build(BuildContext context) {
|
||||||
final ColorScheme colorScheme = Theme.of(context).colorScheme;
|
final ColorScheme colorScheme = Theme.of(context).colorScheme;
|
||||||
final Color oddItemColor = colorScheme.primary.withOpacity(0.05);
|
final Color oddItemColor = colorScheme.primary.withOpacity(0.05);
|
||||||
@ -68,13 +68,72 @@ class _DestinationPageState extends State<DestinationPage> {
|
|||||||
drawer: DrawerPage(),
|
drawer: DrawerPage(),
|
||||||
bottomNavigationBar: BottomAppBar(
|
bottomNavigationBar: BottomAppBar(
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(child: Container(width: 0, height: 0,),),
|
Padding(
|
||||||
const Expanded(child: Text('')),
|
padding: const EdgeInsets.only(left:13.0),
|
||||||
Expanded(child: IconButton(icon: const Icon(Icons.travel_explore), onPressed: (){
|
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);
|
indexController.switchPage(AppPages.INITIAL);
|
||||||
}),),
|
}
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -84,7 +143,12 @@ class _DestinationPageState extends State<DestinationPage> {
|
|||||||
indexController.toggleDestinationMode();
|
indexController.toggleDestinationMode();
|
||||||
},
|
},
|
||||||
tooltip: 'Increment',
|
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,
|
elevation: 4.0,
|
||||||
),
|
),
|
||||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
||||||
@ -92,21 +156,19 @@ class _DestinationPageState extends State<DestinationPage> {
|
|||||||
automaticallyImplyLeading: true,
|
automaticallyImplyLeading: true,
|
||||||
title: Text("app_title".tr),
|
title: Text("app_title".tr),
|
||||||
actions: [
|
actions: [
|
||||||
//Obx(() =>
|
Obx(() =>
|
||||||
ToggleButtons(
|
ToggleButtons(
|
||||||
disabledColor: Colors.grey.shade200,
|
disabledColor: Colors.grey.shade200,
|
||||||
selectedColor: Colors.red,
|
selectedColor: Colors.red,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Icon(Icons.explore
|
Icon(Icons.explore, size: 35.0,
|
||||||
)],
|
)],
|
||||||
onPressed: (int index) {
|
onPressed: (int index) {
|
||||||
setState(() {
|
destinationController.isSelected.value = !destinationController.isSelected.value;
|
||||||
destinationController.isSelected[index] = !destinationController.isSelected[index];
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
isSelected: destinationController.isSelected,
|
isSelected: [destinationController.isSelected.value],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
//),
|
|
||||||
// IconButton(onPressed: (){
|
// IconButton(onPressed: (){
|
||||||
// showCurrentPosition();
|
// showCurrentPosition();
|
||||||
// },
|
// },
|
||||||
@ -123,3 +185,193 @@ 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:latlong2/latlong.dart';
|
||||||
import 'package:rogapp/model/destination.dart';
|
import 'package:rogapp/model/destination.dart';
|
||||||
import 'package:rogapp/pages/destination/destination_controller.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/pages/index/index_controller.dart';
|
||||||
import 'package:rogapp/services/destination_service.dart';
|
import 'package:rogapp/services/destination_service.dart';
|
||||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||||
import 'package:rogapp/widgets/bread_crum_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 IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
final DestinationController destinationController = Get.find<DestinationController>();
|
final DestinationController destinationController = Get.find<DestinationController>();
|
||||||
@ -35,7 +29,7 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
|||||||
final PopupController _popupLayerController = PopupController();
|
final PopupController _popupLayerController = PopupController();
|
||||||
|
|
||||||
List<LatLng>? getPoints(){
|
List<LatLng>? getPoints(){
|
||||||
//print("##### --- route point ${indexController.routePoints.length}");
|
print("##### --- route point ${indexController.routePoints.length}");
|
||||||
List<LatLng> pts = [];
|
List<LatLng> pts = [];
|
||||||
for(PointLatLng p in indexController.routePoints){
|
for(PointLatLng p in indexController.routePoints){
|
||||||
LatLng l = LatLng(p.latitude, p.longitude);
|
LatLng l = LatLng(p.latitude, p.longitude);
|
||||||
@ -63,8 +57,6 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
|||||||
int index = -1;
|
int index = -1;
|
||||||
for (int i = 0; i < destinationController.destinations.length; i++) {
|
for (int i = 0; i < destinationController.destinations.length; i++) {
|
||||||
Destination d = destinationController.destinations[i];
|
Destination d = destinationController.destinations[i];
|
||||||
//for(Destination d in destinationController.destinations){
|
|
||||||
//print("-----lat ${lat}, ----- lon ${lan}");
|
|
||||||
Marker m = Marker(
|
Marker m = Marker(
|
||||||
point: LatLng(d.lat!, d.lon!),
|
point: LatLng(d.lat!, d.lon!),
|
||||||
anchorPos: AnchorPos.align(AnchorAlign.center),
|
anchorPos: AnchorPos.align(AnchorAlign.center),
|
||||||
@ -80,8 +72,7 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
|||||||
indexController.currentDestinationFeature.add(d);
|
indexController.currentDestinationFeature.add(d);
|
||||||
//indexController.getAction();
|
//indexController.getAction();
|
||||||
|
|
||||||
showModalBottomSheet(context: context, isScrollControlled: true,
|
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
|
||||||
//builder:((context) => BottomSheetWidget())
|
|
||||||
builder:((context) => BottomSheetNew())
|
builder:((context) => BottomSheetNew())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -112,36 +103,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)
|
|
||||||
// )
|
|
||||||
// );
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
pts.add(m);
|
pts.add(m);
|
||||||
@ -149,19 +110,6 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
|||||||
return pts;
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Obx((() =>
|
return Obx((() =>
|
||||||
@ -177,19 +125,6 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
|||||||
child:
|
child:
|
||||||
TravelMap(),
|
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;
|
indexController.is_rog_mapcontroller_loaded.value = true;
|
||||||
subscription = indexController.rogMapController!.mapEventStream.listen((MapEvent mapEvent) {
|
subscription = indexController.rogMapController!.mapEventStream.listen((MapEvent mapEvent) {
|
||||||
if (mapEvent is MapEventMoveStart) {
|
if (mapEvent is MapEventMoveStart) {
|
||||||
//print(DateTime.now().toString() + ' [MapEventMoveStart] START');
|
|
||||||
// do something
|
|
||||||
}
|
}
|
||||||
if (mapEvent is MapEventMoveEnd) {
|
if (mapEvent is MapEventMoveEnd) {
|
||||||
destinationController.isSelected.clear();
|
destinationController.isSelected.value = false;
|
||||||
destinationController.isSelected.add(false);
|
|
||||||
//print(DateTime.now().toString() + ' [MapEventMoveStart] END');
|
|
||||||
//indexController.loadLocationsBound();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -220,7 +150,6 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
|||||||
zoom: 1,
|
zoom: 1,
|
||||||
maxZoom: 42,
|
maxZoom: 42,
|
||||||
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
|
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
|
||||||
//plugins: [LocationMarkerPlugin(),]
|
|
||||||
),
|
),
|
||||||
children: [
|
children: [
|
||||||
TileLayerWidget(
|
TileLayerWidget(
|
||||||
@ -229,32 +158,22 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
|||||||
subdomains: ['a', 'b', 'c'],
|
subdomains: ['a', 'b', 'c'],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
//Obx(() =>
|
Obx(() =>
|
||||||
indexController.routePoints.length > 0 ?
|
indexController.routePointLenght > 0 ?
|
||||||
PolylineLayerWidget(
|
PolylineLayerWidget(
|
||||||
options: PolylineLayerOptions(
|
options: PolylineLayerOptions(
|
||||||
polylines: [
|
polylines: [
|
||||||
Polyline(
|
Polyline(
|
||||||
points: getPoints()!,
|
points: getPoints()!,
|
||||||
strokeWidth: 6.0,
|
strokeWidth: 6.0,
|
||||||
color: Colors.indigo),
|
color: Colors.indigo
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Container(),
|
Container(),
|
||||||
//),
|
),
|
||||||
// PopupMarkerLayerWidget(
|
|
||||||
// options: PopupMarkerLayerOptions(
|
|
||||||
// popupController: _popupLayerController,
|
|
||||||
// markers: _markers,
|
|
||||||
// markerRotateAlignment:
|
|
||||||
// PopupMarkerLayerOptions.rotationAlignmentFor(AnchorAlign.top),
|
|
||||||
// popupBuilder: (BuildContext context, Marker marker) =>
|
|
||||||
|
|
||||||
// examplePopup(marker),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
LocationMarkerLayerWidget(),
|
LocationMarkerLayerWidget(),
|
||||||
MarkerLayerWidget(
|
MarkerLayerWidget(
|
||||||
options: MarkerLayerOptions(
|
options: MarkerLayerOptions(
|
||||||
@ -266,3 +185,260 @@ 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: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/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:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
class DrawerPage extends StatelessWidget {
|
class DrawerPage extends StatelessWidget {
|
||||||
DrawerPage({ Key? key }) : super(key: key);
|
DrawerPage({ Key? key }) : super(key: key);
|
||||||
|
|
||||||
final IndexController indexController = Get.find<IndexController>();
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
|
void _launchURL(url) async {
|
||||||
|
if (!await launch(url)) throw 'Could not launch $url';
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
@ -47,7 +53,7 @@ class DrawerPage extends StatelessWidget {
|
|||||||
leading: const Icon(Icons.login),
|
leading: const Icon(Icons.login),
|
||||||
title: Text("logout".tr),
|
title: Text("logout".tr),
|
||||||
onTap: (){
|
onTap: (){
|
||||||
indexController.currentUser.clear();
|
indexController.logout();
|
||||||
Get.toNamed(AppPages.TRAVEL);
|
Get.toNamed(AppPages.TRAVEL);
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -88,7 +94,9 @@ class DrawerPage extends StatelessWidget {
|
|||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.featured_video),
|
leading: const Icon(Icons.featured_video),
|
||||||
title: Text("rog_web".tr),
|
title: Text("rog_web".tr),
|
||||||
onTap: (){},
|
onTap: (){
|
||||||
|
_launchURL("https://www.gifuai.net/?page_id=4425");
|
||||||
|
},
|
||||||
) :
|
) :
|
||||||
Container(width: 0, height: 0,),
|
Container(width: 0, height: 0,),
|
||||||
// ListTile(
|
// ListTile(
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
import 'package:flutter_map/plugin_api.dart';
|
import 'package:flutter_map/plugin_api.dart';
|
||||||
import 'package:get/get.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/pages/index/index_controller.dart';
|
||||||
|
|
||||||
class IndexBinding extends Bindings {
|
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_binding.dart';
|
||||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||||
import 'package:rogapp/pages/destination/destination_page.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/routes/app_pages.dart';
|
||||||
import 'package:rogapp/services/action_service.dart';
|
import 'package:rogapp/services/action_service.dart';
|
||||||
import 'package:rogapp/services/auth_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<Map<String, dynamic>> currentUser = <Map<String, dynamic>>[].obs;
|
||||||
List<dynamic> currentAction = <dynamic>[].obs;
|
List<dynamic> currentAction = <dynamic>[].obs;
|
||||||
List<PointLatLng> routePoints = <PointLatLng>[].obs;
|
List<PointLatLng> routePoints = <PointLatLng>[].obs;
|
||||||
|
var routePointLenght = 0.obs;
|
||||||
|
|
||||||
var is_loading = false.obs;
|
var is_loading = false.obs;
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ class IndexController extends GetxController {
|
|||||||
case AppPages.TRAVEL : {
|
case AppPages.TRAVEL : {
|
||||||
rog_mode.value = 1;
|
rog_mode.value = 1;
|
||||||
//Get.back();
|
//Get.back();
|
||||||
Get.off(DestinationPage(), binding: DestinationBinding());
|
Get.off(DestnationPage(), binding: DestinationBinding());
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
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){
|
void register(String email, String password, BuildContext context){
|
||||||
AuthService.register(email, password).then((value){
|
AuthService.register(email, password).then((value){
|
||||||
if(value.isNotEmpty){
|
if(value.isNotEmpty){
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import 'dart:ui';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:rogapp/model/destination.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/drawer/drawer_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';
|
||||||
@ -19,6 +20,7 @@ class IndexPage extends GetView<IndexController> {
|
|||||||
IndexPage({Key? key}) : super(key: key);
|
IndexPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
final IndexController indexController = Get.find<IndexController>();
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
|
final DestinationController destinationController = Get.find<DestinationController>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -59,13 +61,31 @@ class IndexPage extends GetView<IndexController> {
|
|||||||
),
|
),
|
||||||
bottomNavigationBar: BottomAppBar(
|
bottomNavigationBar: BottomAppBar(
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(child: Container(width: 0, height: 0,),),
|
Padding(
|
||||||
const Expanded(child: Text('')),
|
padding: const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0),
|
||||||
Expanded(child: IconButton(icon: const Icon(Icons.travel_explore), onPressed: (){
|
child: InkWell(
|
||||||
indexController.switchPage(AppPages.TRAVEL);
|
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',
|
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,
|
elevation: 4.0,
|
||||||
),
|
),
|
||||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
||||||
|
|||||||
@ -63,12 +63,6 @@ class LoginPage extends StatelessWidget {
|
|||||||
padding: EdgeInsets.only(top: 3,left: 3),
|
padding: EdgeInsets.only(top: 3,left: 3),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(40),
|
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((() =>
|
child: Obx((() =>
|
||||||
indexController.is_loading == true ? MaterialButton(
|
indexController.is_loading == true ? MaterialButton(
|
||||||
|
|||||||
@ -81,7 +81,7 @@ class AppPages {
|
|||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routes.TRAVEL,
|
name: Routes.TRAVEL,
|
||||||
page: () => DestinationPage(),
|
page: () => DestnationPage(),
|
||||||
binding: DestinationBinding(),
|
binding: DestinationBinding(),
|
||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
@ -91,7 +91,7 @@ class AppPages {
|
|||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routes.DESTINATION_MAP,
|
name: Routes.DESTINATION_MAP,
|
||||||
page: () => DestinationPage(),
|
page: () => DestnationPage(),
|
||||||
//binding: DestinationBinding(),
|
//binding: DestinationBinding(),
|
||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
|
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
//import 'package:google_maps_webservice/directions.dart';
|
//import 'package:google_maps_webservice/directions.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:rogapp/model/destination.dart';
|
import 'package:rogapp/model/destination.dart';
|
||||||
|
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||||
|
|
||||||
import '../utils/const.dart';
|
import '../utils/const.dart';
|
||||||
|
|
||||||
@ -92,8 +94,20 @@ class DestinationService{
|
|||||||
wayPoints.add(pwp);
|
wayPoints.add(pwp);
|
||||||
i+=1;
|
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", 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}");
|
//print("#####@@@@@ ${result.points}");
|
||||||
return result.points;
|
return result.points;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,17 @@
|
|||||||
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'package:get/get.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:rogapp/model/destination.dart';
|
import 'package:rogapp/model/destination.dart';
|
||||||
|
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||||
|
|
||||||
|
|
||||||
class MatrixService{
|
class MatrixService{
|
||||||
|
|
||||||
static Future<Map<String, dynamic>> getDestinations(List<Destination> destinations) async {
|
static Future<Map<String, dynamic>> getDestinations(List<Destination> destinations) async {
|
||||||
|
|
||||||
|
final DestinationController destinationController = Get.find<DestinationController>();
|
||||||
|
|
||||||
String locs = "";
|
String locs = "";
|
||||||
String origin = "";
|
String origin = "";
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -24,10 +28,21 @@ class MatrixService{
|
|||||||
i++;
|
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 = {};
|
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);
|
print(url);
|
||||||
final http.Response response = await http.get(
|
final http.Response response = await http.get(
|
||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
|
|||||||
@ -4,9 +4,10 @@
|
|||||||
class ConstValues{
|
class ConstValues{
|
||||||
static const server_uri = "http://container.intranet.sumasen.net:8100";
|
static const server_uri = "http://container.intranet.sumasen.net:8100";
|
||||||
static const dev_server = "http://localhost: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(){
|
static String currentServer(){
|
||||||
return dev_ip_server;
|
return server_uri;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,10 +73,15 @@ class DatabaseHelper{
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> deleteAllDestinations() async {
|
||||||
|
Database db = await instance.database;
|
||||||
|
await db.delete('destination');
|
||||||
|
}
|
||||||
|
|
||||||
Future<bool>isAlreadyAvailable(int location_id) async{
|
Future<bool>isAlreadyAvailable(int location_id) async{
|
||||||
Database db = await instance.database;
|
Database db = await instance.database;
|
||||||
var dest = await db.delete('destination', where: "location_id = ${location_id}");
|
var dest = await db.query('destination', where: "location_id = ${location_id}");
|
||||||
return dest > 0 ? true : false;
|
return dest.length > 0 ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> insertDestination(Destination dest) async {
|
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{
|
// Future<int?> getPending() async{
|
||||||
// Database db = await instance.database;
|
// Database db = await instance.database;
|
||||||
// return await Sqflite.firstIntValue(await db.rawQuery("SELECT COUNT(*) FROM incidents"));
|
// return await Sqflite.firstIntValue(await db.rawQuery("SELECT COUNT(*) FROM incidents"));
|
||||||
|
|||||||
@ -31,7 +31,11 @@ class StringValues extends Translations{
|
|||||||
'no_values': 'No Values',
|
'no_values': 'No Values',
|
||||||
'email_and_password_required': 'Email and password required',
|
'email_and_password_required': 'Email and password required',
|
||||||
'rogaining_user_need_tosign_up': "Rogaining participants do need to sign up.",
|
'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': {
|
'ja_JP': {
|
||||||
'drawer_title':'ロゲイニング参加者はログイン するとチェックポイントが参照 できます',
|
'drawer_title':'ロゲイニング参加者はログイン するとチェックポイントが参照 できます',
|
||||||
@ -63,7 +67,11 @@ class StringValues extends Translations{
|
|||||||
'no_values': '値なし',
|
'no_values': '値なし',
|
||||||
'email_and_password_required': 'メールとパスワードが必要です',
|
'email_and_password_required': 'メールとパスワードが必要です',
|
||||||
'rogaining_user_need_tosign_up': "ロゲイニング参加者はサインアップの必要はありません。",
|
'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/model/destination.dart';
|
||||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||||
import 'package:rogapp/pages/index/index_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_new.dart';
|
||||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||||
import 'package:timeline_tile/timeline_tile.dart';
|
import 'package:timeline_tile/timeline_tile.dart';
|
||||||
@ -59,6 +60,11 @@ class DestinationWidget extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void moveUp() {
|
void moveUp() {
|
||||||
|
for(Destination d in destinationController.destinations){
|
||||||
|
// if(d.selected){
|
||||||
|
|
||||||
|
// }
|
||||||
|
}
|
||||||
destinationController.destination_index_data.forEach((element) {
|
destinationController.destination_index_data.forEach((element) {
|
||||||
//print(element["index"]);
|
//print(element["index"]);
|
||||||
//int action_id = destinationController.destinations[element["index"]]["id"] as int;
|
//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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
@ -97,7 +108,6 @@ class DestinationWidget extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.only(top:45.0),
|
padding: const EdgeInsets.only(top:45.0),
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemCount: destinationController.destinationCount.value,
|
itemCount: destinationController.destinationCount.value,
|
||||||
|
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
return
|
return
|
||||||
TimelineTile(
|
TimelineTile(
|
||||||
@ -105,7 +115,10 @@ class DestinationWidget extends StatelessWidget {
|
|||||||
lineXY: 0.2,
|
lineXY: 0.2,
|
||||||
isFirst: index == 0 ? true : false,
|
isFirst: index == 0 ? true : false,
|
||||||
indicatorStyle: IndicatorStyle(
|
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()),
|
key: Key(index.toString()),
|
||||||
endChild: Card(
|
endChild: Card(
|
||||||
@ -165,8 +178,8 @@ class DestinationWidget extends StatelessWidget {
|
|||||||
Column(
|
Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: [
|
children: [
|
||||||
//Text(destinationController.matrix["rows"][0]["elements"][index]["distance"]["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]["duration"]["text"].toString())
|
Text(destinationController.matrix["rows"][0]["elements"][index]["distance"] != null ? destinationController.matrix["rows"][0]["elements"][index]["duration"]["text"].toString() : '')
|
||||||
],
|
],
|
||||||
):
|
):
|
||||||
Container()
|
Container()
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:geojson/geojson.dart';
|
import 'package:geojson/geojson.dart';
|
||||||
import 'package:get/get.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/pages/index/index_controller.dart';
|
||||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||||
@ -9,6 +11,7 @@ class ListWidget extends StatelessWidget {
|
|||||||
ListWidget({ Key? key }) : super(key: key);
|
ListWidget({ Key? key }) : super(key: key);
|
||||||
|
|
||||||
final IndexController indexController = Get.find<IndexController>();
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
|
final DestinationController destinationController = Get.find<DestinationController>();
|
||||||
|
|
||||||
Image getImage(int index){
|
Image getImage(int index){
|
||||||
if(indexController.locations[0].collection[index].properties!["photos"] == null || indexController.locations[0].collection[index].properties!["photos"] == ""){
|
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,
|
itemCount: indexController.locations[0].collection.length,
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemBuilder: (_, index){
|
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(
|
return Card(
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
|
selected: _is_found,
|
||||||
|
|
||||||
|
selectedTileColor: Colors.yellow.shade200,
|
||||||
onTap: (){
|
onTap: (){
|
||||||
GeoJsonFeature gf = indexController.locations[0].collection[index];
|
GeoJsonFeature gf = indexController.locations[0].collection[index];
|
||||||
changeCurrentFeature(gf);
|
changeCurrentFeature(gf);
|
||||||
@ -54,6 +67,7 @@ class ListWidget extends StatelessWidget {
|
|||||||
leading: getImage(index),
|
leading: getImage(index),
|
||||||
title: indexController.locations[0].collection[index].properties!['location_name'] != null ? Text(indexController.locations[0].collection[index].properties!['location_name'].toString()) : Text(""),
|
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(""),
|
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'] ),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@ -57,6 +57,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.1"
|
version: "2.0.1"
|
||||||
|
circular_menu:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: circular_menu
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.1"
|
||||||
cli_util:
|
cli_util:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@ -68,6 +68,7 @@ dependencies:
|
|||||||
flutter_typeahead: ^4.0.0
|
flutter_typeahead: ^4.0.0
|
||||||
flutter_launcher_icons: ^0.10.0
|
flutter_launcher_icons: ^0.10.0
|
||||||
rename: ^2.0.1
|
rename: ^2.0.1
|
||||||
|
circular_menu: ^2.0.1
|
||||||
|
|
||||||
flutter_icons:
|
flutter_icons:
|
||||||
android: true
|
android: true
|
||||||
|
|||||||