update
This commit is contained in:
25
.vscode/launch.json
vendored
Normal file
25
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "rogapp",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "dart"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "rogapp (profile mode)",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "dart",
|
||||||
|
"flutterMode": "profile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "rogapp (release mode)",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "dart",
|
||||||
|
"flutterMode": "release"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -53,5 +53,7 @@
|
|||||||
<string>Photo Library Access Warning</string>
|
<string>Photo Library Access Warning</string>
|
||||||
<key>NSCameraUsageDescription</key>
|
<key>NSCameraUsageDescription</key>
|
||||||
<string>Camera access to take photo</string>
|
<string>Camera access to take photo</string>
|
||||||
|
<key>NSMicrophoneUsageDescription</key>
|
||||||
|
<string>Post videos to profile</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@ -1,15 +1,22 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:geojson/geojson.dart';
|
||||||
import 'package:geolocator/geolocator.dart';
|
import 'package:geolocator/geolocator.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:latlong2/latlong.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
import 'package:rogapp/routes/app_pages.dart';
|
import 'package:rogapp/routes/app_pages.dart';
|
||||||
import 'package:rogapp/services/destination_service.dart';
|
import 'package:rogapp/services/destination_service.dart';
|
||||||
import 'package:rogapp/services/maxtrix_service.dart';
|
import 'package:rogapp/services/maxtrix_service.dart';
|
||||||
|
import 'package:rogapp/services/reacking_service.dart';
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||||
|
|
||||||
class DestinationController extends GetxController {
|
class DestinationController extends GetxController {
|
||||||
|
|
||||||
late LocationSettings locationSettings;
|
late LocationSettings locationSettings;
|
||||||
@ -17,21 +24,91 @@ class DestinationController extends GetxController {
|
|||||||
List<dynamic> destinations = <dynamic>[].obs;
|
List<dynamic> destinations = <dynamic>[].obs;
|
||||||
List<Map<String, dynamic>> destination_index_data = <Map<String, dynamic>>[].obs;
|
List<Map<String, dynamic>> destination_index_data = <Map<String, dynamic>>[].obs;
|
||||||
|
|
||||||
|
bool checking_in = false;
|
||||||
|
List<bool> isSelected = [true].obs;
|
||||||
|
BuildContext? context;
|
||||||
|
|
||||||
Map<String, dynamic> matrix = {};
|
Map<String, dynamic> matrix = {};
|
||||||
|
|
||||||
final IndexController indexController = Get.find<IndexController>();
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
|
|
||||||
|
Future<GeoJsonFeature?> 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 == p.geoSerie!.geoPoints[0].latitude && long == p.geoSerie!.geoPoints[0].longitude){
|
||||||
|
return features.collection[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
checkForCheckin(double la, double ln){
|
||||||
|
for(final d in destinations){
|
||||||
|
double lat = d["location"]["geometry"]["coordinates"][0][1] as double;
|
||||||
|
double lon = d["location"]["geometry"]["coordinates"][0][0] as double;
|
||||||
|
LatLng p = LatLng(lat, lon);
|
||||||
|
getDEstinationForLatLong(lat, lon).then((value){
|
||||||
|
var distance = Distance();
|
||||||
|
double dist = distance.as(LengthUnit.Meter, LatLng(lat, lon), LatLng(la, ln));
|
||||||
|
double rad = value!.properties!["checkin_radious"] ?? double.infinity;
|
||||||
|
bool auto_checkin = value.properties!["auto_checkin"] ?? false;
|
||||||
|
|
||||||
|
indexController.currentFeature.add(value);
|
||||||
|
indexController.getAction();
|
||||||
|
|
||||||
|
if(!checking_in){
|
||||||
|
checking_in = true;
|
||||||
|
if(rad >= dist){
|
||||||
|
if(auto_checkin){
|
||||||
|
if(indexController.currentAction.isNotEmpty){
|
||||||
|
print(indexController.currentAction[0]);
|
||||||
|
indexController.currentAction[0][0]["checkin"] = true;
|
||||||
|
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
||||||
|
indexController.currentAction.clear();
|
||||||
|
print("---temp---${temp}");
|
||||||
|
indexController.currentAction.add([temp]);
|
||||||
|
}
|
||||||
|
indexController.makeAction(Get.context!);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
|
||||||
|
builder:((context) => BottomSheetWidget())
|
||||||
|
).whenComplete((){
|
||||||
|
checking_in = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print("----- rad is ${rad}");
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
PopulateDestinations();
|
PopulateDestinations();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (defaultTargetPlatform == TargetPlatform.android) {
|
if (defaultTargetPlatform == TargetPlatform.android) {
|
||||||
locationSettings = AndroidSettings(
|
locationSettings = AndroidSettings(
|
||||||
accuracy: LocationAccuracy.high,
|
accuracy: LocationAccuracy.high,
|
||||||
distanceFilter: 1,
|
distanceFilter: 30,
|
||||||
forceLocationManager: true,
|
forceLocationManager: true,
|
||||||
intervalDuration: const Duration(seconds: 10),
|
intervalDuration: const Duration(seconds: 10),
|
||||||
//(Optional) Set foreground notification config to keep the app alive
|
//(Optional) Set foreground notification config to keep the app alive
|
||||||
@ -55,13 +132,20 @@ class DestinationController extends GetxController {
|
|||||||
} else {
|
} else {
|
||||||
locationSettings = LocationSettings(
|
locationSettings = LocationSettings(
|
||||||
accuracy: LocationAccuracy.high,
|
accuracy: LocationAccuracy.high,
|
||||||
distanceFilter: 1,
|
distanceFilter: 30,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
StreamSubscription<Position> positionStream = Geolocator.getPositionStream(locationSettings: locationSettings).listen(
|
StreamSubscription<Position> positionStream = Geolocator.getPositionStream(locationSettings: locationSettings).listen(
|
||||||
(Position? position) {
|
(Position? position) {
|
||||||
|
if(isSelected[0]){
|
||||||
|
String user_id = indexController.currentUser[0]["user"]["id"].toString();
|
||||||
|
TrackingService.addTrack(user_id, position!.latitude, position.longitude).then((val){
|
||||||
|
//checkForCheckin(position!.latitude, position.longitude);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
print(position == null ? 'Unknown' : 'current position is ${position.latitude.toString()}, ${position.longitude.toString()}');
|
print(position == null ? 'Unknown' : 'current position is ${position.latitude.toString()}, ${position.longitude.toString()}');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -80,7 +164,7 @@ class DestinationController extends GetxController {
|
|||||||
|
|
||||||
void PopulateDestinations(){
|
void PopulateDestinations(){
|
||||||
if(indexController.currentUser.isNotEmpty){
|
if(indexController.currentUser.isNotEmpty){
|
||||||
int user_id = indexController.currentUser[0]["user"]["id"] as int;
|
int user_id = indexController.currentUser[0]["user"]["id"];
|
||||||
//print(user_id);
|
//print(user_id);
|
||||||
DestinationService.getDestinations(user_id).then((value){
|
DestinationService.getDestinations(user_id).then((value){
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,6 @@ class _DestinationPageState extends State<DestinationPage> {
|
|||||||
final IndexController indexController = Get.find<IndexController>();
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
final List<int> _items = List<int>.generate(50, (int index) => index);
|
final List<int> _items = List<int>.generate(50, (int index) => index);
|
||||||
List<bool> isSelected = [true];
|
|
||||||
|
|
||||||
Future<void> showCurrentPosition() async {
|
Future<void> showCurrentPosition() async {
|
||||||
LocationPermission permission = await Geolocator.checkPermission();
|
LocationPermission permission = await Geolocator.checkPermission();
|
||||||
@ -47,6 +46,12 @@ class _DestinationPageState extends State<DestinationPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
destinationController.context = context;
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final ColorScheme colorScheme = Theme.of(context).colorScheme;
|
final ColorScheme colorScheme = Theme.of(context).colorScheme;
|
||||||
@ -82,6 +87,12 @@ class _DestinationPageState extends State<DestinationPage> {
|
|||||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
||||||
appBar:AppBar(
|
appBar:AppBar(
|
||||||
title: Text("Iternery"),
|
title: Text("Iternery"),
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(Icons.arrow_back_ios),
|
||||||
|
onPressed: (){
|
||||||
|
indexController.switchPage(AppPages.INITIAL);
|
||||||
|
},
|
||||||
|
),
|
||||||
actions: [
|
actions: [
|
||||||
ToggleButtons(
|
ToggleButtons(
|
||||||
disabledColor: Colors.grey.shade200,
|
disabledColor: Colors.grey.shade200,
|
||||||
@ -91,10 +102,10 @@ class _DestinationPageState extends State<DestinationPage> {
|
|||||||
)],
|
)],
|
||||||
onPressed: (int index) {
|
onPressed: (int index) {
|
||||||
setState(() {
|
setState(() {
|
||||||
isSelected[index] = !isSelected[index];
|
destinationController.isSelected[index] = !destinationController.isSelected[index];
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
isSelected: isSelected,
|
isSelected: destinationController.isSelected,
|
||||||
),
|
),
|
||||||
IconButton(onPressed: (){
|
IconButton(onPressed: (){
|
||||||
showCurrentPosition();
|
showCurrentPosition();
|
||||||
|
|||||||
@ -4,7 +4,9 @@ import 'dart:async';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_map/plugin_api.dart';
|
import 'package:flutter_map/plugin_api.dart';
|
||||||
import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
|
import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
|
||||||
|
import 'package:flutter_map_marker_popup/flutter_map_marker_popup.dart';
|
||||||
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
|
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
|
||||||
|
import 'package:geojson/geojson.dart';
|
||||||
import 'package:geolocator/geolocator.dart';
|
import 'package:geolocator/geolocator.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:latlong2/latlong.dart';
|
import 'package:latlong2/latlong.dart';
|
||||||
@ -12,10 +14,12 @@ import 'package:rogapp/pages/destination/destination_controller.dart';
|
|||||||
//import 'package:google_maps_flutter/google_maps_flutter.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_widget.dart';
|
||||||
|
|
||||||
class DestinationMapPage extends StatefulWidget {
|
class DestinationMapPage extends StatefulWidget {
|
||||||
DestinationMapPage({ Key? key }) : super(key: key);
|
DestinationMapPage({ Key? key }) : super(key: key);
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<DestinationMapPage> createState() => _DestinationMapPageState();
|
State<DestinationMapPage> createState() => _DestinationMapPageState();
|
||||||
}
|
}
|
||||||
@ -25,6 +29,69 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
|||||||
|
|
||||||
final DestinationController destinationController = Get.find<DestinationController>();
|
final DestinationController destinationController = Get.find<DestinationController>();
|
||||||
StreamSubscription? subscription;
|
StreamSubscription? subscription;
|
||||||
|
final PopupController _popupLayerController = PopupController();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Widget examplePopup(Marker marker){
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(10),
|
||||||
|
child: Container(
|
||||||
|
constraints: const BoxConstraints(minWidth: 100, maxWidth: 200),
|
||||||
|
color: Colors.white,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: <Widget>[
|
||||||
|
const Text(
|
||||||
|
'Popup for a marker!',
|
||||||
|
overflow: TextOverflow.fade,
|
||||||
|
softWrap: false,
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
fontSize: 14.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Padding(padding: EdgeInsets.symmetric(vertical: 4.0)),
|
||||||
|
Text(
|
||||||
|
'Position: ${marker.point.latitude}, ${marker.point.longitude}',
|
||||||
|
style: const TextStyle(fontSize: 12.0),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Marker size: ${marker.width}, ${marker.height}',
|
||||||
|
style: const TextStyle(fontSize: 12.0),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
final List<LatLng> _markerPositions = [
|
||||||
|
LatLng(35.728728732933455, 137.06878077038706),
|
||||||
|
LatLng(35.958218259568305, 137.06187578986646),
|
||||||
|
LatLng(35.76795686324816, 137.08949571194879),
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<Marker> get _markers => _markerPositions
|
||||||
|
.map(
|
||||||
|
(markerPosition) => Marker(
|
||||||
|
point: markerPosition,
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
builder: (_) => const Icon(Icons.location_on, size: 40),
|
||||||
|
anchorPos: AnchorPos.align(AnchorAlign.top),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<LatLng>? getPoints(){
|
List<LatLng>? getPoints(){
|
||||||
//print("##### --- route point ${indexController.routePoints.length}");
|
//print("##### --- route point ${indexController.routePoints.length}");
|
||||||
@ -36,14 +103,34 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
|||||||
return pts;
|
return pts;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Marker>? getMarkers(){
|
List<Marker>? getMarkers() {
|
||||||
List<Marker> pts = [];
|
List<Marker> pts = [];
|
||||||
for(dynamic d in destinationController.destinations){
|
for(dynamic d in destinationController.destinations){
|
||||||
double lat = d["location"]["geometry"]["coordinates"][0][1];
|
double lat = d["location"]["geometry"]["coordinates"][0][1];
|
||||||
double lan = d["location"]["geometry"]["coordinates"][0][0];
|
double lan = d["location"]["geometry"]["coordinates"][0][0];
|
||||||
|
//print("-----lat ${lat}, ----- lon ${lan}");
|
||||||
Marker m = Marker(point: LatLng(lat, lan), builder:(cts){
|
Marker m = Marker(point: LatLng(lat, lan), builder:(cts){
|
||||||
return Icon(Icons.pin_drop);
|
//return Icon(Icons.pin_drop);
|
||||||
|
return IconButton(
|
||||||
|
onPressed: ()async {
|
||||||
|
GeoJsonFeature? fs = await destinationController.getDEstinationForLatLong(lat, lan);
|
||||||
|
print("----fsf-----${fs}");
|
||||||
|
if(fs != null){
|
||||||
|
if(indexController.currentFeature.length > 0) {
|
||||||
|
indexController.currentFeature.clear();
|
||||||
|
}
|
||||||
|
indexController.currentFeature.add(fs);
|
||||||
|
indexController.getAction();
|
||||||
|
|
||||||
|
showModalBottomSheet(context: context, isScrollControlled: true,
|
||||||
|
builder:((context) => BottomSheetWidget())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
icon: Icon(Icons.pin_drop));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
pts.add(m);
|
pts.add(m);
|
||||||
}
|
}
|
||||||
return pts;
|
return pts;
|
||||||
@ -85,15 +172,15 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
|||||||
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
|
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
|
||||||
plugins: [LocationMarkerPlugin(),]
|
plugins: [LocationMarkerPlugin(),]
|
||||||
),
|
),
|
||||||
layers: [
|
children: [
|
||||||
TileLayerOptions(
|
TileLayerWidget(
|
||||||
urlTemplate:
|
options: TileLayerOptions(
|
||||||
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||||
subdomains: ['a', 'b', 'c']),
|
subdomains: ['a', 'b', 'c'],
|
||||||
MarkerLayerOptions(
|
),
|
||||||
markers: getMarkers()!,
|
|
||||||
),
|
),
|
||||||
PolylineLayerOptions(
|
PolylineLayerWidget(
|
||||||
|
options: PolylineLayerOptions(
|
||||||
polylines: [
|
polylines: [
|
||||||
Polyline(
|
Polyline(
|
||||||
points: getPoints()!,
|
points: getPoints()!,
|
||||||
@ -101,8 +188,25 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
|||||||
color: Colors.purple),
|
color: Colors.purple),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
LocationMarkerLayerOptions(),
|
),
|
||||||
|
// PopupMarkerLayerWidget(
|
||||||
|
// options: PopupMarkerLayerOptions(
|
||||||
|
// popupController: _popupLayerController,
|
||||||
|
// markers: _markers,
|
||||||
|
// markerRotateAlignment:
|
||||||
|
// PopupMarkerLayerOptions.rotationAlignmentFor(AnchorAlign.top),
|
||||||
|
// popupBuilder: (BuildContext context, Marker marker) =>
|
||||||
|
|
||||||
|
// examplePopup(marker),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
MarkerLayerWidget(
|
||||||
|
options: MarkerLayerOptions(
|
||||||
|
markers: getMarkers()!
|
||||||
|
),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
|
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,7 @@ class IndexController extends GetxController {
|
|||||||
List<LatLngBounds> currentBound = <LatLngBounds>[].obs;
|
List<LatLngBounds> currentBound = <LatLngBounds>[].obs;
|
||||||
List<dynamic> subPerfs = <dynamic>[].obs;
|
List<dynamic> subPerfs = <dynamic>[].obs;
|
||||||
List<dynamic> areas = <dynamic>[].obs;
|
List<dynamic> areas = <dynamic>[].obs;
|
||||||
|
List<dynamic> customAreas = <dynamic>[].obs;
|
||||||
List<dynamic> cats = <dynamic>[].obs;
|
List<dynamic> cats = <dynamic>[].obs;
|
||||||
|
|
||||||
List<String> currentCat = <String>[].obs;
|
List<String> currentCat = <String>[].obs;
|
||||||
@ -36,6 +37,8 @@ class IndexController extends GetxController {
|
|||||||
|
|
||||||
var mode = 0.obs;
|
var mode = 0.obs;
|
||||||
|
|
||||||
|
var rog_mode = 0.obs;
|
||||||
|
|
||||||
var desination_mode = 0.obs;
|
var desination_mode = 0.obs;
|
||||||
|
|
||||||
|
|
||||||
@ -43,6 +46,8 @@ class IndexController extends GetxController {
|
|||||||
String subDropdownValue = "-1";
|
String subDropdownValue = "-1";
|
||||||
String areaDropdownValue = "-1";
|
String areaDropdownValue = "-1";
|
||||||
|
|
||||||
|
late Worker _ever;
|
||||||
|
|
||||||
void toggleMode(){
|
void toggleMode(){
|
||||||
if(mode.value==0){
|
if(mode.value==0){
|
||||||
mode += 1;
|
mode += 1;
|
||||||
@ -61,9 +66,33 @@ class IndexController extends GetxController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void switchPage(String page){
|
||||||
|
//print("######## ${currentUser[0]["user"]["id"]}");
|
||||||
|
switch (page) {
|
||||||
|
case AppPages.INITIAL :{
|
||||||
|
rog_mode.value = 0;
|
||||||
|
Get.toNamed(page);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case AppPages.TRAVEL : {
|
||||||
|
rog_mode.value = 1;
|
||||||
|
Get.toNamed(page);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case AppPages.LOGIN :{
|
||||||
|
rog_mode.value = 2;
|
||||||
|
Get.toNamed(page);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:{
|
||||||
|
rog_mode.value = 0;
|
||||||
|
Get.toNamed(AppPages.INITIAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
|
||||||
|
|
||||||
// if(locations.length == 0){
|
// if(locations.length == 0){
|
||||||
// LocationService.loadLocations().then((value){
|
// LocationService.loadLocations().then((value){
|
||||||
@ -71,23 +100,59 @@ class IndexController extends GetxController {
|
|||||||
// //print(value);
|
// //print(value);
|
||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
_ever = ever(rog_mode, (_) => print("$_ has been changed (ever)"));
|
||||||
|
|
||||||
if(perfectures.length == 0){
|
if(perfectures.length == 0){
|
||||||
PerfectureService.loadPerfectures().then((value){
|
PerfectureService.loadPerfectures().then((value){
|
||||||
perfectures.add(value);
|
perfectures.add(value);
|
||||||
loadAreaFor("9");
|
loadAreaFor("9");
|
||||||
|
|
||||||
//loadSubPerfFor("9");
|
//loadSubPerfFor("9");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//loadCats();
|
super.onInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void login(String email, String password, BuildContext context){
|
|
||||||
|
LatLngBounds boundsFromLatLngList(List<LatLng> list) {
|
||||||
|
double? x0, x1, y0, y1;
|
||||||
|
for (LatLng latLng in list) {
|
||||||
|
if (x0 == null || x1 == null || y0 == null || y1 == null) {
|
||||||
|
x0 = x1 = latLng.latitude;
|
||||||
|
y0 = y1 = latLng.longitude;
|
||||||
|
} else {
|
||||||
|
if (latLng.latitude > x1) x1 = latLng.latitude;
|
||||||
|
if (latLng.latitude < x0) x0 = latLng.latitude;
|
||||||
|
if (latLng.longitude > y1) y1 = latLng.longitude;
|
||||||
|
if (latLng.longitude < y0) y0 = latLng.longitude;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return LatLngBounds(LatLng(x1!, y1!), LatLng(x0!, y0!));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
List<LatLng> getLocationsList(){
|
||||||
|
List<LatLng> locs = [];
|
||||||
|
for(int i=0; i<= locations[0].collection.length - 1; i++){
|
||||||
|
GeoJsonMultiPoint p = locations[0].collection[i].geometry as GeoJsonMultiPoint;
|
||||||
|
|
||||||
|
LatLng latLng = LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude);
|
||||||
|
locs.add(latLng);
|
||||||
|
}
|
||||||
|
return locs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void login(String email, String password, BuildContext context){
|
||||||
AuthService.login(email, password).then((value){
|
AuthService.login(email, password).then((value){
|
||||||
if(value.isNotEmpty){
|
if(value.isNotEmpty){
|
||||||
currentUser.clear();
|
currentUser.clear();
|
||||||
currentUser.add(value);
|
currentUser.add(value);
|
||||||
is_loading.value = false;
|
is_loading.value = false;
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
loadUserDetails();
|
||||||
if(currentFeature.isNotEmpty){
|
if(currentFeature.isNotEmpty){
|
||||||
getAction();
|
getAction();
|
||||||
}
|
}
|
||||||
@ -107,6 +172,7 @@ class IndexController extends GetxController {
|
|||||||
currentUser.add(value);
|
currentUser.add(value);
|
||||||
is_loading.value = false;
|
is_loading.value = false;
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
loadUserDetails();
|
||||||
Get.toNamed(AppPages.INITIAL);
|
Get.toNamed(AppPages.INITIAL);
|
||||||
}else{
|
}else{
|
||||||
is_loading.value = false;
|
is_loading.value = false;
|
||||||
@ -121,26 +187,13 @@ class IndexController extends GetxController {
|
|||||||
bool wanttogo = currentAction[0][0]["wanttogo"];
|
bool wanttogo = currentAction[0][0]["wanttogo"];
|
||||||
bool like = currentAction[0][0]["like"];
|
bool like = currentAction[0][0]["like"];
|
||||||
bool checkin = currentAction[0][0]["checkin"];
|
bool checkin = currentAction[0][0]["checkin"];
|
||||||
print("----userid----${user_id}");
|
|
||||||
if(user_id > 0){
|
if(user_id > 0){
|
||||||
ActionService.makeAction(user_id, location_id, wanttogo, like, checkin).then((value){
|
ActionService.makeAction(user_id, location_id, wanttogo, like, checkin).then((value){
|
||||||
print("----action value----${value}");
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// void loadCats(){
|
|
||||||
// dynamic initVal = {'category':'---'};
|
|
||||||
// CatService.loadCats().then((value) {
|
|
||||||
// //value!.add(initVal);
|
|
||||||
// print("###########");
|
|
||||||
// print(value);
|
|
||||||
// cats.add(value);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void loadCatsv2(){
|
void loadCatsv2(){
|
||||||
dynamic initVal = {'category':'---'};
|
dynamic initVal = {'category':'---'};
|
||||||
@ -148,7 +201,6 @@ class IndexController extends GetxController {
|
|||||||
if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){
|
if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){
|
||||||
cats.clear();
|
cats.clear();
|
||||||
CatService.loadCats(bounds.southWest!.latitude, bounds.southWest!.longitude, bounds.northWest.latitude, bounds.northWest.longitude, bounds.northEast!.latitude, bounds.northEast!.longitude, bounds.southEast.latitude, bounds.southEast.longitude).then((value) {
|
CatService.loadCats(bounds.southWest!.latitude, bounds.southWest!.longitude, bounds.northWest.latitude, bounds.northWest.longitude, bounds.northEast!.latitude, bounds.northEast!.longitude, bounds.southEast.latitude, bounds.southEast.longitude).then((value) {
|
||||||
print("###########");
|
|
||||||
print(value);
|
print(value);
|
||||||
cats.add(value);
|
cats.add(value);
|
||||||
});
|
});
|
||||||
@ -181,11 +233,30 @@ class IndexController extends GetxController {
|
|||||||
areas.clear();
|
areas.clear();
|
||||||
dynamic initVal = {'id':'-1', 'adm2_ja':'----'};
|
dynamic initVal = {'id':'-1', 'adm2_ja':'----'};
|
||||||
PerfectureService.loadGifuAreas(perf).then((value){
|
PerfectureService.loadGifuAreas(perf).then((value){
|
||||||
print(value);
|
|
||||||
value!.add(initVal);
|
value!.add(initVal);
|
||||||
areas.add(value);
|
areas.add(value);
|
||||||
//loadSubPerfFor("9");
|
});
|
||||||
//subDropdownValue = getSubInitialVal();
|
}
|
||||||
|
|
||||||
|
void loadUserDetails(){
|
||||||
|
if(currentUser.length > 0){
|
||||||
|
int user_id = currentUser[0]["user"]["id"] as int;
|
||||||
|
AuthService.UserDetails(user_id).then((value){
|
||||||
|
//print("--------- user details ----- ${value}");
|
||||||
|
bool paid = value![0]["paid"] as bool;
|
||||||
|
if(paid){
|
||||||
|
loadCustomAreas();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void loadCustomAreas(){
|
||||||
|
customAreas.clear();
|
||||||
|
PerfectureService.loadCustomAreas().then((value){
|
||||||
|
print("--- loading custom areas ${value}");
|
||||||
|
customAreas.add(value);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,12 +306,20 @@ class IndexController extends GetxController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadCustomLocation(String customarea, MapController mapController) async {
|
void loadCustomLocation(String customarea) async {
|
||||||
String cat = currentCat.isNotEmpty == true ? currentCat[0] : "";
|
String cat = currentCat.isNotEmpty == true ? currentCat[0] : "";
|
||||||
print(currentCat);
|
print("----- ${customarea}");
|
||||||
LocationService.loadCustomLocations(cat).then((value){
|
LocationService.loadCustomLocations(customarea, cat).then((value){
|
||||||
locations.clear();
|
locations.clear();
|
||||||
locations.add(value!);
|
locations.add(value!);
|
||||||
|
List<LatLng> locs = getLocationsList();
|
||||||
|
LatLngBounds bounds = boundsFromLatLngList(locs);
|
||||||
|
mapController!.fitBounds(bounds);
|
||||||
|
setBound(bounds);
|
||||||
|
Future.delayed(Duration(microseconds: 400), () {
|
||||||
|
mapController!.fitBounds(bounds);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,8 +391,9 @@ class IndexController extends GetxController {
|
|||||||
is_loading.value = false;
|
is_loading.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void populateForCustomArea(String customarea, MapController mapController){
|
void populateSubPerForArea(String area, MapController mapController){
|
||||||
loadCustomLocation("cus", mapController);
|
loadSubPerfFor(area);
|
||||||
|
//loadCustomLocation("cus", mapController);
|
||||||
//zoomtoSubPerf(subperf);
|
//zoomtoSubPerf(subperf);
|
||||||
is_loading.value = false;
|
is_loading.value = false;
|
||||||
}
|
}
|
||||||
@ -337,6 +417,7 @@ class IndexController extends GetxController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int user_id = currentUser[0]["user"]["id"] as int;
|
int user_id = currentUser[0]["user"]["id"] as int;
|
||||||
|
print("---- loc id ${currentFeature[0].properties}");
|
||||||
int location_id = currentFeature[0].properties!["location_id"] as int;
|
int location_id = currentFeature[0].properties!["location_id"] as int;
|
||||||
ActionService.userAction(user_id, location_id).then((value){
|
ActionService.userAction(user_id, location_id).then((value){
|
||||||
print("------${value}");
|
print("------${value}");
|
||||||
|
|||||||
@ -37,10 +37,12 @@ class IndexPage extends GetView<IndexController> {
|
|||||||
const Expanded(child: Text('')),
|
const Expanded(child: Text('')),
|
||||||
Expanded(child: IconButton(icon: const Icon(Icons.travel_explore), onPressed: (){
|
Expanded(child: IconButton(icon: const Icon(Icons.travel_explore), onPressed: (){
|
||||||
if(indexController.currentUser.isNotEmpty){
|
if(indexController.currentUser.isNotEmpty){
|
||||||
Get.toNamed(AppPages.TRAVEL);
|
indexController.switchPage(AppPages.TRAVEL);
|
||||||
|
//Get.toNamed(AppPages.TRAVEL);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Get.toNamed(AppPages.LOGIN);
|
indexController.switchPage(AppPages.LOGIN);
|
||||||
|
//Get.toNamed(AppPages.LOGIN);
|
||||||
}
|
}
|
||||||
}),),
|
}),),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
import 'package:get/get_navigation/src/routes/get_route.dart';
|
import 'package:get/get_navigation/src/routes/get_route.dart';
|
||||||
import 'package:rogapp/pages/destination/destination_binding.dart';
|
import 'package:rogapp/pages/destination/destination_binding.dart';
|
||||||
import 'package:rogapp/pages/destination/destination_page.dart';
|
import 'package:rogapp/pages/destination/destination_page.dart';
|
||||||
import 'package:rogapp/pages/index/index_binding.dart';
|
import 'package:rogapp/pages/index/index_binding.dart';
|
||||||
|
import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
import 'package:rogapp/pages/index/index_page.dart';
|
import 'package:rogapp/pages/index/index_page.dart';
|
||||||
import 'package:rogapp/pages/landing/landing_page.dart';
|
import 'package:rogapp/pages/landing/landing_page.dart';
|
||||||
import 'package:rogapp/pages/loading/loading_page.dart';
|
import 'package:rogapp/pages/loading/loading_page.dart';
|
||||||
@ -14,6 +16,7 @@ import 'package:rogapp/spa/spa_page.dart';
|
|||||||
part 'app_routes.dart';
|
part 'app_routes.dart';
|
||||||
|
|
||||||
class AppPages {
|
class AppPages {
|
||||||
|
|
||||||
// ignore: constant_identifier_names
|
// ignore: constant_identifier_names
|
||||||
static const INITIAL = Routes.INDEX;
|
static const INITIAL = Routes.INDEX;
|
||||||
// ignore: constant_identifier_names
|
// ignore: constant_identifier_names
|
||||||
|
|||||||
@ -1,13 +1,16 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:rogapp/utils/const.dart';
|
||||||
|
|
||||||
|
|
||||||
class ActionService{
|
class ActionService{
|
||||||
|
|
||||||
static Future<Map<String, dynamic>> makeAction(int user_id, int location_id, bool wanttogo, bool like, bool checkin) async {
|
static Future<Map<String, dynamic>> makeAction(int user_id, int location_id, bool wanttogo, bool like, bool checkin) async {
|
||||||
|
print("----- action is ---- ${like}-- ${wanttogo}-- ${checkin}");
|
||||||
Map<String, dynamic> cats = {};
|
Map<String, dynamic> cats = {};
|
||||||
//String url = "http://container.intranet.sumasen.net:8100/api/makeaction/?user_id=${user_id}&location_id=${location_id}&wanttogo=${wanttogo}&like=${like}&checkin=${checkin}";
|
String server_url = ConstValues.currentServer();
|
||||||
String url = "http://localhost:8100/api/makeaction/?user_id=${user_id}&location_id=${location_id}&wanttogo=${wanttogo}&like=${like}&checkin=${checkin}";
|
String url = "${server_url}/api/makeaction/?user_id=${user_id}&location_id=${location_id}&wanttogo=${wanttogo}&like=${like}&checkin=${checkin}";
|
||||||
|
//String url = "http://localhost:8100/api/makeaction/?user_id=${user_id}&location_id=${location_id}&wanttogo=${wanttogo}&like=${like}&checkin=${checkin}";
|
||||||
final http.Response response = await http.get(
|
final http.Response response = await http.get(
|
||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
@ -24,8 +27,9 @@ class ActionService{
|
|||||||
|
|
||||||
static Future<List<dynamic>?> userAction(int user_id, int location_id) async {
|
static Future<List<dynamic>?> userAction(int user_id, int location_id) async {
|
||||||
List<dynamic> cats = [];
|
List<dynamic> cats = [];
|
||||||
//String url = 'http://container.intranet.sumasen.net:8100/api/useraction/?user_id=${user_id}&location_id=${location_id}';
|
String server_url = ConstValues.currentServer();
|
||||||
String url = 'http://localhost:8100/api/useraction/?user_id=${user_id}&location_id=${location_id}';
|
String url = '${server_url}/api/useraction/?user_id=${user_id}&location_id=${location_id}';
|
||||||
|
//String url = 'http://localhost:8100/api/useraction/?user_id=${user_id}&location_id=${location_id}';
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
|||||||
@ -1,13 +1,16 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
import '../utils/const.dart';
|
||||||
|
|
||||||
|
|
||||||
class AuthService{
|
class AuthService{
|
||||||
|
|
||||||
static Future<Map<String, dynamic>> login(String email, String password) async {
|
static Future<Map<String, dynamic>> login(String email, String password) async {
|
||||||
Map<String, dynamic> cats = {};
|
Map<String, dynamic> cats = {};
|
||||||
//String url = 'http://container.intranet.sumasen.net:8100/api/login/';
|
String server_url = ConstValues.currentServer();
|
||||||
String url = 'http://localhost:8100/api/login/';
|
String url = '${server_url}/api/login/';
|
||||||
|
//String url = 'http://localhost:8100/api/login/';
|
||||||
final http.Response response = await http.post(
|
final http.Response response = await http.post(
|
||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
@ -28,8 +31,9 @@ class AuthService{
|
|||||||
|
|
||||||
static Future<Map<String, dynamic>> register(String email, String password) async {
|
static Future<Map<String, dynamic>> register(String email, String password) async {
|
||||||
Map<String, dynamic> cats = {};
|
Map<String, dynamic> cats = {};
|
||||||
//String url = 'http://container.intranet.sumasen.net:8100/api/register/';
|
String server_url = ConstValues.currentServer();
|
||||||
String url = 'http://localhost:8100/api/register/';
|
String url = '${server_url}/api/register/';
|
||||||
|
//String url = 'http://localhost:8100/api/register/';
|
||||||
final http.Response response = await http.post(
|
final http.Response response = await http.post(
|
||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
@ -48,6 +52,30 @@ class AuthService{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static Future<List<dynamic>?> UserDetails(int userid) async {
|
||||||
|
List<dynamic> cats = [];
|
||||||
|
String server_url = ConstValues.currentServer();
|
||||||
|
String url = '${server_url}/api/userdetials?user_id=${userid}';
|
||||||
|
//String url = 'http://localhost:8100/api/userdetials?user_id=${userid}';
|
||||||
|
|
||||||
|
|
||||||
|
//String url = 'http://container.intranet.sumasen.net:8100/api/cats/';
|
||||||
|
print("---- cat url is ${url}");
|
||||||
|
final response = await http.get(Uri.parse(url),
|
||||||
|
headers: <String, String>{
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
|
||||||
|
cats = json.decode(utf8.decode(response.bodyBytes));
|
||||||
|
}
|
||||||
|
return cats;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,13 +2,16 @@ import 'dart:convert';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
import '../utils/const.dart';
|
||||||
|
|
||||||
|
|
||||||
class CatService{
|
class CatService{
|
||||||
|
|
||||||
static Future<List<dynamic>?> loadCats(double lat1, double lon1, double lat2, double lon2, double lat3, double lon3, double lat4, double lon4) async {
|
static Future<List<dynamic>?> loadCats(double lat1, double lon1, double lat2, double lon2, double lat3, double lon3, double lat4, double lon4) async {
|
||||||
List<dynamic> cats = [];
|
List<dynamic> cats = [];
|
||||||
//String url = 'http://container.intranet.sumasen.net:8100/api/cats/?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
String server_url = ConstValues.currentServer();
|
||||||
String url = 'http://localhost:8100/api/cats/?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
String url = '${server_url}/api/cats/?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
||||||
|
//String url = 'http://localhost:8100/api/cats/?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
||||||
|
|
||||||
|
|
||||||
//String url = 'http://container.intranet.sumasen.net:8100/api/cats/';
|
//String url = 'http://container.intranet.sumasen.net:8100/api/cats/';
|
||||||
|
|||||||
@ -4,13 +4,16 @@ import 'package:flutter_polyline_points/flutter_polyline_points.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 '../utils/const.dart';
|
||||||
|
|
||||||
|
|
||||||
class DestinationService{
|
class DestinationService{
|
||||||
|
|
||||||
static Future<List<dynamic>> getDestinations(int user_id) async {
|
static Future<List<dynamic>> getDestinations(int user_id) async {
|
||||||
List<dynamic> cats = [];
|
List<dynamic> cats = [];
|
||||||
//String url = "http://container.intranet.sumasen.net:8100/api/destinations/?user_id=${user_id}";
|
String server_url = ConstValues.currentServer();
|
||||||
String url = "http://localhost:8100/api/destinations/?user_id=${user_id}";
|
String url = "${server_url}/api/destinations/?user_id=${user_id}";
|
||||||
|
//String url = "http://localhost:8100/api/destinations/?user_id=${user_id}";
|
||||||
final http.Response response = await http.get(
|
final http.Response response = await http.get(
|
||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
@ -26,8 +29,9 @@ class DestinationService{
|
|||||||
|
|
||||||
static Future<Map<String, dynamic>> deleteDestination(int dest_id) async {
|
static Future<Map<String, dynamic>> deleteDestination(int dest_id) async {
|
||||||
Map<String, dynamic> cats = {};
|
Map<String, dynamic> cats = {};
|
||||||
//String url = "http://container.intranet.sumasen.net:8100/api/delete_destination/?dest_id=${dest_id}";
|
String server_url = ConstValues.currentServer();
|
||||||
String url = "http://localhost:8100/api/delete_destination/?dest_id=${dest_id}";
|
String url = "${server_url}/api/delete_destination/?dest_id=${dest_id}";
|
||||||
|
//String url = "http://localhost:8100/api/delete_destination/?dest_id=${dest_id}";
|
||||||
final http.Response response = await http.get(
|
final http.Response response = await http.get(
|
||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
@ -44,8 +48,9 @@ class DestinationService{
|
|||||||
|
|
||||||
static Future<int> updateOrder(int action_id, int order, String dir) async {
|
static Future<int> updateOrder(int action_id, int order, String dir) async {
|
||||||
int cats = 0;
|
int cats = 0;
|
||||||
//String url = "http://container.intranet.sumasen.net:8100/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
|
String server_url = ConstValues.currentServer();
|
||||||
String url = "http://localhost:8100/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
|
String url = "${server_url}/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
|
||||||
|
//String url = "http://localhost:8100/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
|
||||||
final http.Response response = await http.get(
|
final http.Response response = await http.get(
|
||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
|
|||||||
@ -1,14 +1,16 @@
|
|||||||
import 'package:geojson/geojson.dart';
|
import 'package:geojson/geojson.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
import '../utils/const.dart';
|
||||||
|
|
||||||
class LocationLineService{
|
class LocationLineService{
|
||||||
|
|
||||||
static Future<GeoJsonFeature?> loadLocationLines() async {
|
static Future<GeoJsonFeature?> loadLocationLines() async {
|
||||||
final geo = GeoJson();
|
final geo = GeoJson();
|
||||||
GeoJsonFeature? fs;
|
GeoJsonFeature? fs;
|
||||||
|
String server_url = ConstValues.currentServer();
|
||||||
//String url = 'http://container.intranet.sumasen.net:8100/api/location_line/';
|
String url = '${server_url}/api/location_line/';
|
||||||
String url = 'http://localhost:8100/api/location_line/';
|
//String url = 'http://localhost:8100/api/location_line/';
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
|||||||
@ -1,14 +1,17 @@
|
|||||||
import 'package:geojson/geojson.dart';
|
import 'package:geojson/geojson.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
import '../utils/const.dart';
|
||||||
|
|
||||||
class LocationPolygonervice{
|
class LocationPolygonervice{
|
||||||
|
|
||||||
static Future<GeoJsonFeature?> loadLocationLines() async {
|
static Future<GeoJsonFeature?> loadLocationLines() async {
|
||||||
final geo = GeoJson();
|
final geo = GeoJson();
|
||||||
GeoJsonFeature? fs;
|
GeoJsonFeature? fs;
|
||||||
|
|
||||||
//String url = 'http://container.intranet.sumasen.net:8100/api/location_polygon/';
|
String server_url = ConstValues.currentServer();
|
||||||
String url = 'http://localhost:8100/api/location_polygon/';
|
String url = '${server_url}/api/location_polygon/';
|
||||||
|
//String url = 'http://localhost:8100/api/location_polygon/';
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
|||||||
@ -2,12 +2,14 @@ import 'dart:convert';
|
|||||||
|
|
||||||
import 'package:geojson/geojson.dart';
|
import 'package:geojson/geojson.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:rogapp/utils/const.dart';
|
||||||
|
|
||||||
class LocationService{
|
class LocationService{
|
||||||
|
|
||||||
static Future<GeoJsonFeatureCollection?> loadLocations() async {
|
static Future<GeoJsonFeatureCollection?> loadLocations() async {
|
||||||
//String url = 'http://container.intranet.sumasen.net:8100/api/location/';
|
String server_url = ConstValues.currentServer();
|
||||||
String url = 'http://localhost:8100/api/location/';
|
String url = '${server_url}/api/location/';
|
||||||
|
//String url = 'http://localhost:8100/api/location/';
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
@ -23,13 +25,14 @@ class LocationService{
|
|||||||
|
|
||||||
static Future<GeoJsonFeatureCollection?> loadLocationsFor(String perfecture, String cat) async {
|
static Future<GeoJsonFeatureCollection?> loadLocationsFor(String perfecture, String cat) async {
|
||||||
String url = "";
|
String url = "";
|
||||||
|
String server_url = ConstValues.currentServer();
|
||||||
if(cat.isNotEmpty){
|
if(cat.isNotEmpty){
|
||||||
//url = 'http://container.intranet.sumasen.net:8100/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
url = '${server_url}/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
||||||
url = 'http://localhost:8100/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
//url = 'http://localhost:8100/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//url = 'http://container.intranet.sumasen.net:8100/api/inperf/?perf=' + perfecture;
|
url = '${server_url}/api/inperf/?perf=' + perfecture;
|
||||||
url = 'http://localhost:8100/api/inperf/?perf=' + perfecture;
|
//url = 'http://localhost:8100/api/inperf/?perf=' + perfecture;
|
||||||
}
|
}
|
||||||
//print("----- url ---- ${url} --- ${cat}");
|
//print("----- url ---- ${url} --- ${cat}");
|
||||||
//String url = 'http://localhost:8100/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
//String url = 'http://localhost:8100/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
||||||
@ -50,14 +53,15 @@ class LocationService{
|
|||||||
|
|
||||||
static Future<GeoJsonFeatureCollection?> loadLocationsSubFor(String subperfecture, String cat) async {
|
static Future<GeoJsonFeatureCollection?> loadLocationsSubFor(String subperfecture, String cat) async {
|
||||||
String url = "";
|
String url = "";
|
||||||
|
String server_url = ConstValues.currentServer();
|
||||||
if(cat.isNotEmpty){
|
if(cat.isNotEmpty){
|
||||||
//url = 'http://container.intranet.sumasen.net:8100/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
|
url = '${server_url}/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
|
||||||
url = 'http://localhost:8100/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
|
//url = 'http://localhost:8100/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
print("------ loading location in sub----");
|
print("------ loading location in sub----");
|
||||||
//url = 'http://container.intranet.sumasen.net:8100/api/insubperf?subperf=' + subperfecture;
|
url = '${server_url}/api/insubperf?subperf=' + subperfecture;
|
||||||
url = 'http://localhost:8100/api/insubperf?subperf=' + subperfecture;
|
//url = 'http://localhost:8100/api/insubperf?subperf=' + subperfecture;
|
||||||
}
|
}
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
@ -76,14 +80,15 @@ class LocationService{
|
|||||||
|
|
||||||
static Future<GeoJsonFeatureCollection?> loadLocationsBound(double lat1, double lon1, double lat2, double lon2, double lat3, double lon3, double lat4, double lon4, String cat) async {
|
static Future<GeoJsonFeatureCollection?> loadLocationsBound(double lat1, double lon1, double lat2, double lon2, double lat3, double lon3, double lat4, double lon4, String cat) async {
|
||||||
String url = "";
|
String url = "";
|
||||||
|
String server_url = ConstValues.currentServer();
|
||||||
print("cat is ----- ${cat}");
|
print("cat is ----- ${cat}");
|
||||||
if(cat.isNotEmpty){
|
if(cat.isNotEmpty){
|
||||||
//url = 'http://container.intranet.sumasen.net:8100/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&cat=' + cat;
|
url = '${server_url}/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&cat=' + cat;
|
||||||
url = 'http://localhost:8100/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&cat=' + cat;
|
//url = 'http://localhost:8100/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&cat=' + cat;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//url = 'http://container.intranet.sumasen.net:8100/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
url = '${server_url}/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
||||||
url = 'http://localhost:8100/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
//url = 'http://localhost:8100/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
||||||
}
|
}
|
||||||
print("----url --- ${url}");
|
print("----url --- ${url}");
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(Uri.parse(url),
|
||||||
@ -109,16 +114,17 @@ class LocationService{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Future<GeoJsonFeatureCollection?> loadCustomLocations(String cat) async {
|
static Future<GeoJsonFeatureCollection?> loadCustomLocations(String name, String cat) async {
|
||||||
String url = "";
|
String url = "";
|
||||||
|
String server_url = ConstValues.currentServer();
|
||||||
print("cat is ----- ${cat}");
|
print("cat is ----- ${cat}");
|
||||||
if(cat.isNotEmpty){
|
if(cat.isNotEmpty){
|
||||||
//url = 'http://container.intranet.sumasen.net:8100/api/custom_area/?&cat=' + cat;
|
url = '${server_url}/api/custom_area/?&cat=' + cat;
|
||||||
url = 'http://localhost:8100/api/custom_area/?&cat=' + cat;
|
//url = 'http://localhost:8100/api/customarea?name=${name}&cat=' + cat;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//url = 'http://container.intranet.sumasen.net:8100/api/custom_area/';
|
url = '${server_url}/api/customarea?name=${name}&';
|
||||||
url = 'http://localhost:8100/api/custom_area/';
|
//url = 'http://localhost:8100/api/customarea?name=${name}&';
|
||||||
}
|
}
|
||||||
print("----url --- ${url}");
|
print("----url --- ${url}");
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(Uri.parse(url),
|
||||||
|
|||||||
@ -1,13 +1,15 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:rogapp/utils/const.dart';
|
||||||
|
|
||||||
|
|
||||||
class PerfectureService{
|
class PerfectureService{
|
||||||
|
|
||||||
static Future<List<dynamic>?> loadPerfectures() async {
|
static Future<List<dynamic>?> loadPerfectures() async {
|
||||||
List<dynamic> perfs = [];
|
List<dynamic> perfs = [];
|
||||||
//String url = 'http://container.intranet.sumasen.net:8100/api/perf_main/';
|
String server_url = ConstValues.currentServer();
|
||||||
String url = 'http://localhost:8100/api/perf_main/';
|
String url = '${server_url}/api/perf_main/';
|
||||||
|
//String url = 'http://localhost:8100/api/perf_main/';
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
@ -23,8 +25,9 @@ class PerfectureService{
|
|||||||
|
|
||||||
static Future<List<dynamic>?> loadSubPerfectures(String area) async {
|
static Future<List<dynamic>?> loadSubPerfectures(String area) async {
|
||||||
List<dynamic> perfs = [];
|
List<dynamic> perfs = [];
|
||||||
//String url = 'http://container.intranet.sumasen.net:8100/api/subperfinmain/?perf=' + sub;
|
String server_url = ConstValues.currentServer();
|
||||||
String url = 'http://localhost:8100/api/subperfinmain/?area=' + area;
|
String url = '${server_url}/api/subperfinmain/?area=' + area;
|
||||||
|
//String url = 'http://localhost:8100/api/subperfinmain/?area=' + area;
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
@ -41,8 +44,9 @@ class PerfectureService{
|
|||||||
|
|
||||||
static Future<List<dynamic>?> getMainPerfExt(String id) async {
|
static Future<List<dynamic>?> getMainPerfExt(String id) async {
|
||||||
List<dynamic> perfs = [];
|
List<dynamic> perfs = [];
|
||||||
//String url = 'http://container.intranet.sumasen.net:8100/api/mainperfext/?perf=' + id;
|
String server_url = ConstValues.currentServer();
|
||||||
String url = 'http://localhost:8100/api/mainperfext/?perf=' + id;
|
String url = '${server_url}/api/mainperfext/?perf=' + id;
|
||||||
|
//String url = 'http://localhost:8100/api/mainperfext/?perf=' + id;
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
@ -58,8 +62,27 @@ class PerfectureService{
|
|||||||
|
|
||||||
static Future<List<dynamic>?> loadGifuAreas(String perf) async {
|
static Future<List<dynamic>?> loadGifuAreas(String perf) async {
|
||||||
List<dynamic> perfs = [];
|
List<dynamic> perfs = [];
|
||||||
//String url = 'http://container.intranet.sumasen.net:8100/api/allgifuareas/?perf' + perf;
|
String server_url = ConstValues.currentServer();
|
||||||
String url = 'http://localhost:8100/api/allgifuareas/?perf=' + perf;
|
String url = '${server_url}/api/allgifuareas/?perf=' + perf;
|
||||||
|
//String url = 'http://localhost:8100/api/allgifuareas/?perf=' + perf;
|
||||||
|
final response = await http.get(Uri.parse(url),
|
||||||
|
headers: <String, String>{
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
|
||||||
|
perfs = json.decode(utf8.decode(response.bodyBytes));
|
||||||
|
}
|
||||||
|
return perfs;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<List<dynamic>?> loadCustomAreas() async {
|
||||||
|
List<dynamic> perfs = [];
|
||||||
|
String server_url = ConstValues.currentServer();
|
||||||
|
String url = '${server_url}/api/customareanames';
|
||||||
|
//String url = 'http://localhost:8100/api/customareanames';
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
@ -76,8 +99,9 @@ class PerfectureService{
|
|||||||
|
|
||||||
static Future<List<dynamic>?> getSubExt(String id) async {
|
static Future<List<dynamic>?> getSubExt(String id) async {
|
||||||
List<dynamic> perfs = [];
|
List<dynamic> perfs = [];
|
||||||
//String url = 'http://container.intranet.sumasen.net:8100/api/perfext/?sub_perf=' + id;
|
String server_url = ConstValues.currentServer();
|
||||||
String url = 'http://localhost:8100/api/perfext/?sub_perf=' + id;
|
String url = '${server_url}/api/perfext/?sub_perf=' + id;
|
||||||
|
//String url = 'http://localhost:8100/api/perfext/?sub_perf=' + id;
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
|||||||
34
lib/services/reacking_service.dart
Normal file
34
lib/services/reacking_service.dart
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:rogapp/utils/const.dart';
|
||||||
|
|
||||||
|
|
||||||
|
class TrackingService {
|
||||||
|
|
||||||
|
static Future<Map<String, dynamic>> addTrack(String user_id, double lat, double lon) async {
|
||||||
|
Map<String, dynamic> cats = {};
|
||||||
|
String server_url = ConstValues.currentServer();
|
||||||
|
String url = '${server_url}/api/track/';
|
||||||
|
//String url = 'http://localhost:8100/api/track/';
|
||||||
|
final geom = '{"type": "MULTIPOINT", "coordinates": [[${lon}, ${lat}]]}';
|
||||||
|
final http.Response response = await http.post(
|
||||||
|
Uri.parse(url),
|
||||||
|
headers: <String, String>{
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
},
|
||||||
|
body: jsonEncode(<String, String>{
|
||||||
|
'user_id': user_id,
|
||||||
|
'geom': geom
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
cats = json.decode(utf8.decode(response.bodyBytes));
|
||||||
|
}
|
||||||
|
return cats;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
12
lib/utils/const.dart
Normal file
12
lib/utils/const.dart
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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.100:8100";
|
||||||
|
|
||||||
|
static String currentServer(){
|
||||||
|
return dev_ip_server;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,6 +3,7 @@ import 'dart:io';
|
|||||||
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:image_picker/image_picker.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';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
@ -207,7 +208,17 @@ class BottomSheetWidget extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
indexController.currentAction[0][0]["wanttogo"] == false ?
|
indexController.rog_mode == 0 ?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Row(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
indexController.currentAction[0][0]["wanttogo"] == false ?
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: (){
|
onPressed: (){
|
||||||
if(indexController.currentAction.isNotEmpty){
|
if(indexController.currentAction.isNotEmpty){
|
||||||
@ -277,21 +288,49 @@ class BottomSheetWidget extends StatelessWidget {
|
|||||||
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
:
|
||||||
|
Container(width: 0, height: 0,),
|
||||||
|
indexController.rog_mode == 1 ?
|
||||||
indexController.currentAction[0][0]["checkin"] == false ?
|
indexController.currentAction[0][0]["checkin"] == false ?
|
||||||
ElevatedButton(
|
Column(
|
||||||
onPressed: (){
|
children: [
|
||||||
if(indexController.currentAction.isNotEmpty){
|
Row(
|
||||||
print(indexController.currentAction[0]);
|
mainAxisSize: MainAxisSize.max,
|
||||||
indexController.currentAction[0][0]["checkin"] = true;
|
children: [
|
||||||
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
ElevatedButton(
|
||||||
indexController.currentAction.clear();
|
child: Text("Image"), onPressed: (){
|
||||||
print("---temp---${temp}");
|
final ImagePicker _picker = ImagePicker();
|
||||||
indexController.currentAction.add([temp]);
|
_picker.pickImage(source: ImageSource.camera).then((value){
|
||||||
}
|
print("----- image---- ${value!.path}");
|
||||||
indexController.makeAction(context);
|
});
|
||||||
},
|
},
|
||||||
child: Text("checkin".tr)
|
)
|
||||||
) :
|
],
|
||||||
|
),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: (){
|
||||||
|
if(indexController.currentAction.isNotEmpty){
|
||||||
|
print(indexController.currentAction[0]);
|
||||||
|
indexController.currentAction[0][0]["checkin"] = true;
|
||||||
|
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
||||||
|
indexController.currentAction.clear();
|
||||||
|
print("---temp---${temp}");
|
||||||
|
indexController.currentAction.add([temp]);
|
||||||
|
}
|
||||||
|
indexController.makeAction(context);
|
||||||
|
},
|
||||||
|
child: Text("checkin".tr)
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
:
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: (){
|
onPressed: (){
|
||||||
if(indexController.currentAction.isNotEmpty){
|
if(indexController.currentAction.isNotEmpty){
|
||||||
@ -309,7 +348,8 @@ class BottomSheetWidget extends StatelessWidget {
|
|||||||
Icons.favorite, color: Colors.red)
|
Icons.favorite, color: Colors.red)
|
||||||
|
|
||||||
,
|
,
|
||||||
)
|
):
|
||||||
|
Container(width: 0, height: 0,),
|
||||||
],
|
],
|
||||||
): Row(
|
): Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import 'dart:ffi';
|
import 'dart:ffi';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:geojson/geojson.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
|
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||||
import 'package:timeline_tile/timeline_tile.dart';
|
import 'package:timeline_tile/timeline_tile.dart';
|
||||||
|
|
||||||
class DestinationWidget extends StatelessWidget {
|
class DestinationWidget extends StatelessWidget {
|
||||||
@ -110,6 +112,25 @@ class DestinationWidget extends StatelessWidget {
|
|||||||
minHeight: 80,
|
minHeight: 80,
|
||||||
),
|
),
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
|
onTap: () async {
|
||||||
|
{
|
||||||
|
double lat = destinationController.destinations[index]["location"]["geometry"]["coordinates"][0][1] as double;
|
||||||
|
double lon = destinationController.destinations[index]["location"]["geometry"]["coordinates"][0][0] as double;
|
||||||
|
GeoJsonFeature? fs = await destinationController.getDEstinationForLatLong(lat, lon);
|
||||||
|
print("----fsf-----${fs}");
|
||||||
|
if(fs != null){
|
||||||
|
if(indexController.currentFeature.length > 0) {
|
||||||
|
indexController.currentFeature.clear();
|
||||||
|
}
|
||||||
|
indexController.currentFeature.add(fs);
|
||||||
|
indexController.getAction();
|
||||||
|
|
||||||
|
showModalBottomSheet(context: context, isScrollControlled: true,
|
||||||
|
builder:((context) => BottomSheetWidget())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
onLongPress: (){
|
onLongPress: (){
|
||||||
print("#### long press #### ${destinationController.destination_index_data.length}");
|
print("#### long press #### ${destinationController.destination_index_data.length}");
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,14 @@ class PerfectureWidget extends StatefulWidget {
|
|||||||
class _PerfectureWidgetState extends State<PerfectureWidget> {
|
class _PerfectureWidgetState extends State<PerfectureWidget> {
|
||||||
|
|
||||||
|
|
||||||
|
bool isNumeric(String s) {
|
||||||
|
if (s == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return double.tryParse(s) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
List<DropdownMenuItem<String>> getDropdownItems() {
|
List<DropdownMenuItem<String>> getDropdownItems() {
|
||||||
List<DropdownMenuItem<String>> dropDownItems = [];
|
List<DropdownMenuItem<String>> dropDownItems = [];
|
||||||
|
|
||||||
@ -64,7 +72,22 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
|
|||||||
|
|
||||||
dropDownItems.add(newDropdown);
|
dropDownItems.add(newDropdown);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(widget.indexController.customAreas.isNotEmpty){
|
||||||
|
|
||||||
|
for (Map<String, dynamic> currency in widget.indexController.customAreas[0]) {
|
||||||
|
var newDropdown = DropdownMenuItem(
|
||||||
|
child: Text(currency["event_name"].toString()),
|
||||||
|
value: currency["event_name"].toString(),
|
||||||
|
);
|
||||||
|
|
||||||
|
dropDownItems.add(newDropdown);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return dropDownItems;
|
return dropDownItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +117,7 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
|
|||||||
items: getDropdownItems()
|
items: getDropdownItems()
|
||||||
),
|
),
|
||||||
|
|
||||||
// Custom events area
|
// Gifu areas
|
||||||
widget.indexController.areas.isNotEmpty ?
|
widget.indexController.areas.isNotEmpty ?
|
||||||
DropdownButton<String>(
|
DropdownButton<String>(
|
||||||
value: widget.indexController.areaDropdownValue,
|
value: widget.indexController.areaDropdownValue,
|
||||||
@ -107,10 +130,17 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
|
|||||||
color: Colors.deepPurpleAccent,
|
color: Colors.deepPurpleAccent,
|
||||||
),
|
),
|
||||||
onChanged: (String? newValue) {
|
onChanged: (String? newValue) {
|
||||||
|
if (isNumeric(newValue!)){
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
widget.indexController.loadCustomLocation(newValue);
|
||||||
|
}
|
||||||
setState(() {
|
setState(() {
|
||||||
if(newValue != null){
|
if(newValue != null){
|
||||||
widget.indexController.is_loading.value = true;
|
widget.indexController.is_loading.value = true;
|
||||||
widget.indexController.populateForCustomArea(newValue, widget.mapController);
|
widget.indexController.areaDropdownValue = newValue;
|
||||||
|
widget.indexController.populateSubPerForArea(newValue, widget.mapController);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@ -62,6 +62,7 @@ dependencies:
|
|||||||
flutter_breadcrumb: ^1.0.1
|
flutter_breadcrumb: ^1.0.1
|
||||||
timeline_tile: ^2.0.0
|
timeline_tile: ^2.0.0
|
||||||
google_maps_flutter: ^2.1.5
|
google_maps_flutter: ^2.1.5
|
||||||
|
#flutter_map_marker_popup: any
|
||||||
flutter_polyline_points: ^1.0.0
|
flutter_polyline_points: ^1.0.0
|
||||||
google_maps_webservice: ^0.0.19
|
google_maps_webservice: ^0.0.19
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user