Compare commits
2 Commits
74f6a79a36
...
rog3
| Author | SHA1 | Date | |
|---|---|---|---|
| e9bf50fc14 | |||
| 244b7eb9ac |
@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
|
||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||
|
||||
android {
|
||||
compileSdkVersion flutter.compileSdkVersion
|
||||
compileSdkVersion 33
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
|
||||
@ -3,15 +3,24 @@ import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:rogapp/pages/index/index_binding.dart';
|
||||
import 'package:rogapp/pages/rog/rog_binding.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:rogapp/services/location_service.dart';
|
||||
import 'package:rogapp/utils/app_binding.dart';
|
||||
import 'package:rogapp/utils/string_values.dart';
|
||||
|
||||
void main() {
|
||||
//WidgetsFlutterBinding.ensureInitialized();
|
||||
initServices();
|
||||
runApp(MyApp());
|
||||
}
|
||||
|
||||
void initServices() async {
|
||||
print('starting services ...');
|
||||
await Get.putAsync(() => LocationService().init());
|
||||
print('All services started...');
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
// This widget is the root of your application.
|
||||
@ -32,8 +41,8 @@ class MyApp extends StatelessWidget {
|
||||
opaqueRoute: Get.isOpaqueRouteDefault,
|
||||
popGesture: Get.isPopGestureEnable,
|
||||
transitionDuration: const Duration(milliseconds: 230),
|
||||
initialBinding: IndexBinding(), //HomeBinding(),
|
||||
initialRoute: AppPages.PERMISSION,
|
||||
initialBinding: RogBinding(), //HomeBinding(),
|
||||
initialRoute: AppPages.ROG,
|
||||
getPages: AppPages.routes,
|
||||
enableLog: true,
|
||||
);
|
||||
|
||||
@ -1,93 +1,93 @@
|
||||
|
||||
|
||||
class Destination {
|
||||
String? name;
|
||||
String? address;
|
||||
String? phone;
|
||||
String? email;
|
||||
String? webcontents;
|
||||
String? videos;
|
||||
String? category;
|
||||
int? series;
|
||||
double? lat;
|
||||
double? lon;
|
||||
int? location_id;
|
||||
int? list_order;
|
||||
String? photos;
|
||||
double? checkin_radious;
|
||||
int? auto_checkin;
|
||||
bool? selected = false;
|
||||
bool? checkedin = false;
|
||||
// class Destination {
|
||||
// String? name;
|
||||
// String? address;
|
||||
// String? phone;
|
||||
// String? email;
|
||||
// String? webcontents;
|
||||
// String? videos;
|
||||
// String? category;
|
||||
// int? series;
|
||||
// double? lat;
|
||||
// double? lon;
|
||||
// int? location_id;
|
||||
// int? list_order;
|
||||
// String? photos;
|
||||
// double? checkin_radious;
|
||||
// int? auto_checkin;
|
||||
// bool? selected = false;
|
||||
// bool? checkedin = false;
|
||||
|
||||
Destination({
|
||||
this.name,
|
||||
this.address,
|
||||
this.phone,
|
||||
this.email,
|
||||
this.webcontents,
|
||||
this.videos,
|
||||
this.category,
|
||||
this.series,
|
||||
this.lat,
|
||||
this.lon,
|
||||
this.location_id,
|
||||
this.list_order,
|
||||
this.photos,
|
||||
this.checkin_radious,
|
||||
this.auto_checkin,
|
||||
this.selected,
|
||||
this.checkedin
|
||||
});
|
||||
// Destination({
|
||||
// this.name,
|
||||
// this.address,
|
||||
// this.phone,
|
||||
// this.email,
|
||||
// this.webcontents,
|
||||
// this.videos,
|
||||
// this.category,
|
||||
// this.series,
|
||||
// this.lat,
|
||||
// this.lon,
|
||||
// this.location_id,
|
||||
// this.list_order,
|
||||
// this.photos,
|
||||
// this.checkin_radious,
|
||||
// this.auto_checkin,
|
||||
// this.selected,
|
||||
// this.checkedin
|
||||
// });
|
||||
|
||||
factory Destination.fromMap(Map<String, dynamic> json) {
|
||||
// factory Destination.fromMap(Map<String, dynamic> json) {
|
||||
|
||||
bool selec = json['selected'] == 0 ? false : true;
|
||||
bool checkin = json['checkedin'] == 0 ? false : true;
|
||||
// bool selec = json['selected'] == 0 ? false : true;
|
||||
// bool checkin = json['checkedin'] == 0 ? false : true;
|
||||
|
||||
return Destination(
|
||||
name: json['name'],
|
||||
address: json['address'],
|
||||
phone: json['phone'],
|
||||
email: json['email'],
|
||||
webcontents: json['webcontents'],
|
||||
videos: json['videos'],
|
||||
category: json['category'],
|
||||
series: json['series'],
|
||||
lat: json['lat'],
|
||||
lon: json['lon'],
|
||||
location_id: json['location_id'],
|
||||
list_order: json['list_order'],
|
||||
photos: json['photos'],
|
||||
checkin_radious: json['checkin_radious'],
|
||||
auto_checkin:json['auto_checkin'],
|
||||
selected: selec,
|
||||
checkedin: checkin
|
||||
);
|
||||
}
|
||||
// return Destination(
|
||||
// name: json['name'],
|
||||
// address: json['address'],
|
||||
// phone: json['phone'],
|
||||
// email: json['email'],
|
||||
// webcontents: json['webcontents'],
|
||||
// videos: json['videos'],
|
||||
// category: json['category'],
|
||||
// series: json['series'],
|
||||
// lat: json['lat'],
|
||||
// lon: json['lon'],
|
||||
// location_id: json['location_id'],
|
||||
// list_order: json['list_order'],
|
||||
// photos: json['photos'],
|
||||
// checkin_radious: json['checkin_radious'],
|
||||
// auto_checkin:json['auto_checkin'],
|
||||
// selected: selec,
|
||||
// checkedin: checkin
|
||||
// );
|
||||
// }
|
||||
|
||||
Map<String, dynamic> toMap(){
|
||||
int sel = selected == false ? 0 : 1;
|
||||
int check = checkedin == false ? 0 : 1;
|
||||
return {
|
||||
'name':name,
|
||||
'address': address,
|
||||
'phone': phone,
|
||||
'email': email,
|
||||
'webcontents': webcontents,
|
||||
'videos': videos,
|
||||
'category':category,
|
||||
'series':series,
|
||||
'lat':lat,
|
||||
'lon':lon,
|
||||
'location_id':location_id,
|
||||
'list_order':list_order,
|
||||
'photos':photos,
|
||||
'checkin_radious': checkin_radious,
|
||||
'auto_checkin': auto_checkin,
|
||||
'selected': sel,
|
||||
'checkedin': check
|
||||
};
|
||||
}
|
||||
// Map<String, dynamic> toMap(){
|
||||
// int sel = selected == false ? 0 : 1;
|
||||
// int check = checkedin == false ? 0 : 1;
|
||||
// return {
|
||||
// 'name':name,
|
||||
// 'address': address,
|
||||
// 'phone': phone,
|
||||
// 'email': email,
|
||||
// 'webcontents': webcontents,
|
||||
// 'videos': videos,
|
||||
// 'category':category,
|
||||
// 'series':series,
|
||||
// 'lat':lat,
|
||||
// 'lon':lon,
|
||||
// 'location_id':location_id,
|
||||
// 'list_order':list_order,
|
||||
// 'photos':photos,
|
||||
// 'checkin_radious': checkin_radious,
|
||||
// 'auto_checkin': auto_checkin,
|
||||
// 'selected': sel,
|
||||
// 'checkedin': check
|
||||
// };
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
// }
|
||||
307
lib/model/location.dart
Normal file
307
lib/model/location.dart
Normal file
@ -0,0 +1,307 @@
|
||||
|
||||
|
||||
import 'package:geojson_vi/geojson_vi.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
|
||||
class Location {
|
||||
int? location_id;
|
||||
String? location_name;
|
||||
String? category;
|
||||
String? zip;
|
||||
String? address;
|
||||
String? prefecture;
|
||||
String? area;
|
||||
String? city;
|
||||
double? latitude;
|
||||
double? longitude;
|
||||
String? photos;
|
||||
String? videos;
|
||||
String? webcontents;
|
||||
String? status;
|
||||
String? portal;
|
||||
String? group;
|
||||
String? phone;
|
||||
String? fax;
|
||||
String? email;
|
||||
String? facility;
|
||||
String? remark;
|
||||
String? tags;
|
||||
String? event_name;
|
||||
bool? event_active;
|
||||
bool? hidden_location;
|
||||
bool? auto_checkin;
|
||||
int? checkin_radius;
|
||||
int? checkin_point;
|
||||
int? buy_point;
|
||||
String? evaluation_value;
|
||||
bool? shop_closed;
|
||||
bool? shop_shutdown;
|
||||
String? opening_hours_mon;
|
||||
String? opening_hours_tue;
|
||||
String? opening_hours_wed;
|
||||
String? opening_hours_thu;
|
||||
String? opening_hours_fri;
|
||||
String? opening_hours_sat;
|
||||
String? opening_hours_sun;
|
||||
String? parammeters;
|
||||
DateTime? created_at;
|
||||
LatLng? geometry;
|
||||
GeoJSONGeometry? multipoint;
|
||||
|
||||
Location({
|
||||
this.location_id,
|
||||
this.location_name,
|
||||
this.category,
|
||||
this.zip,
|
||||
this.address,
|
||||
this.prefecture,
|
||||
this.area,
|
||||
this.city,
|
||||
this.latitude,
|
||||
this.longitude,
|
||||
this.photos,
|
||||
this.videos,
|
||||
this.webcontents,
|
||||
this.status,
|
||||
this.portal,
|
||||
this.group,
|
||||
this.phone,
|
||||
this.fax,
|
||||
this.email,
|
||||
this.facility,
|
||||
this.remark,
|
||||
this.tags,
|
||||
this.event_name,
|
||||
this.event_active,
|
||||
this.hidden_location,
|
||||
this.auto_checkin,
|
||||
this.checkin_radius,
|
||||
this.checkin_point,
|
||||
this.buy_point,
|
||||
this.evaluation_value,
|
||||
this.shop_closed,
|
||||
this.shop_shutdown,
|
||||
this.opening_hours_mon,
|
||||
this.opening_hours_tue,
|
||||
this.opening_hours_wed,
|
||||
this.opening_hours_thu,
|
||||
this.opening_hours_fri,
|
||||
this.opening_hours_sat,
|
||||
this.opening_hours_sun,
|
||||
this.parammeters,
|
||||
this.created_at,
|
||||
this.geometry,
|
||||
this.multipoint,
|
||||
|
||||
});
|
||||
|
||||
factory Location.fromMap(Map<String, dynamic> json){
|
||||
bool is_event_active = json['event_active'] == 0 ? false : true;
|
||||
bool is_hidden_location = json['hidden_location'] == 0 ? false : true;
|
||||
bool is_auto_checkin = json['auto_checkin'] == 0 ? false : true;
|
||||
bool is_shop_closed = json['shop_closed'] == 0 ? false : true;
|
||||
bool is_shop_shutdown = json['shop_shutdown'] == 0 ? false : true;
|
||||
|
||||
return Location(
|
||||
location_id: json['location_id'],
|
||||
location_name: json['location_name'],
|
||||
category: json['category'],
|
||||
zip: json['zip'],
|
||||
address: json['address'],
|
||||
prefecture: json['prefecture'],
|
||||
area: json['area'],
|
||||
city: json['city'],
|
||||
latitude: json['latitude'],
|
||||
longitude: json['longitude'],
|
||||
photos: json['photos'],
|
||||
videos: json['videos'],
|
||||
webcontents: json['webcontents'],
|
||||
status: json['status'],
|
||||
portal: json['portal'],
|
||||
group: json['group'],
|
||||
phone: json['phone'],
|
||||
fax: json['fax'],
|
||||
email: json['email'],
|
||||
facility: json['facility'],
|
||||
remark: json['remark'],
|
||||
tags: json['tags'],
|
||||
event_name: json['event_name'],
|
||||
event_active: is_event_active,
|
||||
hidden_location: is_hidden_location,
|
||||
auto_checkin: is_auto_checkin,
|
||||
checkin_radius: json['checkin_radius'],
|
||||
checkin_point: json['checkin_point'],
|
||||
buy_point: json['buy_point'],
|
||||
evaluation_value: json['evaluation_value'],
|
||||
shop_closed: is_shop_closed,
|
||||
shop_shutdown: is_shop_shutdown,
|
||||
opening_hours_mon: json['opening_hours_mon'],
|
||||
opening_hours_tue: json['opening_hours_tue'],
|
||||
opening_hours_wed: json['opening_hours_wed'],
|
||||
opening_hours_thu: json['opening_hours_thu'],
|
||||
opening_hours_fri: json['opening_hours_fri'],
|
||||
opening_hours_sat: json['opening_hours_sat'],
|
||||
opening_hours_sun: json['opening_hours_sun'],
|
||||
parammeters: json['parammeters']
|
||||
);
|
||||
}
|
||||
|
||||
factory Location.fromGeoJSONFeture(GeoJSONFeature feature){
|
||||
|
||||
GeoJSONMultiPoint geom = feature.geometry as GeoJSONMultiPoint;
|
||||
LatLng geomVal = LatLng(geom.coordinates[0][1], geom.coordinates[0][0]);
|
||||
|
||||
return Location(
|
||||
location_id: feature.properties!["location_id"],
|
||||
location_name: feature.properties!["location_name"],
|
||||
category: feature.properties!["category"],
|
||||
zip: feature.properties!["zip"],
|
||||
address: feature.properties!["address"],
|
||||
prefecture: feature.properties!["prefecture"],
|
||||
area: feature.properties!["area"],
|
||||
city: feature.properties!["city"],
|
||||
latitude: feature.properties!["latitude"],
|
||||
longitude: feature.properties!["longitude"],
|
||||
phone: feature.properties!["phone"],
|
||||
videos: feature.properties!["videos"],
|
||||
webcontents: feature.properties!["webcontents"],
|
||||
status: feature.properties!["status"],
|
||||
portal: feature.properties!["portal"],
|
||||
group: feature.properties!["group"],
|
||||
photos: feature.properties!["photos"],
|
||||
fax: feature.properties!["fax"],
|
||||
email: feature.properties!["email"],
|
||||
facility: feature.properties!["facility"],
|
||||
remark: feature.properties!["remark"],
|
||||
tags: feature.properties!["tags"],
|
||||
event_name: feature.properties!["event_name"],
|
||||
event_active: feature.properties!["event_active"],
|
||||
hidden_location: feature.properties!["hidden_location"],
|
||||
auto_checkin: feature.properties!["auto_checkin"],
|
||||
checkin_radius: feature.properties!["checkin_radius"],
|
||||
checkin_point: feature.properties!["checkin_point"],
|
||||
buy_point: feature.properties!["buy_point"],
|
||||
evaluation_value: feature.properties!["evaluation_value"],
|
||||
shop_closed: feature.properties!["shop_closed"],
|
||||
shop_shutdown: feature.properties!["shop_shutdown"],
|
||||
opening_hours_mon: feature.properties!["opening_hours_mon"],
|
||||
opening_hours_tue: feature.properties!["opening_hours_tue"],
|
||||
opening_hours_wed: feature.properties!["opening_hours_wed"],
|
||||
opening_hours_thu: feature.properties!["opening_hours_thu"],
|
||||
opening_hours_fri: feature.properties!["opening_hours_fri"],
|
||||
opening_hours_sat: feature.properties!["opening_hours_sat"],
|
||||
opening_hours_sun: feature.properties!["opening_hours_sun"],
|
||||
parammeters: feature.properties!["parammeters"],
|
||||
created_at: DateTime.parse(feature.properties!["created_at"]),
|
||||
geometry: geomVal,
|
||||
multipoint: feature.geometry
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap(){
|
||||
int is_active = event_active == false ? 0 : 1;
|
||||
int is_hidden = hidden_location == false ? 0 : 1;
|
||||
int is_auto = auto_checkin == false ? 0 : 1;
|
||||
int is_closed = shop_closed == false ? 0 : 1;
|
||||
int is_shuldown = shop_shutdown == false ? 0 : 1;
|
||||
|
||||
return {
|
||||
'location_id': location_id,
|
||||
'location_name': location_name,
|
||||
'category': category,
|
||||
'zip': zip,
|
||||
'address': address,
|
||||
'prefecture': prefecture,
|
||||
'area': area,
|
||||
'city': city,
|
||||
'latitude': latitude,
|
||||
'longitude': longitude,
|
||||
'phone': phone,
|
||||
'videos': videos,
|
||||
'webcontents': webcontents,
|
||||
'status': status,
|
||||
'portal': portal,
|
||||
'group': group,
|
||||
'photos':photos,
|
||||
'fax': fax,
|
||||
'email': email,
|
||||
'facility': facility,
|
||||
'remark': remark,
|
||||
'tags': tags,
|
||||
'event_name': event_name,
|
||||
'event_active': event_active,
|
||||
'hidden_location': hidden_location,
|
||||
'auto_checkin': auto_checkin,
|
||||
'checkin_radius': checkin_radius,
|
||||
'checkin_point': checkin_point,
|
||||
'buy_point': buy_point,
|
||||
'evaluation_value': evaluation_value,
|
||||
'shop_closed': shop_closed,
|
||||
'shop_shutdown': shop_shutdown,
|
||||
'opening_hours_mon': opening_hours_mon,
|
||||
'opening_hours_tue': opening_hours_tue,
|
||||
'opening_hours_wed': opening_hours_wed,
|
||||
'opening_hours_thu': opening_hours_thu,
|
||||
'opening_hours_fri': opening_hours_fri,
|
||||
'opening_hours_sat': opening_hours_sat,
|
||||
'opening_hours_sun': opening_hours_sun,
|
||||
'parammeters': parammeters
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
GeoJSONFeature toGeoFeature(){
|
||||
|
||||
GeoJSONMultiPoint geom = multipoint as GeoJSONMultiPoint;
|
||||
|
||||
return GeoJSONFeature(
|
||||
geom,
|
||||
properties: {
|
||||
'location_id': location_id,
|
||||
'location_name': location_name,
|
||||
'category': category,
|
||||
'zip': zip,
|
||||
'address': address,
|
||||
'prefecture': prefecture,
|
||||
'area': area,
|
||||
'city': city,
|
||||
'latitude': latitude,
|
||||
'longitude': longitude,
|
||||
'phone': phone,
|
||||
'videos': videos,
|
||||
'webcontents': webcontents,
|
||||
'status': status,
|
||||
'portal': portal,
|
||||
'group': group,
|
||||
'photos':photos,
|
||||
'fax': fax,
|
||||
'email': email,
|
||||
'facility': facility,
|
||||
'remark': remark,
|
||||
'tags': tags,
|
||||
'event_name': event_name,
|
||||
'event_active': event_active,
|
||||
'hidden_location': hidden_location,
|
||||
'auto_checkin': auto_checkin,
|
||||
'checkin_radius': checkin_radius,
|
||||
'checkin_point': checkin_point,
|
||||
'buy_point': buy_point,
|
||||
'evaluation_value': evaluation_value,
|
||||
'shop_closed': shop_closed,
|
||||
'shop_shutdown': shop_shutdown,
|
||||
'opening_hours_mon': opening_hours_mon,
|
||||
'opening_hours_tue': opening_hours_tue,
|
||||
'opening_hours_wed': opening_hours_wed,
|
||||
'opening_hours_thu': opening_hours_thu,
|
||||
'opening_hours_fri': opening_hours_fri,
|
||||
'opening_hours_sat': opening_hours_sat,
|
||||
'opening_hours_sun': opening_hours_sun,
|
||||
'parammeters': parammeters,
|
||||
'created_at': created_at,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
|
||||
class DestinationBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.put<DestinationController>(DestinationController());
|
||||
}
|
||||
}
|
||||
@ -1,354 +0,0 @@
|
||||
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:rogapp/services/destination_service.dart';
|
||||
import 'package:rogapp/services/maxtrix_service.dart';
|
||||
import 'package:rogapp/services/reacking_service.dart';
|
||||
import 'package:rogapp/utils/database_helper.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
|
||||
class DestinationController extends GetxController {
|
||||
|
||||
late LocationSettings locationSettings;
|
||||
|
||||
var destinationCount = 0.obs;
|
||||
List<Destination> destinations = <Destination>[].obs;
|
||||
List<Map<String, dynamic>> destination_index_data = <Map<String, dynamic>>[].obs;
|
||||
|
||||
List<Destination> currentSelectedDestinations = <Destination>[].obs;
|
||||
|
||||
bool checking_in = false;
|
||||
List<bool> isSelected = [true].obs;
|
||||
BuildContext? context;
|
||||
|
||||
List<String> gps = <String>["-- stating --"].obs;
|
||||
List<String> locationPermission = <String>[" -- starting -- "].obs;
|
||||
|
||||
|
||||
Map<String, dynamic> matrix = {};
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
|
||||
Future<Destination?> getDEstinationForLatLong(double lat, double long)async {
|
||||
|
||||
String jjjj = '{"id":1,"type":"Feature","geometry":{"type":"MultiPoint","coordinates":[[136.731357,35.370094]]},"properties":{"location_id":915101,"location_name":"柳津","category":"買い物","zip":"〒501-6100","address":"柳津町字仙右城7696-1"}}';
|
||||
|
||||
for(final d in destinations){
|
||||
// var geom = d["location"]["geometry"];
|
||||
// var props = d["location"]["properties"];
|
||||
// print("--props- ${d["location"]["geometry"]["coordinates"][0][1]}");
|
||||
// List<dynamic> geom_multi = [geom];
|
||||
// Map<String, dynamic> final_geom = {"features":[{"id":d["id"],"type":"Feature", "geometry": geom, "properties": props}]};
|
||||
// //print("----- geom : ${final_geom}");
|
||||
|
||||
// String js = json.encode(final_geom);
|
||||
// //print("---features-- ${js}-----");
|
||||
// GeoJsonFeatureCollection features = await featuresFromGeoJson(js);
|
||||
// GeoJsonMultiPoint p = features.collection[0].geometry as GeoJsonMultiPoint;
|
||||
if(lat == d.lat && long == d.lon){
|
||||
return d;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkForCheckin(double la, double ln){
|
||||
|
||||
for(final d in destinations){
|
||||
|
||||
if(!checking_in)
|
||||
{
|
||||
checking_in = true;
|
||||
double lat = d.lat!;
|
||||
double lon = d.lon!;
|
||||
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!.checkin_radious ?? double.infinity;
|
||||
bool auto_checkin = value.auto_checkin == 0 ? false : true;
|
||||
|
||||
indexController.currentDestinationFeature.add(value);
|
||||
//indexController.getAction();
|
||||
|
||||
|
||||
if(rad >= dist){
|
||||
if(auto_checkin){
|
||||
makeCheckin(value, true);
|
||||
}
|
||||
else{
|
||||
// showModalBottomSheet(context: Get.context!, isScrollControlled: true,
|
||||
// builder:((context) => BottomSheetWidget())
|
||||
// ).whenComplete((){
|
||||
// checking_in = false;
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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;
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void makeCheckin(Destination destination, bool action) async {
|
||||
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${action}@@@@@@@@@@@");
|
||||
DatabaseHelper db = DatabaseHelper.instance;
|
||||
int res = await db.updateAction(destination, action);
|
||||
|
||||
List<Destination> ddd = await db.getDestinationByLatLon(destination.lat!, destination.lon!);
|
||||
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ddddd ${ddd[0].checkedin} @@@@@@@@@@@");
|
||||
|
||||
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${res}@@@@@@@@@@@");
|
||||
PopulateDestinations();
|
||||
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ after populating ${res} @@@@@@@@@@@");
|
||||
print("---- database update resulr ------ res : ${res}-------");
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
void onInit() async {
|
||||
super.onInit();
|
||||
checkPermission();
|
||||
PopulateDestinations();
|
||||
|
||||
|
||||
//print("------ in iniit");
|
||||
|
||||
|
||||
|
||||
if (defaultTargetPlatform == TargetPlatform.android) {
|
||||
locationSettings = AndroidSettings(
|
||||
accuracy: LocationAccuracy.bestForNavigation,
|
||||
distanceFilter: 00,
|
||||
forceLocationManager: true,
|
||||
intervalDuration: const Duration(seconds: 1),
|
||||
//(Optional) Set foreground notification config to keep the app alive
|
||||
//when going to the background
|
||||
foregroundNotificationConfig: const ForegroundNotificationConfig(
|
||||
notificationText:
|
||||
"Example app will continue to receive your location even when you aren't using it",
|
||||
notificationTitle: "Running in Background",
|
||||
enableWakeLock: true,
|
||||
)
|
||||
);
|
||||
} else if (defaultTargetPlatform == TargetPlatform.iOS || defaultTargetPlatform == TargetPlatform.macOS) {
|
||||
locationSettings = AppleSettings(
|
||||
accuracy: LocationAccuracy.bestForNavigation,
|
||||
activityType: ActivityType.fitness,
|
||||
distanceFilter: 1,
|
||||
pauseLocationUpdatesAutomatically: false,
|
||||
// Only set to true if our app will be started up in the background.
|
||||
showBackgroundLocationIndicator: true
|
||||
);
|
||||
} else {
|
||||
locationSettings = LocationSettings(
|
||||
accuracy: LocationAccuracy.high,
|
||||
distanceFilter: 30,
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
StreamSubscription<Position> positionStream = Geolocator.getPositionStream(locationSettings: locationSettings).listen(
|
||||
|
||||
(Position? position) {
|
||||
if(isSelected[0]){
|
||||
double czoom = indexController.rogMapController!.zoom;
|
||||
indexController.rogMapController!.move(LatLng(position!.latitude, position!.longitude), czoom);
|
||||
//String user_id = indexController.currentUser[0]["user"]["id"].toString();
|
||||
//TrackingService.addTrack(user_id, position!.latitude, position.longitude).then((val){
|
||||
//print("---- postion is ${position.latitude}, ${position.longitude}");
|
||||
gps.clear();
|
||||
gps.add("-- lat : ${position.latitude}, lon : ${position.longitude} --");
|
||||
checkForCheckin(position!.latitude, position.longitude);
|
||||
//});
|
||||
|
||||
}
|
||||
//print(position == null ? 'Unknown' : 'current position is ${position.latitude.toString()}, ${position.longitude.toString()}');
|
||||
});
|
||||
} catch (err){
|
||||
locationPermission.clear();
|
||||
locationPermission.add(err.toString());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void checkPermission() async {
|
||||
LocationPermission permission = await Geolocator.checkPermission();
|
||||
if (permission != LocationPermission.whileInUse ||
|
||||
permission != LocationPermission.always) {
|
||||
locationPermission.clear();
|
||||
locationPermission.add(permission.name);
|
||||
permission = await Geolocator.requestPermission();
|
||||
}
|
||||
}
|
||||
|
||||
void deleteDestination(Destination d){
|
||||
//int id = destinations[index].location_id!;
|
||||
//print("---- index ${destinations[index].location_id!}-----");
|
||||
for(Destination ss in currentSelectedDestinations){
|
||||
if(ss.location_id == d.location_id){
|
||||
currentSelectedDestinations.remove(ss);
|
||||
break;
|
||||
}
|
||||
}
|
||||
DatabaseHelper db = DatabaseHelper.instance;
|
||||
db.deleteDestination(d.location_id!).then((value){
|
||||
PopulateDestinations();
|
||||
});
|
||||
}
|
||||
|
||||
// ---------- database ------------------///
|
||||
|
||||
void addDestinations(Destination dest){
|
||||
|
||||
print('------ destination controller in add destination ${dest.name} ---- :::::');
|
||||
|
||||
DatabaseHelper db = DatabaseHelper.instance;
|
||||
db.getDestinationByLatLon(dest.lat!, dest.lon!).then((value){
|
||||
if(value.isNotEmpty){
|
||||
db.deleteDestination(value[0].location_id!).then((value){
|
||||
db.insertDestination(dest).then((value){
|
||||
print("----- destination controller deleted and inserted destination id $value ---- :::::");
|
||||
PopulateDestinations();
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
db.insertDestination(dest).then((value){
|
||||
print("----- destination controller added as new ${value}--- :::::");
|
||||
PopulateDestinations();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
void PopulateDestinations(){
|
||||
print("--------- destination controller populsting destinations ----------- ::::::");
|
||||
|
||||
destinations.clear();
|
||||
destinationCount.value = 0;
|
||||
DatabaseHelper db = DatabaseHelper.instance;
|
||||
db.getDestinations().then((value){
|
||||
for(Destination d in value){
|
||||
for(Destination s in currentSelectedDestinations){
|
||||
if(d.location_id == s.location_id){
|
||||
d.selected = !d.selected!;
|
||||
}
|
||||
}
|
||||
|
||||
destinations.add(d);
|
||||
}
|
||||
// destinationCount.value = 0;
|
||||
destinationCount.value = destinations.length;
|
||||
print("------ destination controller destinationcount-------- ${destinationCount}-------- :::::");
|
||||
|
||||
|
||||
MatrixService.getDestinations(value).then((mat){
|
||||
print(mat);
|
||||
matrix = mat;
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
void makeOrder(int action_id, int order, String dir){
|
||||
DestinationService.updateOrder(action_id, order, dir).then((value){
|
||||
//print("----action value----${value}");
|
||||
PopulateDestinations();
|
||||
destination_index_data.clear();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
void makeNext(Destination pt){
|
||||
|
||||
for(int i=0; i<= destinations.length - 1; i++){
|
||||
Destination p = destinations[i];
|
||||
|
||||
if(p.lat == pt.lat && p.lon == pt.lon ){
|
||||
|
||||
if(indexController.currentDestinationFeature.isNotEmpty){
|
||||
indexController.currentDestinationFeature.clear();
|
||||
}
|
||||
if(i >= destinations.length - 1 ){
|
||||
indexController.currentDestinationFeature.add(destinations[0]);
|
||||
//getAction();
|
||||
}
|
||||
else{
|
||||
indexController.currentDestinationFeature.add(destinations[i + 1]);
|
||||
//getAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void makePrevious(Destination pt){
|
||||
|
||||
for(int i=0; i<= destinations.length - 1; i++){
|
||||
Destination p = destinations[i];
|
||||
|
||||
if(p.lat == pt.lat && p.lon == pt.lon ){
|
||||
|
||||
if(indexController.currentDestinationFeature.isNotEmpty){
|
||||
indexController.currentDestinationFeature.clear();
|
||||
}
|
||||
if(i <= 0){
|
||||
indexController.currentDestinationFeature.add(destinations[destinations.length -1]);
|
||||
//getAction();
|
||||
}
|
||||
else{
|
||||
indexController.currentDestinationFeature.add(destinations[i - 1]);
|
||||
//getAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,125 +0,0 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/destination_map/destination_map_page.dart';
|
||||
import 'package:rogapp/pages/drawer/drawer_page.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:rogapp/widgets/destination_widget.dart';
|
||||
import 'package:timeline_tile/timeline_tile.dart';
|
||||
|
||||
|
||||
class DestinationPage extends StatefulWidget {
|
||||
DestinationPage({ Key? key }) : super(key: key);
|
||||
|
||||
@override
|
||||
State<DestinationPage> createState() => _DestinationPageState();
|
||||
}
|
||||
|
||||
class _DestinationPageState extends State<DestinationPage> {
|
||||
final DestinationController destinationController = Get.find<DestinationController>();
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
final List<int> _items = List<int>.generate(50, (int index) => index);
|
||||
|
||||
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!));
|
||||
}
|
||||
}
|
||||
|
||||
@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: const DrawerPage(),
|
||||
bottomNavigationBar: BottomAppBar(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Expanded(child: IconButton(icon: const Icon(Icons.camera_enhance), onPressed: (){},),),
|
||||
const Expanded(child: Text('')),
|
||||
Expanded(child: IconButton(icon: const Icon(Icons.travel_explore), onPressed: (){
|
||||
indexController.switchPage(AppPages.INITIAL);
|
||||
}),),
|
||||
],
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: (){
|
||||
//print("######");
|
||||
indexController.toggleDestinationMode();
|
||||
},
|
||||
tooltip: 'Increment',
|
||||
child: const Icon(Icons.document_scanner),
|
||||
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 ?
|
||||
DestinationWidget():
|
||||
DestinationMapPage()
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,285 +0,0 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/plugin_api.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:geojson/geojson.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
//import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/services/destination_service.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
import 'package:rogapp/widgets/bread_crum_widget.dart';
|
||||
|
||||
class DestinationMapPage extends StatefulWidget {
|
||||
DestinationMapPage({ Key? key }) : super(key: key);
|
||||
|
||||
|
||||
@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();
|
||||
|
||||
|
||||
|
||||
// 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),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
|
||||
|
||||
|
||||
List<LatLng>? getPoints(){
|
||||
//print("##### --- route point ${indexController.routePoints.length}");
|
||||
List<LatLng> pts = [];
|
||||
for(PointLatLng p in indexController.routePoints){
|
||||
LatLng l = LatLng(p.latitude, p.longitude);
|
||||
pts.add(l);
|
||||
}
|
||||
return pts;
|
||||
}
|
||||
|
||||
List<Marker>? getMarkers() {
|
||||
List<Marker> pts = [];
|
||||
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: Container(
|
||||
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),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
//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() {
|
||||
|
||||
DestinationService.getDestinationLine(destinationController.destinations)?.then((value){
|
||||
//print("---- loading destination points ------ ${value}");
|
||||
indexController.routePoints.clear();
|
||||
setState(() {
|
||||
indexController.routePoints = value;
|
||||
});
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Obx((() =>
|
||||
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(),
|
||||
),
|
||||
// Positioned(
|
||||
// bottom: 200,
|
||||
// left: 10,
|
||||
// child: Container(
|
||||
// color: Colors.white,
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Text(destinationController.gps[0]),
|
||||
// Text(destinationController.locationPermission[0])
|
||||
// ],
|
||||
// ),
|
||||
// )
|
||||
// ),
|
||||
],
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
FlutterMap TravelMap() {
|
||||
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.clear();
|
||||
destinationController.isSelected.add(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://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
subdomains: ['a', 'b', 'c'],
|
||||
),
|
||||
),
|
||||
//Obx(() =>
|
||||
indexController.routePoints.length > 0 ?
|
||||
PolylineLayerWidget(
|
||||
options: PolylineLayerOptions(
|
||||
polylines: [
|
||||
Polyline(
|
||||
points: getPoints()!,
|
||||
strokeWidth: 4.0,
|
||||
color: Colors.purple),
|
||||
],
|
||||
),
|
||||
)
|
||||
:
|
||||
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,12 +0,0 @@
|
||||
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/home/home_controller.dart';
|
||||
|
||||
class HomeBinding extends Bindings{
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.put<HomeController>(HomeController());
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_state_manager/get_state_manager.dart';
|
||||
|
||||
class HomeController extends GetxController{
|
||||
|
||||
}
|
||||
@ -1,42 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/search/search_page.dart';
|
||||
|
||||
class HomePage extends GetView{
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
backgroundColor: Colors.white,
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text("app_title".tr,
|
||||
style: const TextStyle(
|
||||
color: Colors.blue
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: (){
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => SearchPage()));
|
||||
},
|
||||
child: Container(
|
||||
height: 32,
|
||||
width: 75,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blue,
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
|
||||
),
|
||||
child: const Center(child: Icon(Icons.search),),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
body: Container(),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
|
||||
import 'package:flutter_map/plugin_api.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
|
||||
class IndexBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.put<IndexController>(IndexController());
|
||||
}
|
||||
}
|
||||
@ -1,585 +0,0 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:flutter_map/plugin_api.dart';
|
||||
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/destination/destination_binding.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/destination/destination_page.dart';
|
||||
import 'package:rogapp/pages/destination_map/destination_map_page.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:rogapp/services/action_service.dart';
|
||||
import 'package:rogapp/services/auth_service.dart';
|
||||
import 'package:rogapp/services/cat_service.dart';
|
||||
import 'package:rogapp/services/location_service.dart';
|
||||
import 'package:rogapp/services/perfecture_service.dart';
|
||||
import 'package:rogapp/utils/database_helper.dart';
|
||||
|
||||
class IndexController extends GetxController {
|
||||
List<GeoJsonFeatureCollection> locations = <GeoJsonFeatureCollection>[].obs;
|
||||
List<GeoJsonFeature> currentFeature = <GeoJsonFeature>[].obs;
|
||||
List<Destination> currentDestinationFeature = <Destination>[].obs;
|
||||
List<dynamic> perfectures = <dynamic>[].obs;
|
||||
List<LatLngBounds> currentBound = <LatLngBounds>[].obs;
|
||||
List<dynamic> subPerfs = <dynamic>[].obs;
|
||||
List<dynamic> areas = <dynamic>[].obs;
|
||||
List<dynamic> customAreas = <dynamic>[].obs;
|
||||
List<dynamic> cats = <dynamic>[].obs;
|
||||
|
||||
List<String> currentCat = <String>[].obs;
|
||||
|
||||
List<Map<String, dynamic>> currentUser = <Map<String, dynamic>>[].obs;
|
||||
List<dynamic> currentAction = <dynamic>[].obs;
|
||||
List<PointLatLng> routePoints = <PointLatLng>[].obs;
|
||||
|
||||
var is_loading = false.obs;
|
||||
|
||||
var is_mapController_loaded = false.obs;
|
||||
var is_rog_mapcontroller_loaded = false.obs;
|
||||
|
||||
var is_custom_area_selected = false.obs;
|
||||
|
||||
MapController? mapController;
|
||||
MapController? rogMapController;
|
||||
|
||||
var mode = 0.obs;
|
||||
|
||||
// master mode, rog or selection
|
||||
var rog_mode = 1.obs;
|
||||
|
||||
var desination_mode = 1.obs;
|
||||
|
||||
bool showPopup = true;
|
||||
|
||||
|
||||
String dropdownValue = "9";
|
||||
String subDropdownValue = "-1";
|
||||
String areaDropdownValue = "-1";
|
||||
String cateogory = "-all-";
|
||||
|
||||
late Worker _ever;
|
||||
|
||||
void toggleMode(){
|
||||
if(mode.value==0){
|
||||
mode += 1;
|
||||
}
|
||||
else{
|
||||
mode -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
void toggleDestinationMode(){
|
||||
if(desination_mode.value==0){
|
||||
desination_mode.value += 1;
|
||||
}
|
||||
else{
|
||||
desination_mode.value -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
void switchPage(String page){
|
||||
//print("######## ${currentUser[0]["user"]["id"]}");
|
||||
switch (page) {
|
||||
case AppPages.INITIAL :{
|
||||
rog_mode.value = 0;
|
||||
print("-- rog mode is ctrl is ${rog_mode.value}");
|
||||
Get.toNamed(page);
|
||||
}
|
||||
break;
|
||||
case AppPages.TRAVEL : {
|
||||
rog_mode.value = 1;
|
||||
//Get.back();
|
||||
Get.off(DestinationPage(), binding: DestinationBinding());
|
||||
|
||||
}
|
||||
break;
|
||||
case AppPages.LOGIN :{
|
||||
rog_mode.value = 2;
|
||||
Get.toNamed(page);
|
||||
}
|
||||
break;
|
||||
default:{
|
||||
rog_mode.value = 0;
|
||||
Get.toNamed(AppPages.INITIAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
|
||||
// if(locations.length == 0){
|
||||
// LocationService.loadLocations().then((value){
|
||||
// locations.add(value!);
|
||||
// //print(value);
|
||||
// });
|
||||
// }
|
||||
|
||||
_ever = ever(rog_mode, (_) => print("$_ has been changed (ever)"));
|
||||
|
||||
if(perfectures.length == 0){
|
||||
PerfectureService.loadPerfectures().then((value){
|
||||
perfectures.add(value);
|
||||
loadAreaFor("9");
|
||||
|
||||
//loadSubPerfFor("9");
|
||||
});
|
||||
}
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
|
||||
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){
|
||||
if(value.isNotEmpty){
|
||||
currentUser.clear();
|
||||
currentUser.add(value);
|
||||
is_loading.value = false;
|
||||
Navigator.pop(context);
|
||||
loadUserDetails();
|
||||
if(currentFeature.isNotEmpty){
|
||||
getAction();
|
||||
}
|
||||
if(rog_mode.value == 1){
|
||||
switchPage(AppPages.TRAVEL);
|
||||
}
|
||||
else{
|
||||
switchPage(AppPages.INITIAL);
|
||||
}
|
||||
//Get.toNamed(AppPages.INITIAL);
|
||||
}else{
|
||||
is_loading.value = false;
|
||||
Get.snackbar(
|
||||
"Failed",
|
||||
"User login failed, please try again.",
|
||||
icon: Icon(Icons.error, size: 40.0, color: Colors.blue),
|
||||
snackPosition: SnackPosition.TOP,
|
||||
duration: Duration(milliseconds: 800),
|
||||
backgroundColor: Colors.yellow,
|
||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||
);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void register(String email, String password, BuildContext context){
|
||||
AuthService.register(email, password).then((value){
|
||||
if(value.isNotEmpty){
|
||||
currentUser.clear();
|
||||
currentUser.add(value);
|
||||
is_loading.value = false;
|
||||
Navigator.pop(context);
|
||||
loadUserDetails();
|
||||
Get.toNamed(AppPages.INITIAL);
|
||||
}else{
|
||||
is_loading.value = false;
|
||||
Get.snackbar(
|
||||
"Failed",
|
||||
"User registration failed, please try again.",
|
||||
icon: Icon(Icons.error, size: 40.0, color: Colors.blue),
|
||||
snackPosition: SnackPosition.TOP,
|
||||
duration: Duration(milliseconds: 800),
|
||||
backgroundColor: Colors.yellow,
|
||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void makeAction(BuildContext context){
|
||||
int user_id = currentUser[0]["user"]["id"] as int;
|
||||
int location_id = currentFeature[0].properties!["location_id"] as int;
|
||||
bool wanttogo = currentAction[0][0]["wanttogo"];
|
||||
bool like = currentAction[0][0]["like"];
|
||||
bool checkin = currentAction[0][0]["checkin"];
|
||||
if(user_id > 0){
|
||||
ActionService.makeAction(user_id, location_id, wanttogo, like, checkin).then((value){
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void loadCatsv2(){
|
||||
dynamic initVal = {'category':'-all-'};
|
||||
LatLngBounds bounds = mapController!.bounds!;
|
||||
if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){
|
||||
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) {
|
||||
cats.clear();
|
||||
cats.add(initVal);
|
||||
for(dynamic cat in value!){
|
||||
if(cat['category'] != null){
|
||||
cats.add(cat!);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void loadCatForCity(String city){
|
||||
dynamic initVal = {'category':'-all-'};
|
||||
LatLngBounds bounds = mapController!.bounds!;
|
||||
if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){
|
||||
CatService.loadCatByCity(city).then((value) {
|
||||
cats.clear();
|
||||
cats.add(initVal);
|
||||
for(dynamic cat in value!){
|
||||
if(cat['category'] != null){
|
||||
cats.add(cat!);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void refreshLocationForCat(){
|
||||
loadLocationsBound();
|
||||
// if(subDropdownValue == "-1"){
|
||||
// LocationService.loadLocationsFor(dropdownValue, currentCat[0]).then((value){
|
||||
// locations.clear();
|
||||
// locations.add(value!);
|
||||
// is_loading.value = false;
|
||||
// });
|
||||
// print("loading main------");
|
||||
// }
|
||||
// else{
|
||||
// LocationService.loadLocationsSubFor(subDropdownValue, currentCat[0]).then((value){
|
||||
// locations.clear();
|
||||
// locations.add(value!);
|
||||
// is_loading.value = false;
|
||||
// });
|
||||
// print("loading sub------");
|
||||
// }
|
||||
}
|
||||
|
||||
void loadAreaFor(String perf){
|
||||
areas.clear();
|
||||
dynamic initVal = {'id':'-1', 'adm2_ja':'----'};
|
||||
PerfectureService.loadGifuAreas(perf).then((value){
|
||||
value!.add(initVal);
|
||||
areas.add(value);
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
void loadSubPerfFor(String perf){
|
||||
subPerfs.clear();
|
||||
dynamic initVal = {'id':'-1', 'adm2_ja':'----'};
|
||||
PerfectureService.loadSubPerfectures(perf).then((value){
|
||||
value!.add(initVal);
|
||||
subPerfs.add(value);
|
||||
subDropdownValue = getSubInitialVal();
|
||||
});
|
||||
}
|
||||
|
||||
String getSubInitialVal(){
|
||||
int min = 0;
|
||||
if(subPerfs.length > 0){
|
||||
min = int.parse(subPerfs[0][0]['id'].toString());
|
||||
for(var sub in subPerfs[0]){
|
||||
int x = int.parse(sub['id'].toString()); // as int;
|
||||
if(x < min){
|
||||
min = x;
|
||||
}
|
||||
}
|
||||
}
|
||||
return min.toString();
|
||||
}
|
||||
|
||||
void loadLocationforPerf(String perf, MapController mapController) async {
|
||||
String cat = currentCat.isNotEmpty == true ? currentCat[0] : "";
|
||||
print(currentCat);
|
||||
// LocationService.loadLocationsFor(perf, cat).then((value){
|
||||
// locations.clear();
|
||||
// locations.add(value!);
|
||||
// mapController.fitBounds(currentBound[0]);
|
||||
// });
|
||||
locations.clear();
|
||||
mapController.fitBounds(currentBound[0]);
|
||||
}
|
||||
|
||||
void loadLocationforSubPerf(String subperf, MapController mapController) async {
|
||||
String cat = currentCat.isNotEmpty == true ? currentCat[0] : "";
|
||||
if(currentCat[0] == "-all-"){
|
||||
cat = "";
|
||||
}
|
||||
LocationService.loadLocationsSubFor(subperf, cat).then((value){
|
||||
locations.clear();
|
||||
locations.add(value!);
|
||||
});
|
||||
}
|
||||
|
||||
void loadCustomLocation(String customarea) async {
|
||||
String cat = currentCat.isNotEmpty == true ? currentCat[0] : "";
|
||||
print("----- ${customarea}");
|
||||
LocationService.loadCustomLocations(customarea, cat).then((value){
|
||||
locations.clear();
|
||||
locations.add(value!);
|
||||
List<LatLng> locs = getLocationsList();
|
||||
LatLngBounds bounds = boundsFromLatLngList(locs);
|
||||
mapController!.fitBounds(bounds);
|
||||
setBound(bounds);
|
||||
Future.delayed(Duration(microseconds: 400), () {
|
||||
mapController!.fitBounds(bounds);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void loadLocationsBound(){
|
||||
if(is_custom_area_selected.value == true){
|
||||
return;
|
||||
}
|
||||
String cat = currentCat.isNotEmpty ? currentCat[0] : "";
|
||||
LatLngBounds bounds = mapController!.bounds!;
|
||||
currentBound.clear();
|
||||
currentBound.add(bounds);
|
||||
//print(currentCat);
|
||||
if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){
|
||||
LocationService.loadLocationsBound(bounds.southWest!.latitude, bounds.southWest!.longitude, bounds.northWest.latitude, bounds.northWest.longitude, bounds.northEast!.latitude, bounds.northEast!.longitude, bounds.southEast.latitude, bounds.southEast.longitude, cat).then((value){
|
||||
//print("---value length ------ ${value!.collection.length}");
|
||||
if(value == null){
|
||||
return;
|
||||
}
|
||||
locations.clear();
|
||||
if(value != null && value.collection.isEmpty){
|
||||
if(showPopup == false) {
|
||||
return;
|
||||
}
|
||||
Get.snackbar(
|
||||
"Too many Points",
|
||||
"please zoom in",
|
||||
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
||||
snackPosition: SnackPosition.TOP,
|
||||
duration: Duration(milliseconds: 800),
|
||||
backgroundColor: Colors.yellow,
|
||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||
);
|
||||
showPopup = false;
|
||||
//Get.showSnackbar(GetSnackBar(message: "Too many points, please zoom in",));
|
||||
}
|
||||
if(value != null && value.collection.isNotEmpty){
|
||||
//print("---- added---");
|
||||
locations.add(value);
|
||||
loadCatsv2();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void setBound(LatLngBounds bounds){
|
||||
currentBound.clear();
|
||||
currentBound.add(bounds);
|
||||
}
|
||||
|
||||
void zoomtoMainPerf(String id){
|
||||
|
||||
PerfectureService.getMainPerfExt(id).then((value){
|
||||
LatLng lat1 = LatLng(value![1], value[0]);
|
||||
LatLng lat2 = LatLng(value[3], value[2]);
|
||||
LatLngBounds bound = LatLngBounds(lat1, lat2);
|
||||
mapController!.fitBounds(bound);
|
||||
setBound(bound);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
void zoomtoSubPerf(String id){
|
||||
|
||||
print("zooooom");
|
||||
|
||||
PerfectureService.getSubExt(id).then((value){
|
||||
LatLng lat1 = LatLng(value![1], value[0]);
|
||||
LatLng lat2 = LatLng(value[3], value[2]);
|
||||
LatLngBounds bound = LatLngBounds(lat1, lat2);
|
||||
mapController!.fitBounds(bound);
|
||||
setBound(bound);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
void populateForPerf(String perf, MapController mapController){
|
||||
loadSubPerfFor(perf);
|
||||
loadLocationforPerf(perf, mapController);
|
||||
zoomtoMainPerf(perf);
|
||||
is_loading.value = false;
|
||||
}
|
||||
|
||||
void populateForSubPerf(String subperf, MapController mapController){
|
||||
//subDropdownValue = subperf;
|
||||
loadLocationforSubPerf(subperf, mapController);
|
||||
zoomtoSubPerf(subperf);
|
||||
is_loading.value = false;
|
||||
}
|
||||
|
||||
void populateSubPerForArea(String area, MapController mapController){
|
||||
loadSubPerfFor(area);
|
||||
//loadCustomLocation("cus", mapController);
|
||||
//zoomtoSubPerf(subperf);
|
||||
is_loading.value = false;
|
||||
}
|
||||
|
||||
|
||||
GeoJsonFeature? getFeatureForLatLong(double lat, double long){
|
||||
if(locations.length > 0){
|
||||
for(GeoJsonFeature i in locations[0].collection){
|
||||
GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
|
||||
if(p.geoSerie!.geoPoints[0].latitude == lat && p.geoSerie!.geoPoints[0].longitude == long){
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void getAction(){
|
||||
//print(currentUser[0]["user"]["id"]);
|
||||
//print(currentFeature[0].properties!["location_id"]);
|
||||
if(currentUser.length == 0){
|
||||
return;
|
||||
}
|
||||
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;
|
||||
ActionService.userAction(user_id, location_id).then((value){
|
||||
print("------${value}");
|
||||
if(value != null && value.length > 0){
|
||||
currentAction.clear();
|
||||
currentAction.add(value);
|
||||
print("------${currentAction[0]}");
|
||||
}else{
|
||||
List<dynamic> initval = [{"user": user_id, "location": location_id, "wanttogo": false, "like": false, "checkin": false}];
|
||||
currentAction.clear();
|
||||
currentAction.add(initval);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void makeNext(GeoJsonFeature fs){
|
||||
|
||||
if(rog_mode == 1){
|
||||
DestinationController destinationController = Get.find<DestinationController>();
|
||||
print("---- destination index--- ${destinationController.destination_index_data} --------");
|
||||
}
|
||||
else {
|
||||
GeoJsonFeature<GeoJsonMultiPoint> pt = fs as GeoJsonFeature<GeoJsonMultiPoint>;
|
||||
|
||||
for(int i=0; i<= locations[0].collection.length - 1; i++){
|
||||
GeoJsonMultiPoint p = locations[0].collection[i].geometry as GeoJsonMultiPoint;
|
||||
|
||||
if(p.geoSerie!.geoPoints[0].latitude == pt.geometry!.geoSerie!.geoPoints[0].latitude && p.geoSerie!.geoPoints[0].longitude == pt.geometry!.geoSerie!.geoPoints[0].longitude ){
|
||||
|
||||
if(currentFeature.length > 0){
|
||||
currentFeature.clear();
|
||||
}
|
||||
if(i >= locations[0].collection.length - 1 ){
|
||||
currentFeature.add(locations[0].collection[0] as GeoJsonFeature);
|
||||
getAction();
|
||||
}
|
||||
else{
|
||||
currentFeature.add(locations[0].collection[i + 1] as GeoJsonFeature);
|
||||
getAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void makePrevious(GeoJsonFeature fs){
|
||||
|
||||
if(rog_mode == 1){
|
||||
DestinationController destinationController = Get.find<DestinationController>();
|
||||
print("---- destination index--- ${destinationController.destination_index_data} --------");
|
||||
}
|
||||
else {
|
||||
|
||||
GeoJsonFeature<GeoJsonMultiPoint> pt = fs as GeoJsonFeature<GeoJsonMultiPoint>;
|
||||
|
||||
for(int i=0; i<= locations[0].collection.length - 1; i++){
|
||||
GeoJsonMultiPoint p = locations[0].collection[i].geometry as GeoJsonMultiPoint;
|
||||
|
||||
if(p.geoSerie!.geoPoints[0].latitude == pt.geometry!.geoSerie!.geoPoints[0].latitude && p.geoSerie!.geoPoints[0].longitude == pt.geometry!.geoSerie!.geoPoints[0].longitude ){
|
||||
|
||||
if(currentFeature.length > 0){
|
||||
currentFeature.clear();
|
||||
}
|
||||
if(i == 0 ){
|
||||
currentFeature.add(locations[0].collection[locations[0].collection.length -1] as GeoJsonFeature);
|
||||
getAction();
|
||||
}
|
||||
else{
|
||||
currentFeature.add(locations[0].collection[i - 1] as GeoJsonFeature);
|
||||
getAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,149 +0,0 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/drawer/drawer_page.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:rogapp/services/maxtrix_service.dart';
|
||||
import 'package:rogapp/utils/database_helper.dart';
|
||||
import 'package:rogapp/widgets/bread_crum_widget.dart';
|
||||
import 'package:rogapp/widgets/cat_widget.dart';
|
||||
import 'package:rogapp/widgets/list_widget.dart';
|
||||
import 'package:rogapp/widgets/map_widget.dart';
|
||||
|
||||
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
|
||||
|
||||
class IndexPage extends GetView<IndexController> {
|
||||
IndexPage({Key? key}) : super(key: key);
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
indexController.switchPage(AppPages.INITIAL);
|
||||
return false;
|
||||
},
|
||||
child: Scaffold(
|
||||
//drawer: const DrawerPage(),
|
||||
appBar: AppBar(
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back_ios),
|
||||
onPressed: (){
|
||||
indexController.switchPage(AppPages.TRAVEL);
|
||||
},
|
||||
),
|
||||
//automaticallyImplyLeading: false,
|
||||
title: Text("Add locations"),
|
||||
actions: [
|
||||
InkWell(
|
||||
onTap: (){
|
||||
Get.toNamed(AppPages.SEARCH);
|
||||
},
|
||||
child: Container(
|
||||
height: 32,
|
||||
width: 75,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blue,
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
|
||||
),
|
||||
child: const Center(child: Icon(Icons.search),),
|
||||
),
|
||||
),
|
||||
//CatWidget(indexController: indexController,),
|
||||
],
|
||||
),
|
||||
bottomNavigationBar: BottomAppBar(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Expanded(child: IconButton(icon: const Icon(Icons.camera_enhance), onPressed: (){},),),
|
||||
const Expanded(child: Text('')),
|
||||
Expanded(child: IconButton(icon: const Icon(Icons.travel_explore), onPressed: (){
|
||||
indexController.switchPage(AppPages.TRAVEL);
|
||||
}),),
|
||||
],
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: (){
|
||||
indexController.toggleMode();
|
||||
if(indexController.currentCat.isNotEmpty){
|
||||
print(indexController.currentCat[0].toString());
|
||||
}
|
||||
|
||||
},
|
||||
tooltip: 'Increment',
|
||||
child: const Icon(Icons.document_scanner),
|
||||
elevation: 4.0,
|
||||
),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
height: 50.0,
|
||||
//child: SingleChildScrollView(
|
||||
// scrollDirection: Axis.horizontal,
|
||||
// child:Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// children: [
|
||||
// TextButton(child:Text("Main Pef >", style: TextStyle(fontSize:16.0, fontWeight: FontWeight.bold),), onPressed: (){Get.toNamed(AppPages.MAINPERF);},),
|
||||
// TextButton(child:Text("Sub Pef >", style: TextStyle(fontSize:16.0, fontWeight: FontWeight.bold),), onPressed: (){Get.toNamed(AppPages.SUBPERF);},),
|
||||
// TextButton(child:Text("Cities >", style: TextStyle(fontSize:16.0, fontWeight: FontWeight.bold),), onPressed: (){Get.toNamed(AppPages.CITY);},),
|
||||
// TextButton(child:Text("Categories", style: TextStyle(fontSize:16.0, fontWeight: FontWeight.bold),), onPressed: (){Get.toNamed(AppPages.CATEGORY);},),
|
||||
// ],
|
||||
// )
|
||||
// ),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Obx(() =>
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
indexController.is_mapController_loaded.value == false ?
|
||||
Center(child: CircularProgressIndicator())
|
||||
:
|
||||
BreadCrumbWidget(mapController: indexController.mapController),
|
||||
Container(width: 24.0,),
|
||||
// Row(
|
||||
// children: [
|
||||
// indexController.currentCat.isNotEmpty ? Text(indexController.currentCat[0].toString()): Text(""),
|
||||
// indexController.currentCat.isNotEmpty ?
|
||||
// IconButton(
|
||||
// onPressed: (){
|
||||
// indexController.currentCat.clear();
|
||||
// indexController.loadLocationsBound();
|
||||
// },
|
||||
// icon: Icon(Icons.cancel, color: Colors.red,)
|
||||
// ) :
|
||||
// Container(width: 0, height: 0,)
|
||||
// ],
|
||||
// )
|
||||
],
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Obx(() =>
|
||||
indexController.mode == 0 ?
|
||||
MapWidget() :
|
||||
ListWidget(),
|
||||
)
|
||||
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,91 +1,91 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// import 'package:rogapp/routes/app_pages.dart';
|
||||
|
||||
class LandingPage extends StatefulWidget {
|
||||
const LandingPage({ Key? key }) : super(key: key);
|
||||
// class LandingPage extends StatefulWidget {
|
||||
// const LandingPage({ Key? key }) : super(key: key);
|
||||
|
||||
@override
|
||||
State<LandingPage> createState() => _LandingPageState();
|
||||
}
|
||||
// @override
|
||||
// State<LandingPage> createState() => _LandingPageState();
|
||||
// }
|
||||
|
||||
class _LandingPageState extends State<LandingPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: SafeArea(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
padding: EdgeInsets.symmetric(horizontal: 30,vertical: 30),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"こんにちは!",
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 40),
|
||||
),
|
||||
SizedBox(height: 30,),
|
||||
Text("ログインを有効にして本人確認を行うと、サーバーが改善されます",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.grey[700],
|
||||
fontSize: 15
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: MediaQuery.of(context).size.height/3,
|
||||
decoration: BoxDecoration(
|
||||
image:DecorationImage(image: AssetImage('assets/gradient_japanese_temple.jpg'))
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20.0,),
|
||||
MaterialButton(
|
||||
minWidth: double.infinity,
|
||||
height:60,
|
||||
onPressed: (){
|
||||
Get.toNamed(AppPages.LOGIN);
|
||||
},
|
||||
color: Colors.indigoAccent[400],
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
color: Colors.black,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(40)
|
||||
),
|
||||
child: Text("ログイン",style: TextStyle(
|
||||
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
||||
// class _LandingPageState extends State<LandingPage> {
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Scaffold(
|
||||
// body: SafeArea(
|
||||
// child: Container(
|
||||
// width: double.infinity,
|
||||
// height: MediaQuery.of(context).size.height,
|
||||
// padding: EdgeInsets.symmetric(horizontal: 30,vertical: 30),
|
||||
// child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// children: [
|
||||
// Text(
|
||||
// "こんにちは!",
|
||||
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 40),
|
||||
// ),
|
||||
// SizedBox(height: 30,),
|
||||
// Text("ログインを有効にして本人確認を行うと、サーバーが改善されます",
|
||||
// textAlign: TextAlign.center,
|
||||
// style: TextStyle(
|
||||
// color: Colors.grey[700],
|
||||
// fontSize: 15
|
||||
// ),
|
||||
// ),
|
||||
// Container(
|
||||
// height: MediaQuery.of(context).size.height/3,
|
||||
// decoration: BoxDecoration(
|
||||
// image:DecorationImage(image: AssetImage('assets/gradient_japanese_temple.jpg'))
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(height: 20.0,),
|
||||
// MaterialButton(
|
||||
// minWidth: double.infinity,
|
||||
// height:60,
|
||||
// onPressed: (){
|
||||
// Get.toNamed(AppPages.LOGIN);
|
||||
// },
|
||||
// color: Colors.indigoAccent[400],
|
||||
// shape: RoundedRectangleBorder(
|
||||
// side: BorderSide(
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// borderRadius: BorderRadius.circular(40)
|
||||
// ),
|
||||
// child: Text("ログイン",style: TextStyle(
|
||||
// fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
||||
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 15.0,),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(height: 15.0,),
|
||||
|
||||
MaterialButton(
|
||||
minWidth: double.infinity,
|
||||
height:60,
|
||||
onPressed: (){
|
||||
Get.toNamed(AppPages.REGISTER);
|
||||
},
|
||||
color: Colors.redAccent,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(40)
|
||||
),
|
||||
child: Text("サインアップ",style: TextStyle(
|
||||
fontWeight: FontWeight.w600,fontSize: 16,
|
||||
// MaterialButton(
|
||||
// minWidth: double.infinity,
|
||||
// height:60,
|
||||
// onPressed: (){
|
||||
// Get.toNamed(AppPages.REGISTER);
|
||||
// },
|
||||
// color: Colors.redAccent,
|
||||
// shape: RoundedRectangleBorder(
|
||||
// borderRadius: BorderRadius.circular(40)
|
||||
// ),
|
||||
// child: Text("サインアップ",style: TextStyle(
|
||||
// fontWeight: FontWeight.w600,fontSize: 16,
|
||||
|
||||
),),
|
||||
),
|
||||
// ),),
|
||||
// ),
|
||||
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// ],
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
@ -1,178 +1,178 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// //import 'package:rogapp/pages/index/index_controller.dart';
|
||||
// import 'package:rogapp/routes/app_pages.dart';
|
||||
|
||||
class LoginPage extends StatelessWidget {
|
||||
// class LoginPage extends StatelessWidget {
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
// // final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
TextEditingController emailController = TextEditingController();
|
||||
TextEditingController passwordController = TextEditingController();
|
||||
// TextEditingController emailController = TextEditingController();
|
||||
// TextEditingController passwordController = TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
brightness: Brightness.light,
|
||||
backgroundColor: Colors.white,
|
||||
leading:
|
||||
IconButton( onPressed: (){
|
||||
Navigator.pop(context);
|
||||
},icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
|
||||
),
|
||||
body: Container(
|
||||
height: MediaQuery.of(context).size.height,
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Text ("ログイン", style: TextStyle(
|
||||
fontSize: 30,
|
||||
fontWeight: FontWeight.bold,
|
||||
),),
|
||||
SizedBox(height: 20,),
|
||||
Text("お帰りなさい !資格情報を使用してログインします",style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.grey[700],
|
||||
),),
|
||||
SizedBox(height: 30,)
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 40
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
makeInput(label: "Eメール", controller: emailController),
|
||||
makeInput(label: "パスワード", controller: passwordController, obsureText: true),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 40),
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(top: 3,left: 3),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(40),
|
||||
border: Border(
|
||||
bottom: BorderSide(color: Colors.black),
|
||||
top: BorderSide(color: Colors.black),
|
||||
right: BorderSide(color: Colors.black),
|
||||
left: BorderSide(color: Colors.black)
|
||||
)
|
||||
),
|
||||
child: Obx((() =>
|
||||
indexController.is_loading == true ? MaterialButton(
|
||||
minWidth: double.infinity,
|
||||
height:60,
|
||||
onPressed: (){
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Scaffold(
|
||||
// resizeToAvoidBottomInset: false,
|
||||
// backgroundColor: Colors.white,
|
||||
// appBar: AppBar(
|
||||
// elevation: 0,
|
||||
// brightness: Brightness.light,
|
||||
// backgroundColor: Colors.white,
|
||||
// leading:
|
||||
// IconButton( onPressed: (){
|
||||
// Navigator.pop(context);
|
||||
// },icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
|
||||
// ),
|
||||
// body: Container(
|
||||
// height: MediaQuery.of(context).size.height,
|
||||
// width: double.infinity,
|
||||
// child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
// children: [
|
||||
// Column(
|
||||
// children: [
|
||||
// Column(
|
||||
// children: [
|
||||
// Text ("ログイン", style: TextStyle(
|
||||
// fontSize: 30,
|
||||
// fontWeight: FontWeight.bold,
|
||||
// ),),
|
||||
// SizedBox(height: 20,),
|
||||
// Text("お帰りなさい !資格情報を使用してログインします",style: TextStyle(
|
||||
// fontSize: 15,
|
||||
// color: Colors.grey[700],
|
||||
// ),),
|
||||
// SizedBox(height: 30,)
|
||||
// ],
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: EdgeInsets.symmetric(
|
||||
// horizontal: 40
|
||||
// ),
|
||||
// child: Column(
|
||||
// children: [
|
||||
// makeInput(label: "Eメール", controller: emailController),
|
||||
// makeInput(label: "パスワード", controller: passwordController, obsureText: true),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: EdgeInsets.symmetric(horizontal: 40),
|
||||
// child: Container(
|
||||
// padding: EdgeInsets.only(top: 3,left: 3),
|
||||
// decoration: BoxDecoration(
|
||||
// borderRadius: BorderRadius.circular(40),
|
||||
// border: Border(
|
||||
// bottom: BorderSide(color: Colors.black),
|
||||
// top: BorderSide(color: Colors.black),
|
||||
// right: BorderSide(color: Colors.black),
|
||||
// left: BorderSide(color: Colors.black)
|
||||
// )
|
||||
// ),
|
||||
// child: Obx((() =>
|
||||
// indexController.is_loading == true ? MaterialButton(
|
||||
// minWidth: double.infinity,
|
||||
// height:60,
|
||||
// onPressed: (){
|
||||
|
||||
},
|
||||
color: Colors.grey[400],
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(40)
|
||||
),
|
||||
child: CircularProgressIndicator(),
|
||||
) :
|
||||
MaterialButton(
|
||||
minWidth: double.infinity,
|
||||
height:60,
|
||||
onPressed: (){
|
||||
if(emailController.text.isEmpty || passwordController.text.isEmpty){
|
||||
Get.snackbar(
|
||||
"No values",
|
||||
"Email and password required",
|
||||
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
||||
snackPosition: SnackPosition.TOP,
|
||||
duration: Duration(milliseconds: 800),
|
||||
backgroundColor: Colors.yellow,
|
||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||
);
|
||||
return;
|
||||
}
|
||||
indexController.is_loading.value = true;
|
||||
indexController.login(emailController.text, passwordController.text, context);
|
||||
},
|
||||
color: Colors.indigoAccent[400],
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(40)
|
||||
),
|
||||
child: Text("ログイン",style: TextStyle(
|
||||
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
SizedBox(height: 20,),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text("アカウントをお持ちではありませんか?", style: TextStyle(
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: (){
|
||||
Get.toNamed(AppPages.REGISTER);
|
||||
},
|
||||
child: Text("サインアップ",style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 18
|
||||
),),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
// },
|
||||
// color: Colors.grey[400],
|
||||
// shape: RoundedRectangleBorder(
|
||||
// borderRadius: BorderRadius.circular(40)
|
||||
// ),
|
||||
// child: CircularProgressIndicator(),
|
||||
// ) :
|
||||
// MaterialButton(
|
||||
// minWidth: double.infinity,
|
||||
// height:60,
|
||||
// onPressed: (){
|
||||
// if(emailController.text.isEmpty || passwordController.text.isEmpty){
|
||||
// Get.snackbar(
|
||||
// "No values",
|
||||
// "Email and password required",
|
||||
// icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
||||
// snackPosition: SnackPosition.TOP,
|
||||
// duration: Duration(milliseconds: 800),
|
||||
// backgroundColor: Colors.yellow,
|
||||
// //icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||
// );
|
||||
// return;
|
||||
// }
|
||||
// indexController.is_loading.value = true;
|
||||
// indexController.login(emailController.text, passwordController.text, context);
|
||||
// },
|
||||
// color: Colors.indigoAccent[400],
|
||||
// shape: RoundedRectangleBorder(
|
||||
// borderRadius: BorderRadius.circular(40)
|
||||
// ),
|
||||
// child: Text("ログイン",style: TextStyle(
|
||||
// fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// ),
|
||||
// SizedBox(height: 20,),
|
||||
// Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// Flexible(
|
||||
// child: Text("アカウントをお持ちではありませんか?", style: TextStyle(
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// ),),
|
||||
// ),
|
||||
// TextButton(
|
||||
// onPressed: (){
|
||||
// Get.toNamed(AppPages.REGISTER);
|
||||
// },
|
||||
// child: Text("サインアップ",style: TextStyle(
|
||||
// fontWeight: FontWeight.w600,
|
||||
// fontSize: 18
|
||||
// ),),
|
||||
// ),
|
||||
// ],
|
||||
// )
|
||||
// ],
|
||||
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
Widget makeInput({label, required TextEditingController controller, obsureText = false}){
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(label,style:TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors.black87
|
||||
),),
|
||||
SizedBox(height: 5,),
|
||||
TextField(
|
||||
controller: controller,
|
||||
obscureText: obsureText,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: (Colors.grey[400])!,
|
||||
),
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: (Colors.grey[400])!
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 30.0,)
|
||||
],
|
||||
);
|
||||
}
|
||||
// Widget makeInput({label, required TextEditingController controller, obsureText = false}){
|
||||
// return Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Text(label,style:TextStyle(
|
||||
// fontSize: 15,
|
||||
// fontWeight: FontWeight.w400,
|
||||
// color: Colors.black87
|
||||
// ),),
|
||||
// SizedBox(height: 5,),
|
||||
// TextField(
|
||||
// controller: controller,
|
||||
// obscureText: obsureText,
|
||||
// decoration: InputDecoration(
|
||||
// contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
|
||||
// enabledBorder: OutlineInputBorder(
|
||||
// borderSide: BorderSide(
|
||||
// color: (Colors.grey[400])!,
|
||||
// ),
|
||||
// ),
|
||||
// border: OutlineInputBorder(
|
||||
// borderSide: BorderSide(color: (Colors.grey[400])!
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(height: 30.0,)
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
|
||||
class MainPerfPage extends StatelessWidget {
|
||||
MainPerfPage({Key? key}) : super(key: key);
|
||||
|
||||
IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("Select Main Perfecture"),
|
||||
),
|
||||
body: ListView.builder(
|
||||
itemCount: indexController.perfectures.length,
|
||||
itemBuilder: (context, index){
|
||||
return ListTile(
|
||||
onTap: (){
|
||||
indexController.dropdownValue = indexController.perfectures[index][0]["id"].toString();
|
||||
indexController.populateForPerf(indexController.dropdownValue, indexController.mapController!);
|
||||
Get.back();
|
||||
},
|
||||
title: Text(indexController.perfectures[index][0]["adm1_ja"].toString()),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,79 +1,79 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// import 'package:permission_handler/permission_handler.dart';
|
||||
// import 'package:rogapp/routes/app_pages.dart';
|
||||
|
||||
class PermissionHandlerScreen extends StatefulWidget {
|
||||
PermissionHandlerScreen({Key? key}) : super(key: key);
|
||||
// class PermissionHandlerScreen extends StatefulWidget {
|
||||
// PermissionHandlerScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<PermissionHandlerScreen> createState() => _PermissionHandlerScreenState();
|
||||
}
|
||||
// @override
|
||||
// State<PermissionHandlerScreen> createState() => _PermissionHandlerScreenState();
|
||||
// }
|
||||
|
||||
class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
|
||||
// class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
permissionServiceCall();
|
||||
}
|
||||
// @override
|
||||
// void initState() {
|
||||
// // TODO: implement initState
|
||||
// super.initState();
|
||||
// permissionServiceCall();
|
||||
// }
|
||||
|
||||
permissionServiceCall() async {
|
||||
await permissionServices().then(
|
||||
(value) {
|
||||
if (value != null) {
|
||||
if (value[Permission.location]!.isGranted ) {
|
||||
/* ========= New Screen Added ============= */
|
||||
// permissionServiceCall() async {
|
||||
// await permissionServices().then(
|
||||
// (value) {
|
||||
// if (value != null) {
|
||||
// if (value[Permission.location]!.isGranted ) {
|
||||
// /* ========= New Screen Added ============= */
|
||||
|
||||
Get.toNamed(AppPages.TRAVEL);
|
||||
// Get.toNamed(AppPages.TRAVEL);
|
||||
|
||||
// Navigator.pushReplacement(
|
||||
// context,
|
||||
// MaterialPageRoute(builder: (context) => SplashScreen()),
|
||||
// );
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
// // Navigator.pushReplacement(
|
||||
// // context,
|
||||
// // MaterialPageRoute(builder: (context) => SplashScreen()),
|
||||
// // );
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
|
||||
/*Permission services*/
|
||||
Future<Map<Permission, PermissionStatus>> permissionServices() async {
|
||||
// You can request multiple permissions at once.
|
||||
Map<Permission, PermissionStatus> statuses = await [
|
||||
Permission.location,
|
||||
// /*Permission services*/
|
||||
// Future<Map<Permission, PermissionStatus>> permissionServices() async {
|
||||
// // You can request multiple permissions at once.
|
||||
// Map<Permission, PermissionStatus> statuses = await [
|
||||
// Permission.location,
|
||||
|
||||
//add more permission to request here.
|
||||
].request();
|
||||
// //add more permission to request here.
|
||||
// ].request();
|
||||
|
||||
if (statuses[Permission.location]!.isPermanentlyDenied) {
|
||||
await openAppSettings().then(
|
||||
(value) async {
|
||||
if (value) {
|
||||
if (await Permission.location.status.isPermanentlyDenied == true &&
|
||||
await Permission.location.status.isGranted == false) {
|
||||
// openAppSettings();
|
||||
permissionServiceCall(); /* opens app settings until permission is granted */
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
} else {
|
||||
if (statuses[Permission.location]!.isDenied) {
|
||||
permissionServiceCall();
|
||||
}
|
||||
}
|
||||
// if (statuses[Permission.location]!.isPermanentlyDenied) {
|
||||
// await openAppSettings().then(
|
||||
// (value) async {
|
||||
// if (value) {
|
||||
// if (await Permission.location.status.isPermanentlyDenied == true &&
|
||||
// await Permission.location.status.isGranted == false) {
|
||||
// // openAppSettings();
|
||||
// permissionServiceCall(); /* opens app settings until permission is granted */
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// );
|
||||
// } else {
|
||||
// if (statuses[Permission.location]!.isDenied) {
|
||||
// permissionServiceCall();
|
||||
// }
|
||||
// }
|
||||
|
||||
/*{Permission.camera: PermissionStatus.granted, Permission.storage: PermissionStatus.granted}*/
|
||||
return statuses;
|
||||
}
|
||||
// /*{Permission.camera: PermissionStatus.granted, Permission.storage: PermissionStatus.granted}*/
|
||||
// return statuses;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Container();
|
||||
// }
|
||||
// }
|
||||
@ -1,179 +1,179 @@
|
||||
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// import 'package:rogapp/pages/index/index_controller.dart';
|
||||
// import 'package:rogapp/routes/app_pages.dart';
|
||||
|
||||
class RegisterPage extends StatelessWidget {
|
||||
// class RegisterPage extends StatelessWidget {
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
// final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
TextEditingController emailController = TextEditingController();
|
||||
TextEditingController passwordController = TextEditingController();
|
||||
TextEditingController confirmPasswordController = TextEditingController();
|
||||
// TextEditingController emailController = TextEditingController();
|
||||
// TextEditingController passwordController = TextEditingController();
|
||||
// TextEditingController confirmPasswordController = TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
brightness: Brightness.light,
|
||||
backgroundColor: Colors.white,
|
||||
leading:
|
||||
IconButton( onPressed: (){
|
||||
Navigator.pop(context);
|
||||
},icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
|
||||
),
|
||||
body: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
height: MediaQuery.of(context).size.height,
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text ("サインアップ", style: TextStyle(
|
||||
fontSize: 30,
|
||||
fontWeight: FontWeight.bold,
|
||||
),),
|
||||
SizedBox(height: 20,),
|
||||
Text("アカウントを作成し、無料です",style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.grey[700],
|
||||
),),
|
||||
SizedBox(height: 30,)
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 40
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
makeInput(label: "Eメール", controller: emailController),
|
||||
makeInput(label: "パスワード", controller: passwordController,obsureText: true),
|
||||
makeInput(label: "パスワードを認証する", controller: confirmPasswordController,obsureText: true)
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 40),
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(top: 3,left: 3),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(40),
|
||||
border: Border(
|
||||
bottom: BorderSide(color: Colors.black),
|
||||
top: BorderSide(color: Colors.black),
|
||||
right: BorderSide(color: Colors.black),
|
||||
left: BorderSide(color: Colors.black)
|
||||
)
|
||||
),
|
||||
child: MaterialButton(
|
||||
minWidth: double.infinity,
|
||||
height:60,
|
||||
onPressed: (){
|
||||
if(passwordController.text != confirmPasswordController.text){
|
||||
Get.snackbar(
|
||||
"No match",
|
||||
"Passwords does not match",
|
||||
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
||||
snackPosition: SnackPosition.TOP,
|
||||
duration: Duration(milliseconds: 800),
|
||||
backgroundColor: Colors.yellow,
|
||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||
);
|
||||
}
|
||||
if(emailController.text.isEmpty || passwordController.text.isEmpty){
|
||||
Get.snackbar(
|
||||
"No values",
|
||||
"Email and password required",
|
||||
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
||||
snackPosition: SnackPosition.TOP,
|
||||
duration: Duration(milliseconds: 800),
|
||||
backgroundColor: Colors.yellow,
|
||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||
);
|
||||
return;
|
||||
}
|
||||
indexController.is_loading.value = true;
|
||||
indexController.register(emailController.text, passwordController.text, context);
|
||||
},
|
||||
color: Colors.redAccent,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(40)
|
||||
),
|
||||
child: Text("サインアップ",style: TextStyle(
|
||||
fontWeight: FontWeight.w600,fontSize: 16,
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Scaffold(
|
||||
// resizeToAvoidBottomInset: false,
|
||||
// backgroundColor: Colors.white,
|
||||
// appBar: AppBar(
|
||||
// elevation: 0,
|
||||
// brightness: Brightness.light,
|
||||
// backgroundColor: Colors.white,
|
||||
// leading:
|
||||
// IconButton( onPressed: (){
|
||||
// Navigator.pop(context);
|
||||
// },icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
|
||||
// ),
|
||||
// body: SafeArea(
|
||||
// child: SingleChildScrollView(
|
||||
// child: Container(
|
||||
// height: MediaQuery.of(context).size.height,
|
||||
// width: double.infinity,
|
||||
// child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Column(
|
||||
// children: [
|
||||
// Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
// children: [
|
||||
// Text ("サインアップ", style: TextStyle(
|
||||
// fontSize: 30,
|
||||
// fontWeight: FontWeight.bold,
|
||||
// ),),
|
||||
// SizedBox(height: 20,),
|
||||
// Text("アカウントを作成し、無料です",style: TextStyle(
|
||||
// fontSize: 15,
|
||||
// color: Colors.grey[700],
|
||||
// ),),
|
||||
// SizedBox(height: 30,)
|
||||
// ],
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: EdgeInsets.symmetric(
|
||||
// horizontal: 40
|
||||
// ),
|
||||
// child: Column(
|
||||
// children: [
|
||||
// makeInput(label: "Eメール", controller: emailController),
|
||||
// makeInput(label: "パスワード", controller: passwordController,obsureText: true),
|
||||
// makeInput(label: "パスワードを認証する", controller: confirmPasswordController,obsureText: true)
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: EdgeInsets.symmetric(horizontal: 40),
|
||||
// child: Container(
|
||||
// padding: EdgeInsets.only(top: 3,left: 3),
|
||||
// decoration: BoxDecoration(
|
||||
// borderRadius: BorderRadius.circular(40),
|
||||
// border: Border(
|
||||
// bottom: BorderSide(color: Colors.black),
|
||||
// top: BorderSide(color: Colors.black),
|
||||
// right: BorderSide(color: Colors.black),
|
||||
// left: BorderSide(color: Colors.black)
|
||||
// )
|
||||
// ),
|
||||
// child: MaterialButton(
|
||||
// minWidth: double.infinity,
|
||||
// height:60,
|
||||
// onPressed: (){
|
||||
// if(passwordController.text != confirmPasswordController.text){
|
||||
// Get.snackbar(
|
||||
// "No match",
|
||||
// "Passwords does not match",
|
||||
// icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
||||
// snackPosition: SnackPosition.TOP,
|
||||
// duration: Duration(milliseconds: 800),
|
||||
// backgroundColor: Colors.yellow,
|
||||
// //icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||
// );
|
||||
// }
|
||||
// if(emailController.text.isEmpty || passwordController.text.isEmpty){
|
||||
// Get.snackbar(
|
||||
// "No values",
|
||||
// "Email and password required",
|
||||
// icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
||||
// snackPosition: SnackPosition.TOP,
|
||||
// duration: Duration(milliseconds: 800),
|
||||
// backgroundColor: Colors.yellow,
|
||||
// //icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||
// );
|
||||
// return;
|
||||
// }
|
||||
// indexController.is_loading.value = true;
|
||||
// indexController.register(emailController.text, passwordController.text, context);
|
||||
// },
|
||||
// color: Colors.redAccent,
|
||||
// shape: RoundedRectangleBorder(
|
||||
// borderRadius: BorderRadius.circular(40)
|
||||
// ),
|
||||
// child: Text("サインアップ",style: TextStyle(
|
||||
// fontWeight: FontWeight.w600,fontSize: 16,
|
||||
|
||||
),),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20,),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Flexible(child: Text("すでにアカウントをお持ちですか?")),
|
||||
TextButton(
|
||||
onPressed: (){
|
||||
Get.toNamed(AppPages.LOGIN);
|
||||
},
|
||||
child: Text("ログイン",style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 18
|
||||
),),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
// ),),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(height: 20,),
|
||||
// Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// Flexible(child: Text("すでにアカウントをお持ちですか?")),
|
||||
// TextButton(
|
||||
// onPressed: (){
|
||||
// Get.toNamed(AppPages.LOGIN);
|
||||
// },
|
||||
// child: Text("ログイン",style: TextStyle(
|
||||
// fontWeight: FontWeight.w600,
|
||||
// fontSize: 18
|
||||
// ),),
|
||||
// ),
|
||||
// ],
|
||||
// )
|
||||
// ],
|
||||
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
Widget makeInput({label, required TextEditingController controller, obsureText = false}){
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(label,style:TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors.black87
|
||||
),),
|
||||
SizedBox(height: 5,),
|
||||
TextField(
|
||||
controller: controller,
|
||||
obscureText: obsureText,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: (Colors.grey[400])!,
|
||||
),
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: (Colors.grey[400])!
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 30,)
|
||||
// Widget makeInput({label, required TextEditingController controller, obsureText = false}){
|
||||
// return Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Text(label,style:TextStyle(
|
||||
// fontSize: 15,
|
||||
// fontWeight: FontWeight.w400,
|
||||
// color: Colors.black87
|
||||
// ),),
|
||||
// SizedBox(height: 5,),
|
||||
// TextField(
|
||||
// controller: controller,
|
||||
// obscureText: obsureText,
|
||||
// decoration: InputDecoration(
|
||||
// contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
|
||||
// enabledBorder: OutlineInputBorder(
|
||||
// borderSide: BorderSide(
|
||||
// color: (Colors.grey[400])!,
|
||||
// ),
|
||||
// ),
|
||||
// border: OutlineInputBorder(
|
||||
// borderSide: BorderSide(color: (Colors.grey[400])!
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(height: 30,)
|
||||
|
||||
],
|
||||
);
|
||||
}
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
|
||||
11
lib/pages/rog/rog_binding.dart
Normal file
11
lib/pages/rog/rog_binding.dart
Normal file
@ -0,0 +1,11 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/rog/rog_controller.dart';
|
||||
import 'package:rogapp/utils/app_controller.dart';
|
||||
|
||||
class RogBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.put<AppController>(AppController());
|
||||
Get.put<RogController>(RogController());
|
||||
}
|
||||
}
|
||||
32
lib/pages/rog/rog_controller.dart
Normal file
32
lib/pages/rog/rog_controller.dart
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/model/location.dart';
|
||||
import 'package:sliding_up_panel/sliding_up_panel.dart';
|
||||
|
||||
class RogController extends GetxController {
|
||||
|
||||
// RX vars
|
||||
List<Location> locations = <Location>[].obs;
|
||||
var currentLocation = {}.obs;
|
||||
var currentUser = {}.obs;
|
||||
var isLoading = false.obs;
|
||||
|
||||
// Controllers in home page
|
||||
PanelController panelController = PanelController();
|
||||
MapController mapController = MapController();
|
||||
|
||||
|
||||
Location? getIncidentForLatLong(double lat, double long){
|
||||
for(Location l in locations){
|
||||
print("i - ${l.latitude}, ${l.longitude} -- ${lat}, ${long}");
|
||||
if(l.latitude == lat && l.longitude == long){
|
||||
return l;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
46
lib/pages/rog/rog_page.dart
Normal file
46
lib/pages/rog/rog_page.dart
Normal file
@ -0,0 +1,46 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:rogapp/model/location.dart';
|
||||
import 'package:rogapp/pages/rog/rog_controller.dart';
|
||||
import 'package:rogapp/utils/app_controller.dart';
|
||||
import 'package:rogapp/widgets/collapsed_widget.dart';
|
||||
import 'package:sliding_up_panel/sliding_up_panel.dart';
|
||||
|
||||
class RogPage extends StatelessWidget {
|
||||
RogPage({Key? key}) : super(key: key);
|
||||
|
||||
final AppController appController = Get.find<AppController>();
|
||||
final RogController rogController = Get.find<RogController>();
|
||||
|
||||
void addlocation(){
|
||||
print("called add location");
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("app_title".tr, style: TextStyle(fontSize: 28),),
|
||||
),
|
||||
body: ,
|
||||
);
|
||||
}
|
||||
|
||||
_scrollingList(ScrollController sc) {
|
||||
return ListView.builder(
|
||||
controller: sc,
|
||||
itemCount: 50,
|
||||
itemBuilder: (BuildContext context, int i){
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Text("$i"),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,9 +1,9 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/search/search_controller.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// import 'package:rogapp/pages/search/search_controller.dart';
|
||||
|
||||
class SearchBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.put<SearchController>(SearchController());
|
||||
}
|
||||
}
|
||||
// class SearchBinding extends Bindings {
|
||||
// @override
|
||||
// void dependencies() {
|
||||
// Get.put<SearchController>(SearchController());
|
||||
// }
|
||||
// }
|
||||
|
||||
@ -1,26 +1,26 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_state_manager/get_state_manager.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:geojson/geojson.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// import 'package:get/get_state_manager/get_state_manager.dart';
|
||||
// import 'package:rogapp/model/destination.dart';
|
||||
// import 'package:rogapp/pages/index/index_controller.dart';
|
||||
|
||||
class SearchController extends GetxController {
|
||||
// class SearchController extends GetxController {
|
||||
|
||||
List<GeoJsonFeature> searchResults = <GeoJsonFeature>[].obs;
|
||||
// List<GeoJsonFeature> searchResults = <GeoJsonFeature>[].obs;
|
||||
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
IndexController indexController = Get.find<IndexController>();
|
||||
if(indexController.locations.isNotEmpty){
|
||||
for(int i=0; i<= indexController.locations[0].collection.length - 1; i++){
|
||||
GeoJsonFeature p = indexController.locations[0].collection[i];
|
||||
searchResults.add(p);
|
||||
}
|
||||
}
|
||||
super.onInit();
|
||||
}
|
||||
// @override
|
||||
// void onInit() {
|
||||
// IndexController indexController = Get.find<IndexController>();
|
||||
// if(indexController.locations.isNotEmpty){
|
||||
// for(int i=0; i<= indexController.locations[0].collection.length - 1; i++){
|
||||
// GeoJsonFeature p = indexController.locations[0].collection[i];
|
||||
// searchResults.add(p);
|
||||
// }
|
||||
// }
|
||||
// super.onInit();
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
// }
|
||||
@ -1,97 +1,96 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_typeahead/flutter_typeahead.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/pages/search/search_controller.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||
// import 'package:flutter/cupertino.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:flutter_typeahead/flutter_typeahead.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// import 'package:rogapp/pages/index/index_controller.dart';
|
||||
// import 'package:rogapp/pages/search/search_controller.dart';
|
||||
// import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||
|
||||
class SearchPage extends StatelessWidget {
|
||||
SearchPage({Key? key}) : super(key: key);
|
||||
// class SearchPage extends StatelessWidget {
|
||||
// SearchPage({Key? key}) : super(key: key);
|
||||
|
||||
SearchController searchController = Get.find<SearchController>();
|
||||
IndexController indexController = Get.find<IndexController>();
|
||||
// SearchController searchController = Get.find<SearchController>();
|
||||
// IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
Image getImage(int index){
|
||||
if(searchController.searchResults[index].properties!["photos"] == null || searchController.searchResults[index].properties!["photos"] == ""){
|
||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
}
|
||||
else{
|
||||
return Image(
|
||||
image: NetworkImage(searchController.searchResults[index].properties!["photos"]),
|
||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
return Image.asset("assets/images/empty_image.png");
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
// Image getImage(int index){
|
||||
// if(searchController.searchResults[index].properties!["photos"] == null || searchController.searchResults[index].properties!["photos"] == ""){
|
||||
// return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
// }
|
||||
// else{
|
||||
// return Image(
|
||||
// image: NetworkImage(searchController.searchResults[index].properties!["photos"]),
|
||||
// errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
// return Image.asset("assets/images/empty_image.png");
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
backgroundColor: Colors.white,
|
||||
leading: IconButton(
|
||||
onPressed:(){
|
||||
Navigator.pop(context);
|
||||
},
|
||||
icon: const Icon(Icons.arrow_back_ios_new, color: Colors.black,)),
|
||||
title: TypeAheadField(
|
||||
textFieldConfiguration: TextFieldConfiguration(
|
||||
autofocus: true,
|
||||
),
|
||||
suggestionsCallback: (pattern) async{
|
||||
return searchController.searchResults.where((GeoJsonFeature element) => element.properties!["location_name"].toString().contains(pattern));
|
||||
//return await
|
||||
},
|
||||
itemBuilder: (context, GeoJsonFeature suggestion){
|
||||
return ListTile(
|
||||
title: Text(suggestion.properties!["location_name"]),
|
||||
subtitle: suggestion.properties!["category"] != null ? Text(suggestion.properties!["category"]) : Text(""),
|
||||
//leading: getImage(index),
|
||||
);
|
||||
},
|
||||
onSuggestionSelected: (GeoJsonFeature suggestion){
|
||||
indexController.currentFeature.clear();
|
||||
indexController.currentFeature.add(suggestion);
|
||||
Get.back();
|
||||
showModalBottomSheet(
|
||||
isScrollControlled: true,
|
||||
context: context,
|
||||
//builder: (context) => BottomSheetWidget(),
|
||||
builder:((context) => BottomSheetNew())
|
||||
);
|
||||
},
|
||||
),
|
||||
//title: const CupertinoSearchTextField(),
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Scaffold(
|
||||
// appBar: AppBar(
|
||||
// elevation: 0,
|
||||
// backgroundColor: Colors.white,
|
||||
// leading: IconButton(
|
||||
// onPressed:(){
|
||||
// Navigator.pop(context);
|
||||
// },
|
||||
// icon: const Icon(Icons.arrow_back_ios_new, color: Colors.black,)),
|
||||
// title: TypeAheadField(
|
||||
// textFieldConfiguration: TextFieldConfiguration(
|
||||
// autofocus: true,
|
||||
// ),
|
||||
// suggestionsCallback: (pattern) async{
|
||||
// return searchController.searchResults.where((GeoJsonFeature element) => element.properties!["location_name"].toString().contains(pattern));
|
||||
// //return await
|
||||
// },
|
||||
// itemBuilder: (context, GeoJsonFeature suggestion){
|
||||
// return ListTile(
|
||||
// title: Text(suggestion.properties!["location_name"]),
|
||||
// subtitle: suggestion.properties!["category"] != null ? Text(suggestion.properties!["category"]) : Text(""),
|
||||
// //leading: getImage(index),
|
||||
// );
|
||||
// },
|
||||
// onSuggestionSelected: (GeoJsonFeature suggestion){
|
||||
// indexController.currentFeature.clear();
|
||||
// indexController.currentFeature.add(suggestion);
|
||||
// Get.back();
|
||||
// showModalBottomSheet(
|
||||
// isScrollControlled: true,
|
||||
// context: context,
|
||||
// //builder: (context) => BottomSheetWidget(),
|
||||
// builder:((context) => BottomSheetNew())
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// //title: const CupertinoSearchTextField(),
|
||||
|
||||
),
|
||||
//body:
|
||||
// Obx(() =>
|
||||
// ListView.builder(
|
||||
// itemCount: searchController.searchResults.length,
|
||||
// itemBuilder: (context, index){
|
||||
// return ListTile(
|
||||
// title: searchController.searchResults[index].properties!["location_name"] != null ? Text(searchController.searchResults[index].properties!["location_name"]) : Text(""),
|
||||
// subtitle: searchController.searchResults[index].properties!["category"] != null ? Text(searchController.searchResults[index].properties!["category"]) : Text(""),
|
||||
// leading: getImage(index),
|
||||
// onTap: (){
|
||||
// indexController.currentFeature.clear();
|
||||
// indexController.currentFeature.add(searchController.searchResults[index]);
|
||||
// Get.back();
|
||||
// showModalBottomSheet(
|
||||
// isScrollControlled: true,
|
||||
// context: context,
|
||||
// //builder: (context) => BottomSheetWidget(),
|
||||
// builder:((context) => BottomSheetNew())
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// )
|
||||
);
|
||||
}
|
||||
}
|
||||
// ),
|
||||
// //body:
|
||||
// // Obx(() =>
|
||||
// // ListView.builder(
|
||||
// // itemCount: searchController.searchResults.length,
|
||||
// // itemBuilder: (context, index){
|
||||
// // return ListTile(
|
||||
// // title: searchController.searchResults[index].properties!["location_name"] != null ? Text(searchController.searchResults[index].properties!["location_name"]) : Text(""),
|
||||
// // subtitle: searchController.searchResults[index].properties!["category"] != null ? Text(searchController.searchResults[index].properties!["category"]) : Text(""),
|
||||
// // leading: getImage(index),
|
||||
// // onTap: (){
|
||||
// // indexController.currentFeature.clear();
|
||||
// // indexController.currentFeature.add(searchController.searchResults[index]);
|
||||
// // Get.back();
|
||||
// // showModalBottomSheet(
|
||||
// // isScrollControlled: true,
|
||||
// // context: context,
|
||||
// // //builder: (context) => BottomSheetWidget(),
|
||||
// // builder:((context) => BottomSheetNew())
|
||||
// // );
|
||||
// // },
|
||||
// // );
|
||||
// // },
|
||||
// // ),
|
||||
// // )
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
9
lib/pages/select/select_binding.dart
Normal file
9
lib/pages/select/select_binding.dart
Normal file
@ -0,0 +1,9 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/select/select_controller.dart';
|
||||
|
||||
class SelectBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.put<SelectController>(SelectController());
|
||||
}
|
||||
}
|
||||
5
lib/pages/select/select_controller.dart
Normal file
5
lib/pages/select/select_controller.dart
Normal file
@ -0,0 +1,5 @@
|
||||
import 'package:get/get_state_manager/get_state_manager.dart';
|
||||
|
||||
class SelectController extends GetxController{
|
||||
|
||||
}
|
||||
10
lib/pages/select/select_page.dart
Normal file
10
lib/pages/select/select_page.dart
Normal file
@ -0,0 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SelectPage extends StatelessWidget {
|
||||
const SelectPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
76
lib/pages/select_slider/select_slider_page.dart
Normal file
76
lib/pages/select_slider/select_slider_page.dart
Normal file
@ -0,0 +1,76 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/src/foundation/key.dart';
|
||||
import 'package:flutter/src/widgets/container.dart';
|
||||
import 'package:flutter/src/widgets/framework.dart';
|
||||
import 'package:sliding_up_panel/sliding_up_panel.dart';
|
||||
|
||||
class SelectSliderPage extends StatelessWidget {
|
||||
const SelectSliderPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SlidingUpPanel(
|
||||
//header: Text("header"),
|
||||
minHeight: 55,
|
||||
footer: Text("footer"),
|
||||
//isDraggable: true,
|
||||
backdropTapClosesPanel: true,
|
||||
parallaxEnabled: true,
|
||||
parallaxOffset: 0.6,
|
||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(10), topRight: Radius.circular(10)),
|
||||
backdropEnabled: true,
|
||||
backdropOpacity: 0.2,
|
||||
controller: rogController.panelController,
|
||||
collapsed: CollapsedWidget(addIncident : addlocation),
|
||||
panelBuilder:(sc) => _scrollingList(sc),
|
||||
body: Center(
|
||||
child: Obx((() =>
|
||||
FlutterMap(
|
||||
mapController: rogController.mapController,
|
||||
options: MapOptions(
|
||||
center: LatLng(8, 80),
|
||||
zoom: 8,
|
||||
),
|
||||
nonRotatedChildren: [
|
||||
//Center(
|
||||
// child: Image(
|
||||
// image: AssetImage('assets/icons/crosshair.512x512.png'),
|
||||
// width: 35,
|
||||
// height: 35,
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
children: [
|
||||
TileLayer(
|
||||
urlTemplate: "https://tile.openstreetmap.org/{z}/{x}/{y}.png",
|
||||
userAgentPackageName: 'dev.fleaflet.flutter_map.example',
|
||||
),
|
||||
MarkerLayer(
|
||||
markers: rogController.locations.map((l) {
|
||||
return Marker(
|
||||
anchorPos: AnchorPos.align(AnchorAlign.center),
|
||||
height: 70.0,
|
||||
width: 70.0,
|
||||
point: LatLng(l.latitude!, l.longitude!),
|
||||
builder: (ctx){
|
||||
return IconButton(
|
||||
onPressed: () {
|
||||
Location? loc = rogController.getIncidentForLatLong(l.latitude!, l.longitude!);
|
||||
if(loc != null){
|
||||
rogController.currentLocation.value = loc.toMap();
|
||||
rogController.panelController.open();
|
||||
}
|
||||
},
|
||||
icon: Icon(Icons.pin_drop, size: 38, color: Colors.red,)
|
||||
);
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
)
|
||||
],
|
||||
)
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,31 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
|
||||
class SubPerfPage extends StatelessWidget {
|
||||
SubPerfPage({Key? key}) : super(key: key);
|
||||
|
||||
IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("Select Sub Perfecture"),
|
||||
),
|
||||
body: ListView.builder(
|
||||
itemCount: indexController.subPerfs.length,
|
||||
itemBuilder: (context, index){
|
||||
return ListTile(
|
||||
onTap: (){
|
||||
indexController.dropdownValue = indexController.perfectures[index][0]["id"].toString();
|
||||
//indexController.populateForPerf(indexController.dropdownValue, indexController.mapController!);
|
||||
Get.back();
|
||||
},
|
||||
title: Text(indexController.perfectures[index][0]["adm1_ja"].toString()),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -2,20 +2,16 @@ import 'package:get/get.dart';
|
||||
import 'package:get/get_navigation/src/routes/get_route.dart';
|
||||
import 'package:rogapp/pages/category/category_page.dart';
|
||||
import 'package:rogapp/pages/city/city_page.dart';
|
||||
import 'package:rogapp/pages/destination/destination_binding.dart';
|
||||
import 'package:rogapp/pages/destination/destination_page.dart';
|
||||
import 'package:rogapp/pages/home/home_binding.dart';
|
||||
import 'package:rogapp/pages/home/home_page.dart';
|
||||
|
||||
import 'package:rogapp/pages/index/index_page.dart';
|
||||
import 'package:rogapp/pages/landing/landing_page.dart';
|
||||
import 'package:rogapp/pages/loading/loading_page.dart';
|
||||
import 'package:rogapp/pages/login/login_page.dart';
|
||||
import 'package:rogapp/pages/mainperf/mainperf_page.dart';
|
||||
import 'package:rogapp/pages/permission/permission.dart';
|
||||
import 'package:rogapp/pages/register/register_page.dart';
|
||||
import 'package:rogapp/pages/rog/rog_page.dart';
|
||||
import 'package:rogapp/pages/search/search_binding.dart';
|
||||
import 'package:rogapp/pages/search/search_page.dart';
|
||||
import 'package:rogapp/pages/select/select_page.dart';
|
||||
import 'package:rogapp/pages/subperf/subperf_page.dart';
|
||||
import 'package:rogapp/spa/spa_binding.dart';
|
||||
import 'package:rogapp/spa/spa_page.dart';
|
||||
@ -30,92 +26,25 @@ class AppPages {
|
||||
// ignore: constant_identifier_names
|
||||
static const SPA = Routes.SPA;
|
||||
static const LANDING = Routes.LANDING;
|
||||
static const LOGIN = Routes.LOGIN;
|
||||
static const REGISTER = Routes.REGISTER;
|
||||
static const TRAVEL = Routes.TRAVEL;
|
||||
static const LOADING = Routes.LOADING;
|
||||
static const DESTINATION_MAP = Routes.DESTINATION_MAP;
|
||||
static const HOME = Routes.HOME;
|
||||
static const PERMISSION = Routes.PERMISSION;
|
||||
static const SEARCH = Routes.SEARCH;
|
||||
static const MAINPERF = Routes.MAINPERF;
|
||||
static const SUBPERF = Routes.SUBPERF;
|
||||
static const CITY = Routes.CITY;
|
||||
static const CATEGORY = Routes.CATEOGORY;
|
||||
static const SELECT = Routes.SELECT;
|
||||
static const ROG = Routes.ROG;
|
||||
|
||||
static final routes = [
|
||||
// GetPage(
|
||||
// name: Routes.HOME,
|
||||
// page: () => HomePage(),
|
||||
// binding: HomeBinding(),
|
||||
// ),
|
||||
// GetPage(
|
||||
// name: Routes.MAP,
|
||||
// page: () => MapPage(),
|
||||
// binding: MapBinding(),
|
||||
// )
|
||||
GetPage(
|
||||
name: Routes.INDEX,
|
||||
page: () => IndexPage(),
|
||||
//binding: IndexBinding(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.SPA,
|
||||
page: () => const SpaPage(),
|
||||
binding: SpaBinding(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.LANDING,
|
||||
page: () => LandingPage(),
|
||||
//binding: SpaBinding(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.LOGIN,
|
||||
page: () => LoginPage(),
|
||||
//binding: SpaBinding(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.REGISTER,
|
||||
page: () => RegisterPage(),
|
||||
//binding: SpaBinding(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.TRAVEL,
|
||||
page: () => DestinationPage(),
|
||||
binding: DestinationBinding(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.LOADING,
|
||||
page: () => LoadingPage(),
|
||||
//binding: DestinationBinding(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.DESTINATION_MAP,
|
||||
page: () => DestinationPage(),
|
||||
//binding: DestinationBinding(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.HOME,
|
||||
page: () => HomePage(),
|
||||
binding: HomeBinding(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.PERMISSION,
|
||||
page: () => PermissionHandlerScreen(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.SEARCH,
|
||||
page: () => SearchPage(),
|
||||
binding: SearchBinding(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.MAINPERF,
|
||||
page: () => MainPerfPage(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.SUBPERF,
|
||||
page: () => SubPerfPage(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.CITY,
|
||||
page: () => CityPage(),
|
||||
@ -123,6 +52,14 @@ class AppPages {
|
||||
GetPage(
|
||||
name: Routes.CATEOGORY,
|
||||
page: () => CategoryPage(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.SELECT,
|
||||
page: () => SelectPage(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.ROG,
|
||||
page: () => RogPage(),
|
||||
)
|
||||
];
|
||||
}
|
||||
@ -21,4 +21,6 @@ abstract class Routes {
|
||||
static const SUBPERF = '/subperf';
|
||||
static const CITY = '/city';
|
||||
static const CATEOGORY = '/category';
|
||||
static const SELECT = '/select';
|
||||
static const ROG = '/rog';
|
||||
}
|
||||
|
||||
@ -1,103 +1,103 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
|
||||
//import 'package:google_maps_webservice/directions.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
// import 'dart:convert';
|
||||
// import 'package:flutter_polyline_points/flutter_polyline_points.dart';
|
||||
// //import 'package:google_maps_webservice/directions.dart';
|
||||
// import 'package:http/http.dart' as http;
|
||||
// import 'package:rogapp/model/destination.dart';
|
||||
|
||||
import '../utils/const.dart';
|
||||
// import '../utils/const.dart';
|
||||
|
||||
|
||||
class DestinationService{
|
||||
// class DestinationService{
|
||||
|
||||
static Future<List<dynamic>> getDestinations(int user_id) async {
|
||||
List<dynamic> cats = [];
|
||||
String server_url = ConstValues.currentServer();
|
||||
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(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
}
|
||||
);
|
||||
// static Future<List<dynamic>> getDestinations(int user_id) async {
|
||||
// List<dynamic> cats = [];
|
||||
// String server_url = ConstValues.currentServer();
|
||||
// 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(
|
||||
// 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;
|
||||
}
|
||||
// if (response.statusCode == 200) {
|
||||
// cats = json.decode(utf8.decode(response.bodyBytes));
|
||||
// }
|
||||
// return cats;
|
||||
// }
|
||||
|
||||
static Future<Map<String, dynamic>> deleteDestination(int dest_id) async {
|
||||
Map<String, dynamic> cats = {};
|
||||
String server_url = ConstValues.currentServer();
|
||||
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(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
}
|
||||
);
|
||||
// static Future<Map<String, dynamic>> deleteDestination(int dest_id) async {
|
||||
// Map<String, dynamic> cats = {};
|
||||
// String server_url = ConstValues.currentServer();
|
||||
// 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(
|
||||
// Uri.parse(url),
|
||||
// headers: <String, String>{
|
||||
// 'Content-Type': 'application/json; charset=UTF-8',
|
||||
// }
|
||||
// );
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
cats = json.decode(utf8.decode(response.bodyBytes));
|
||||
}
|
||||
print("####### ---- ${cats}");
|
||||
return cats;
|
||||
}
|
||||
// if (response.statusCode == 200) {
|
||||
// cats = json.decode(utf8.decode(response.bodyBytes));
|
||||
// }
|
||||
// print("####### ---- ${cats}");
|
||||
// return cats;
|
||||
// }
|
||||
|
||||
static Future<int> updateOrder(int action_id, int order, String dir) async {
|
||||
int cats = 0;
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = "${server_url}/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
|
||||
print("---- url is ${url} -----");
|
||||
//String url = "http://localhost:8100/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
}
|
||||
);
|
||||
// static Future<int> updateOrder(int action_id, int order, String dir) async {
|
||||
// int cats = 0;
|
||||
// String server_url = ConstValues.currentServer();
|
||||
// String url = "${server_url}/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
|
||||
// print("---- url is ${url} -----");
|
||||
// //String url = "http://localhost:8100/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
|
||||
// final http.Response 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;
|
||||
}
|
||||
// if (response.statusCode == 200) {
|
||||
// cats = json.decode(utf8.decode(response.bodyBytes));
|
||||
// }
|
||||
// return cats;
|
||||
// }
|
||||
|
||||
static Future<List<PointLatLng>>? getDestinationLine(List<Destination> destinations) async{
|
||||
PolylinePoints polylinePoints = PolylinePoints();
|
||||
// static Future<List<PointLatLng>>? getDestinationLine(List<Destination> destinations) async{
|
||||
// PolylinePoints polylinePoints = PolylinePoints();
|
||||
|
||||
if(destinations.length <= 0){
|
||||
return [];
|
||||
}
|
||||
// if(destinations.length <= 0){
|
||||
// return [];
|
||||
// }
|
||||
|
||||
//print("##### @@@@@ ${destinations[0].lat}");
|
||||
PointLatLng origin = PointLatLng(destinations[0].lat!, destinations[0].lon!);
|
||||
PointLatLng dest = PointLatLng(destinations[destinations.length -1].lat!, destinations[destinations.length -1].lon!);
|
||||
// //print("##### @@@@@ ${destinations[0].lat}");
|
||||
// PointLatLng origin = PointLatLng(destinations[0].lat!, destinations[0].lon!);
|
||||
// PointLatLng dest = PointLatLng(destinations[destinations.length -1].lat!, destinations[destinations.length -1].lon!);
|
||||
|
||||
|
||||
List<PolylineWayPoint> wayPoints = [];
|
||||
int i=0;
|
||||
for(dynamic d in destinations){
|
||||
if(i == 0 || i == (destinations.length -1)){
|
||||
i+=1;
|
||||
continue;
|
||||
}
|
||||
double la = d.lat;
|
||||
double ln = d.lon;
|
||||
PolylineWayPoint pwp = PolylineWayPoint(location: "${la},${ln}", stopOver: true);
|
||||
//print("----- UUUUUU ${pwp}");
|
||||
//PointLatLng wp = PointLatLng(d["Location"]["geometry"][0][1], d["Location"]["geometry"][0][0]);
|
||||
wayPoints.add(pwp);
|
||||
i+=1;
|
||||
}
|
||||
//PolylineResult result = await polylinePoints.getRouteBetweenCoordinates("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE", PointLatLng(35.389282, 136.498027), PointLatLng(36.285848, 137.575186));
|
||||
PolylineResult result = await polylinePoints.getRouteBetweenCoordinates("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE", origin,dest, travelMode: TravelMode.driving, wayPoints: wayPoints);
|
||||
//print("#####@@@@@ ${result.points}");
|
||||
return result.points;
|
||||
}
|
||||
// List<PolylineWayPoint> wayPoints = [];
|
||||
// int i=0;
|
||||
// for(dynamic d in destinations){
|
||||
// if(i == 0 || i == (destinations.length -1)){
|
||||
// i+=1;
|
||||
// continue;
|
||||
// }
|
||||
// double la = d.lat;
|
||||
// double ln = d.lon;
|
||||
// PolylineWayPoint pwp = PolylineWayPoint(location: "${la},${ln}", stopOver: true);
|
||||
// //print("----- UUUUUU ${pwp}");
|
||||
// //PointLatLng wp = PointLatLng(d["Location"]["geometry"][0][1], d["Location"]["geometry"][0][0]);
|
||||
// wayPoints.add(pwp);
|
||||
// i+=1;
|
||||
// }
|
||||
// //PolylineResult result = await polylinePoints.getRouteBetweenCoordinates("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE", PointLatLng(35.389282, 136.498027), PointLatLng(36.285848, 137.575186));
|
||||
// PolylineResult result = await polylinePoints.getRouteBetweenCoordinates("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE", origin,dest, travelMode: TravelMode.driving, wayPoints: wayPoints);
|
||||
// //print("#####@@@@@ ${result.points}");
|
||||
// return result.points;
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
@ -1,35 +1,35 @@
|
||||
import 'package:geojson/geojson.dart';
|
||||
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../utils/const.dart';
|
||||
|
||||
class LocationLineService{
|
||||
|
||||
static Future<GeoJsonFeature?> loadLocationLines() async {
|
||||
final geo = GeoJson();
|
||||
GeoJsonFeature? fs;
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/location_line/';
|
||||
//String url = 'http://localhost:8100/api/location_line/';
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
},
|
||||
);
|
||||
// static Future<GeoJsonFeature?> loadLocationLines() async {
|
||||
// final geo = GeoJson();
|
||||
// GeoJsonFeature? fs;
|
||||
// String server_url = ConstValues.currentServer();
|
||||
// String url = '${server_url}/api/location_line/';
|
||||
// //String url = 'http://localhost:8100/api/location_line/';
|
||||
// final response = await http.get(Uri.parse(url),
|
||||
// headers: <String, String>{
|
||||
// 'Content-Type': 'application/json; charset=UTF-8',
|
||||
// },
|
||||
// );
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
// if (response.statusCode == 200) {
|
||||
|
||||
geo.processedFeatures.listen((fst) {
|
||||
fs = fst;
|
||||
});
|
||||
// geo.processedFeatures.listen((fst) {
|
||||
// fs = fst;
|
||||
// });
|
||||
|
||||
await geo.parse(response.body, verbose:true);
|
||||
// await geo.parse(response.body, verbose:true);
|
||||
|
||||
return fs;
|
||||
// return fs;
|
||||
|
||||
} else {
|
||||
throw Exception('Failed to create album.');
|
||||
}
|
||||
}
|
||||
// } else {
|
||||
// throw Exception('Failed to create album.');
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
@ -1,36 +1,35 @@
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../utils/const.dart';
|
||||
|
||||
class LocationPolygonervice{
|
||||
|
||||
static Future<GeoJsonFeature?> loadLocationLines() async {
|
||||
final geo = GeoJson();
|
||||
GeoJsonFeature? fs;
|
||||
// static Future<GeoJsonFeature?> loadLocationLines() async {
|
||||
// final geo = GeoJson();
|
||||
// GeoJsonFeature? fs;
|
||||
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/location_polygon/';
|
||||
//String url = 'http://localhost:8100/api/location_polygon/';
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
},
|
||||
);
|
||||
// String server_url = ConstValues.currentServer();
|
||||
// String url = '${server_url}/api/location_polygon/';
|
||||
// //String url = 'http://localhost:8100/api/location_polygon/';
|
||||
// final response = await http.get(Uri.parse(url),
|
||||
// headers: <String, String>{
|
||||
// 'Content-Type': 'application/json; charset=UTF-8',
|
||||
// },
|
||||
// );
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
// if (response.statusCode == 200) {
|
||||
|
||||
geo.processedFeatures.listen((fst) {
|
||||
fs = fst;
|
||||
});
|
||||
// geo.processedFeatures.listen((fst) {
|
||||
// fs = fst;
|
||||
// });
|
||||
|
||||
await geo.parse(response.body, verbose:true);
|
||||
// await geo.parse(response.body, verbose:true);
|
||||
|
||||
return fs;
|
||||
// return fs;
|
||||
|
||||
} else {
|
||||
throw Exception('Failed to create album.');
|
||||
}
|
||||
}
|
||||
// } else {
|
||||
// throw Exception('Failed to create album.');
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
@ -1,15 +1,20 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:geojson_vi/geojson_vi.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:rogapp/model/location.dart';
|
||||
import 'package:rogapp/utils/const.dart';
|
||||
|
||||
class LocationService{
|
||||
class LocationService extends GetxService{
|
||||
Future<LocationService> init() async {
|
||||
print('$runtimeType ready!');
|
||||
return this;
|
||||
}
|
||||
|
||||
static Future<GeoJsonFeatureCollection?> loadLocations() async {
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/location/';
|
||||
//String url = 'http://localhost:8100/api/location/';
|
||||
Future<List<Location>> loadLocations() async {
|
||||
List<Location> locs = [];
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '${serverUrl}/api/location/';
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -17,25 +22,29 @@ class LocationService{
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
|
||||
return featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
||||
GeoJSONFeatureCollection coll = GeoJSONFeatureCollection.fromJSON(utf8.decode(response.bodyBytes));
|
||||
for(int i=0; i<coll.features.length; i++ ){
|
||||
GeoJSONFeature? gf = coll.features[i];
|
||||
if(gf != null){
|
||||
Location l = Location.fromGeoJSONFeture(gf);
|
||||
locs.add(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return locs;
|
||||
}
|
||||
|
||||
static Future<GeoJsonFeatureCollection?> loadLocationsFor(String perfecture, String cat) async {
|
||||
Future<List<Location>> loadLocationsFor(String perfecture, String cat) async {
|
||||
List<Location> locs = [];
|
||||
String url = "";
|
||||
String server_url = ConstValues.currentServer();
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
if(cat.isNotEmpty){
|
||||
url = '${server_url}/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
||||
//url = 'http://localhost:8100/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
||||
url = '${serverUrl}/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
||||
}
|
||||
else{
|
||||
url = '${server_url}/api/inperf/?perf=' + perfecture;
|
||||
//url = 'http://localhost:8100/api/inperf/?perf=' + perfecture;
|
||||
url = '${serverUrl}/api/inperf/?perf=' + perfecture;
|
||||
}
|
||||
//print("----- url ---- ${url} --- ${cat}");
|
||||
//String url = 'http://localhost:8100/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -43,25 +52,29 @@ class LocationService{
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
GeoJsonFeatureCollection cc = await featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
||||
//print(cc);
|
||||
return cc; //featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
||||
GeoJSONFeatureCollection coll = GeoJSONFeatureCollection.fromJSON(utf8.decode(response.bodyBytes));
|
||||
for(int i=0; i<coll.features.length; i++ ){
|
||||
GeoJSONFeature? gf = coll.features[i];
|
||||
if(gf != null){
|
||||
Location l = Location.fromGeoJSONFeture(gf);
|
||||
locs.add(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return locs;
|
||||
}
|
||||
|
||||
|
||||
static Future<GeoJsonFeatureCollection?> loadLocationsSubFor(String subperfecture, String cat) async {
|
||||
Future<List<Location>> loadLocationsSubFor(String subperfecture, String cat) async {
|
||||
List<Location> locs = [];
|
||||
String url = "";
|
||||
String server_url = ConstValues.currentServer();
|
||||
if(cat.isNotEmpty){
|
||||
url = '${server_url}/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
|
||||
//url = 'http://localhost:8100/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
|
||||
}
|
||||
else{
|
||||
print("------ loading location in sub----");
|
||||
url = '${server_url}/api/insubperf?subperf=' + subperfecture;
|
||||
//url = 'http://localhost:8100/api/insubperf?subperf=' + subperfecture;
|
||||
}
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
@ -70,55 +83,52 @@ class LocationService{
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
GeoJsonFeatureCollection cc = await featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
||||
//print(cc);
|
||||
return cc; //featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
||||
GeoJSONFeatureCollection coll = GeoJSONFeatureCollection.fromJSON(utf8.decode(response.bodyBytes));
|
||||
for(int i=0; i<coll.features.length; i++ ){
|
||||
GeoJSONFeature? gf = coll.features[i];
|
||||
if(gf != null){
|
||||
Location l = Location.fromGeoJSONFeture(gf);
|
||||
locs.add(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return locs;
|
||||
}
|
||||
|
||||
|
||||
static Future<GeoJsonFeatureCollection?> loadLocationsBound(double lat1, double lon1, double lat2, double lon2, double lat3, double lon3, double lat4, double lon4, String cat) async {
|
||||
Future<List<Location>> loadLocationsBound(double lat1, double lon1, double lat2, double lon2, double lat3, double lon3, double lat4, double lon4, String cat) async {
|
||||
List<Location> locs = [];
|
||||
String url = "";
|
||||
String server_url = ConstValues.currentServer();
|
||||
print("cat is ----- ${cat}");
|
||||
//print("cat is ----- ${cat}");
|
||||
if(cat.isNotEmpty){
|
||||
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;
|
||||
}
|
||||
else{
|
||||
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}';
|
||||
}
|
||||
print("----url --- ${url}");
|
||||
//print("----url --- ${url}");
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
},
|
||||
);
|
||||
|
||||
if (response.statusCode == 500) {
|
||||
return GeoJsonFeatureCollection(); //featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
||||
}
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
GeoJsonFeatureCollection cc = await featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
||||
if(cc.collection.isEmpty){
|
||||
return null;
|
||||
}
|
||||
else{
|
||||
return cc;
|
||||
GeoJSONFeatureCollection coll = GeoJSONFeatureCollection.fromJSON(utf8.decode(response.bodyBytes));
|
||||
for(int i=0; i<coll.features.length; i++ ){
|
||||
GeoJSONFeature? gf = coll.features[i];
|
||||
if(gf != null){
|
||||
Location l = Location.fromGeoJSONFeture(gf);
|
||||
locs.add(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return locs;
|
||||
}
|
||||
|
||||
|
||||
static Future<GeoJsonFeatureCollection?> loadCustomLocations(String name, String cat) async {
|
||||
Future<List<Location>> loadCustomLocations(String name, String cat) async {
|
||||
List<Location> locs = [];
|
||||
String url = "";
|
||||
if(cat == "-all-"){
|
||||
cat = "";
|
||||
}
|
||||
String server_url = ConstValues.currentServer();
|
||||
print("cat is ----- ${cat}");
|
||||
if(cat.isNotEmpty){
|
||||
@ -136,23 +146,18 @@ class LocationService{
|
||||
},
|
||||
);
|
||||
|
||||
if (response.statusCode == 500) {
|
||||
return GeoJsonFeatureCollection(); //featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
||||
}
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
GeoJsonFeatureCollection cc = await featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
||||
if(cc.collection.isEmpty){
|
||||
return null;
|
||||
}
|
||||
else{
|
||||
return cc;
|
||||
if (response.statusCode == 200) {
|
||||
GeoJSONFeatureCollection coll = GeoJSONFeatureCollection.fromJSON(utf8.decode(response.bodyBytes));
|
||||
for(int i=0; i<coll.features.length; i++ ){
|
||||
GeoJSONFeature? gf = coll.features[i];
|
||||
if(gf != null){
|
||||
Location l = Location.fromGeoJSONFeture(gf);
|
||||
locs.add(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return locs;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,47 +1,47 @@
|
||||
|
||||
import 'dart:convert';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
// import 'dart:convert';
|
||||
// import 'package:http/http.dart' as http;
|
||||
// import 'package:rogapp/model/destination.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 {
|
||||
|
||||
String locs = "";
|
||||
String origin = "";
|
||||
int i = 0;
|
||||
for(Destination d in destinations){
|
||||
// String locs = "";
|
||||
// String origin = "";
|
||||
// int i = 0;
|
||||
// for(Destination d in destinations){
|
||||
|
||||
print("---- getting matrix for ${d} ------------");
|
||||
// print("---- getting matrix for ${d} ------------");
|
||||
|
||||
if(i==0){
|
||||
origin = "${d.lat}, ${d.lon}";
|
||||
}
|
||||
// if(i==0){
|
||||
// origin = "${d.lat}, ${d.lon}";
|
||||
// }
|
||||
|
||||
print("lat is ${d.lat}, long is ${d.lon}");
|
||||
locs += "${d.lat}, ${d.lon}|";
|
||||
i++;
|
||||
}
|
||||
// print("lat is ${d.lat}, long is ${d.lon}");
|
||||
// locs += "${d.lat}, ${d.lon}|";
|
||||
// i++;
|
||||
// }
|
||||
|
||||
//print(locs);
|
||||
// //print(locs);
|
||||
|
||||
Map<String, dynamic> cats = {};
|
||||
String url = "https://maps.googleapis.com/maps/api/distancematrix/json?destinations=${locs}&origins=${origin}&key=AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE";
|
||||
print(url);
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
}
|
||||
);
|
||||
// Map<String, dynamic> cats = {};
|
||||
// String url = "https://maps.googleapis.com/maps/api/distancematrix/json?destinations=${locs}&origins=${origin}&key=AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE";
|
||||
// print(url);
|
||||
// final http.Response response = await http.get(
|
||||
// Uri.parse(url),
|
||||
// headers: <String, String>{
|
||||
// 'Content-Type': 'application/json; charset=UTF-8',
|
||||
// }
|
||||
// );
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
cats = json.decode(utf8.decode(response.bodyBytes));
|
||||
}
|
||||
return cats;
|
||||
}
|
||||
// if (response.statusCode == 200) {
|
||||
// cats = json.decode(utf8.decode(response.bodyBytes));
|
||||
// }
|
||||
// return cats;
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
9
lib/utils/app_binding.dart
Normal file
9
lib/utils/app_binding.dart
Normal file
@ -0,0 +1,9 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/utils/app_controller.dart';
|
||||
|
||||
class AppBinding extends Bindings{
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.put<AppController>(AppController());
|
||||
}
|
||||
}
|
||||
6
lib/utils/app_controller.dart
Normal file
6
lib/utils/app_controller.dart
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
import 'package:get/get_state_manager/get_state_manager.dart';
|
||||
|
||||
class AppController extends GetxController{
|
||||
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
import 'dart:io';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/model/location.dart';
|
||||
import 'package:sqflite/sqflite.dart';
|
||||
import 'package:path/path.dart';
|
||||
|
||||
@ -22,44 +22,62 @@ class DatabaseHelper{
|
||||
return openDatabase(join(await getDatabasesPath(), 'rog.db',), version: 1, onCreate: _onCreate);
|
||||
}
|
||||
|
||||
|
||||
Future _onCreate(Database db, int version) async {
|
||||
await db.execute('''
|
||||
CREATE TABLE destination(
|
||||
location_id INTEGER PRIMARY KEY,
|
||||
name TEXT,
|
||||
address TEXT,
|
||||
phone TEXT,
|
||||
email TEXT,
|
||||
webcontents TEXT,
|
||||
videos TEXT,
|
||||
location_name TEXT,
|
||||
category TEXT,
|
||||
series INTEGER,
|
||||
lat REAL,
|
||||
lon REAL,
|
||||
list_order INTEGER,
|
||||
zip TEXT,
|
||||
address TEXT,
|
||||
prefecture TEXT,
|
||||
area TEXT,
|
||||
city TEXT,
|
||||
latitude REAL,
|
||||
longitude REAL,
|
||||
photos TEXT,
|
||||
checkin_radious REAL,
|
||||
fax TEXT,
|
||||
email TEXT,
|
||||
facility TEXT,
|
||||
remark TEXT,
|
||||
tags TEXT,
|
||||
event_name TEXT,
|
||||
event_active INTEGER,
|
||||
hidden_location INTEGER,
|
||||
auto_checkin INTEGER,
|
||||
selected INTEGER,
|
||||
checkedin INTEGER
|
||||
checkin_radius INTEGER,
|
||||
checkin_point INTEGER,
|
||||
buy_point INTEGER,
|
||||
evaluation_value TEXT,
|
||||
shop_closed INTEGER,
|
||||
shop_shutdown INTEGER,
|
||||
opening_hours_mon TEXT,
|
||||
opening_hours_tue TEXT,
|
||||
opening_hours_wed TEXT,
|
||||
opening_hours_thu TEXT,
|
||||
opening_hours_fri TEXT,
|
||||
opening_hours_sat TEXT,
|
||||
opening_hours_sun TEXT
|
||||
parammeters TEXT
|
||||
)
|
||||
''');
|
||||
}
|
||||
|
||||
Future<List<Destination>> getDestinations() async {
|
||||
Future<List<Location>> getDestinations() async {
|
||||
Database db = await instance.database;
|
||||
var dest = await db.query('destination');
|
||||
List<Destination> destList = dest.isNotEmpty ?
|
||||
dest.map((e) => Destination.fromMap(e)).toList() : [];
|
||||
List<Location> destList = dest.isNotEmpty ?
|
||||
dest.map((e) => Location.fromMap(e)).toList() : [];
|
||||
print("--------- ${destList}");
|
||||
return destList;
|
||||
}
|
||||
|
||||
Future<List<Destination>> getDestinationByLatLon(double lat, double lon) async {
|
||||
Future<List<Location>> getDestinationByLatLon(double lat, double lon) async {
|
||||
Database db = await instance.database;
|
||||
var dest = await db.query('destination', where: "lat = ${lat} and lon= ${lon}");
|
||||
List<Destination> destList = dest.isNotEmpty
|
||||
? dest.map((e) => Destination.fromMap(e)).toList() : [];
|
||||
List<Location> destList = dest.isNotEmpty
|
||||
? dest.map((e) => Location.fromMap(e)).toList() : [];
|
||||
return destList;
|
||||
}
|
||||
|
||||
@ -76,7 +94,7 @@ class DatabaseHelper{
|
||||
return dest > 0 ? true : false;
|
||||
}
|
||||
|
||||
Future<int> insertDestination(Destination dest) async {
|
||||
Future<int> insertDestination(Location dest) async {
|
||||
Database db = await instance.database;
|
||||
int res = await db.insert(
|
||||
'destination',
|
||||
@ -87,7 +105,7 @@ class DatabaseHelper{
|
||||
return res;
|
||||
}
|
||||
|
||||
Future<int> updateAction(Destination destination, bool checkin)async {
|
||||
Future<int> updateAction(Location destination, bool checkin)async {
|
||||
Database db = await instance.database;
|
||||
int act = checkin == false ? 0 : 1;
|
||||
Map<String, dynamic> row = {
|
||||
@ -101,10 +119,5 @@ class DatabaseHelper{
|
||||
);
|
||||
}
|
||||
|
||||
// Future<int?> getPending() async{
|
||||
// Database db = await instance.database;
|
||||
// return await Sqflite.firstIntValue(await db.rawQuery("SELECT COUNT(*) FROM incidents"));
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,22 +1,22 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:flutter_map/flutter_map.dart';
|
||||
|
||||
class BaseLayer extends StatelessWidget {
|
||||
const BaseLayer({Key? key}) : super(key: key);
|
||||
// class BaseLayer extends StatelessWidget {
|
||||
// const BaseLayer({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TileLayerWidget(
|
||||
options: TileLayerOptions(
|
||||
backgroundColor: Colors.transparent,
|
||||
urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
//urlTemplate: 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
|
||||
subdomains: ['a', 'b', 'c'],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return TileLayerWidget(
|
||||
// options: TileLayerOptions(
|
||||
// backgroundColor: Colors.transparent,
|
||||
// urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
// //urlTemplate: 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
|
||||
// subdomains: ['a', 'b', 'c'],
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// var Esri_WorldImagery = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
|
||||
// attribution: 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
|
||||
// });
|
||||
// // var Esri_WorldImagery = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
|
||||
// // attribution: 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
|
||||
// // });
|
||||
@ -1,11 +1,11 @@
|
||||
|
||||
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get_state_manager/get_state_manager.dart';
|
||||
// import 'package:geojson/geojson.dart';
|
||||
// import 'package:get/get_state_manager/get_state_manager.dart';
|
||||
|
||||
class BottomSheetController extends GetxController{
|
||||
// class BottomSheetController extends GetxController{
|
||||
|
||||
List<GeoJsonFeature>? currentFeature = <GeoJsonFeature>[];
|
||||
// List<GeoJsonFeature>? currentFeature = <GeoJsonFeature>[];
|
||||
|
||||
BottomSheetController({this.currentFeature});
|
||||
}
|
||||
// BottomSheetController({this.currentFeature});
|
||||
// }
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,380 +1,380 @@
|
||||
import 'dart:io';
|
||||
// import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:geojson/geojson.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// import 'package:image_picker/image_picker.dart';
|
||||
// import 'package:rogapp/pages/index/index_controller.dart';
|
||||
// import 'package:rogapp/routes/app_pages.dart';
|
||||
// import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class BottomSheetWidget extends StatelessWidget {
|
||||
//const BottomSheetWidget({ Key? key }, GeoJsonFeature? pt) : super(key: key);
|
||||
// class BottomSheetWidget extends StatelessWidget {
|
||||
// //const BottomSheetWidget({ Key? key }, GeoJsonFeature? pt) : super(key: key);
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
// final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
Image getImage(GeoJsonFeature? gf){
|
||||
if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){
|
||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
}
|
||||
else{
|
||||
return Image(image: NetworkImage(
|
||||
gf.properties!["photos"],
|
||||
),
|
||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
return Image.asset("assets/images/empty_image.png");
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
// Image getImage(GeoJsonFeature? gf){
|
||||
// if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){
|
||||
// return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
// }
|
||||
// else{
|
||||
// return Image(image: NetworkImage(
|
||||
// gf.properties!["photos"],
|
||||
// ),
|
||||
// errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
// return Image.asset("assets/images/empty_image.png");
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
void _launchURL(url) async {
|
||||
if (!await launch(url)) throw 'Could not launch $url';
|
||||
}
|
||||
// void _launchURL(url) async {
|
||||
// if (!await launch(url)) throw 'Could not launch $url';
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 5.0,),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
MaterialButton(
|
||||
onPressed: () {
|
||||
indexController.makePrevious(indexController.currentFeature[0]);
|
||||
},
|
||||
color: Colors.blue,
|
||||
textColor: Colors.white,
|
||||
child: Icon(
|
||||
Icons.arrow_back_ios,
|
||||
size: 14,
|
||||
),
|
||||
padding: EdgeInsets.all(14),
|
||||
shape: CircleBorder(),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
child: Obx(() =>
|
||||
Text(indexController.currentFeature[0].properties!["location_name"], style: TextStyle(
|
||||
fontSize: 15.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
MaterialButton(
|
||||
onPressed: () {
|
||||
indexController.makeNext(indexController.currentFeature[0]);
|
||||
},
|
||||
color: Colors.blue,
|
||||
textColor: Colors.white,
|
||||
child: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 14,
|
||||
),
|
||||
padding: EdgeInsets.all(14),
|
||||
shape: CircleBorder(),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
height: 260.0,
|
||||
child: Obx(() => getImage(indexController.currentFeature[0])),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: Column(
|
||||
children: [
|
||||
indexController.currentFeature[0].properties!["address"] != null ?
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.topRight,
|
||||
child: Text("address".tr, style: TextStyle(fontWeight: FontWeight.bold),)),
|
||||
),
|
||||
SizedBox(width: 12.0,),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Obx(() => Text(indexController.currentFeature[0].properties!["address"] ?? '',
|
||||
style: TextStyle(color: Colors.blue,),
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,)
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
): Container(width: 0.0, height: 0,),
|
||||
indexController.currentFeature[0].properties!["phone"] != null ?
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(child: Container(
|
||||
alignment: Alignment.topRight,
|
||||
child: Text("telephone".tr, style: TextStyle(fontWeight: FontWeight.bold),))),
|
||||
SizedBox(width: 12.0,),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Obx(() => Text(indexController.currentFeature[0].properties!["phone"] ?? '',
|
||||
style: TextStyle(color: Colors.blue,),
|
||||
overflow: TextOverflow.ellipsis,)
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
): Container(width: 0, height: 0,),
|
||||
indexController.currentFeature[0].properties!["email"] != null ?
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(child: Container(
|
||||
alignment: Alignment.topRight,
|
||||
child: Text("email".tr, style: TextStyle(fontWeight: FontWeight.bold),))),
|
||||
SizedBox(width: 12.0,),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Obx(() => Text(indexController.currentFeature[0].properties!["email"] ?? '',
|
||||
style: TextStyle(color: Colors.blue,),
|
||||
overflow: TextOverflow.ellipsis,)
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
): Container(width: 0, height: 0,),
|
||||
indexController.currentFeature[0].properties!["webcontents"] != null ?
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(child: Container(
|
||||
alignment: Alignment.topRight,
|
||||
child: Text(
|
||||
"web".tr, style: TextStyle(fontWeight: FontWeight.bold)))),
|
||||
SizedBox(width: 12.0,),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Obx(() => InkWell(
|
||||
onTap: (){
|
||||
_launchURL(indexController.currentFeature[0].properties!["webcontents"]);
|
||||
},
|
||||
child: Text(indexController.currentFeature[0].properties!["webcontents"] ?? '',
|
||||
style: TextStyle(color: Colors.blue,),
|
||||
softWrap: false,
|
||||
overflow: TextOverflow.fade,),
|
||||
)),
|
||||
),
|
||||
)
|
||||
],
|
||||
): Container(width: 0.0, height: 0.0,),
|
||||
indexController.currentFeature[0].properties!["videos"] != null ?
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(child: Container(
|
||||
alignment: Alignment.topRight,
|
||||
child: Text("video".tr, style: TextStyle(fontWeight: FontWeight.bold)))),
|
||||
SizedBox(width: 12.0,),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Obx(() => Text(indexController.currentFeature[0].properties!["videos"] ?? '',
|
||||
style: TextStyle(color: Colors.blue,),
|
||||
overflow: TextOverflow.ellipsis,)
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
): Container(width: 0.0, height: 0.0,),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20.0,),
|
||||
Obx(() =>
|
||||
indexController.currentAction.isNotEmpty ?
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
indexController.rog_mode.value == 0 ?
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return SingleChildScrollView(
|
||||
// child: Column(
|
||||
// children: [
|
||||
// SizedBox(height: 5.0,),
|
||||
// Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// MaterialButton(
|
||||
// onPressed: () {
|
||||
// indexController.makePrevious(indexController.currentFeature[0]);
|
||||
// },
|
||||
// color: Colors.blue,
|
||||
// textColor: Colors.white,
|
||||
// child: Icon(
|
||||
// Icons.arrow_back_ios,
|
||||
// size: 14,
|
||||
// ),
|
||||
// padding: EdgeInsets.all(14),
|
||||
// shape: CircleBorder(),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: Container(
|
||||
// alignment: Alignment.center,
|
||||
// child: Obx(() =>
|
||||
// Text(indexController.currentFeature[0].properties!["location_name"], style: TextStyle(
|
||||
// fontSize: 15.0,
|
||||
// fontWeight: FontWeight.bold,
|
||||
// ),
|
||||
// )
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// MaterialButton(
|
||||
// onPressed: () {
|
||||
// indexController.makeNext(indexController.currentFeature[0]);
|
||||
// },
|
||||
// color: Colors.blue,
|
||||
// textColor: Colors.white,
|
||||
// child: Icon(
|
||||
// Icons.arrow_forward_ios,
|
||||
// size: 14,
|
||||
// ),
|
||||
// padding: EdgeInsets.all(14),
|
||||
// shape: CircleBorder(),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// Row(
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: SizedBox(
|
||||
// height: 260.0,
|
||||
// child: Obx(() => getImage(indexController.currentFeature[0])),
|
||||
// )
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// Row(
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
// child: Column(
|
||||
// children: [
|
||||
// indexController.currentFeature[0].properties!["address"] != null ?
|
||||
// Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: Container(
|
||||
// alignment: Alignment.topRight,
|
||||
// child: Text("address".tr, style: TextStyle(fontWeight: FontWeight.bold),)),
|
||||
// ),
|
||||
// SizedBox(width: 12.0,),
|
||||
// Expanded(
|
||||
// child: Container(
|
||||
// alignment: Alignment.topLeft,
|
||||
// child: Obx(() => Text(indexController.currentFeature[0].properties!["address"] ?? '',
|
||||
// style: TextStyle(color: Colors.blue,),
|
||||
// softWrap: true,
|
||||
// overflow: TextOverflow.ellipsis,)
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ): Container(width: 0.0, height: 0,),
|
||||
// indexController.currentFeature[0].properties!["phone"] != null ?
|
||||
// Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// Expanded(child: Container(
|
||||
// alignment: Alignment.topRight,
|
||||
// child: Text("telephone".tr, style: TextStyle(fontWeight: FontWeight.bold),))),
|
||||
// SizedBox(width: 12.0,),
|
||||
// Expanded(
|
||||
// child: Container(
|
||||
// alignment: Alignment.topLeft,
|
||||
// child: Obx(() => Text(indexController.currentFeature[0].properties!["phone"] ?? '',
|
||||
// style: TextStyle(color: Colors.blue,),
|
||||
// overflow: TextOverflow.ellipsis,)
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ): Container(width: 0, height: 0,),
|
||||
// indexController.currentFeature[0].properties!["email"] != null ?
|
||||
// Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// Expanded(child: Container(
|
||||
// alignment: Alignment.topRight,
|
||||
// child: Text("email".tr, style: TextStyle(fontWeight: FontWeight.bold),))),
|
||||
// SizedBox(width: 12.0,),
|
||||
// Expanded(
|
||||
// child: Container(
|
||||
// alignment: Alignment.topLeft,
|
||||
// child: Obx(() => Text(indexController.currentFeature[0].properties!["email"] ?? '',
|
||||
// style: TextStyle(color: Colors.blue,),
|
||||
// overflow: TextOverflow.ellipsis,)
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ): Container(width: 0, height: 0,),
|
||||
// indexController.currentFeature[0].properties!["webcontents"] != null ?
|
||||
// Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// Expanded(child: Container(
|
||||
// alignment: Alignment.topRight,
|
||||
// child: Text(
|
||||
// "web".tr, style: TextStyle(fontWeight: FontWeight.bold)))),
|
||||
// SizedBox(width: 12.0,),
|
||||
// Expanded(
|
||||
// child: Container(
|
||||
// alignment: Alignment.topLeft,
|
||||
// child: Obx(() => InkWell(
|
||||
// onTap: (){
|
||||
// _launchURL(indexController.currentFeature[0].properties!["webcontents"]);
|
||||
// },
|
||||
// child: Text(indexController.currentFeature[0].properties!["webcontents"] ?? '',
|
||||
// style: TextStyle(color: Colors.blue,),
|
||||
// softWrap: false,
|
||||
// overflow: TextOverflow.fade,),
|
||||
// )),
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ): Container(width: 0.0, height: 0.0,),
|
||||
// indexController.currentFeature[0].properties!["videos"] != null ?
|
||||
// Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// Expanded(child: Container(
|
||||
// alignment: Alignment.topRight,
|
||||
// child: Text("video".tr, style: TextStyle(fontWeight: FontWeight.bold)))),
|
||||
// SizedBox(width: 12.0,),
|
||||
// Expanded(
|
||||
// child: Container(
|
||||
// alignment: Alignment.topLeft,
|
||||
// child: Obx(() => Text(indexController.currentFeature[0].properties!["videos"] ?? '',
|
||||
// style: TextStyle(color: Colors.blue,),
|
||||
// overflow: TextOverflow.ellipsis,)
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ): Container(width: 0.0, height: 0.0,),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// SizedBox(height: 20.0,),
|
||||
// Obx(() =>
|
||||
// indexController.currentAction.isNotEmpty ?
|
||||
// Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
// children: [
|
||||
// indexController.rog_mode.value == 0 ?
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
indexController.currentAction[0][0]["wanttogo"] == false ?
|
||||
ElevatedButton(
|
||||
onPressed: (){
|
||||
if(indexController.currentAction.isNotEmpty){
|
||||
print(indexController.currentAction[0]);
|
||||
indexController.currentAction[0][0]["wanttogo"] = 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("want_to_go".tr)
|
||||
) :
|
||||
ElevatedButton(
|
||||
onPressed: (){
|
||||
if(indexController.currentAction.isNotEmpty){
|
||||
print(indexController.currentAction[0]);
|
||||
indexController.currentAction[0][0]["wanttogo"] = false;
|
||||
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);
|
||||
},
|
||||
// Row(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// mainAxisAlignment: MainAxisAlignment.end,
|
||||
// children: [
|
||||
// indexController.currentAction[0][0]["wanttogo"] == false ?
|
||||
// ElevatedButton(
|
||||
// onPressed: (){
|
||||
// if(indexController.currentAction.isNotEmpty){
|
||||
// print(indexController.currentAction[0]);
|
||||
// indexController.currentAction[0][0]["wanttogo"] = 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("want_to_go".tr)
|
||||
// ) :
|
||||
// ElevatedButton(
|
||||
// onPressed: (){
|
||||
// if(indexController.currentAction.isNotEmpty){
|
||||
// print(indexController.currentAction[0]);
|
||||
// indexController.currentAction[0][0]["wanttogo"] = false;
|
||||
// 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: IconButton(
|
||||
icon: Icon(Icons.favorite, color: Colors.red, semanticLabel: "want_to_go".tr,), onPressed: () {
|
||||
// child: IconButton(
|
||||
// icon: Icon(Icons.favorite, color: Colors.red, semanticLabel: "want_to_go".tr,), onPressed: () {
|
||||
|
||||
},
|
||||
// },
|
||||
|
||||
)
|
||||
),
|
||||
indexController.currentAction[0][0]["like"] == false ?
|
||||
ElevatedButton(
|
||||
onPressed: (){
|
||||
if(indexController.currentAction.isNotEmpty){
|
||||
print(indexController.currentAction[0]);
|
||||
indexController.currentAction[0][0]["like"] = 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("like".tr)
|
||||
) :
|
||||
ElevatedButton(
|
||||
onPressed: (){
|
||||
if(indexController.currentAction.isNotEmpty){
|
||||
print(indexController.currentAction[0]);
|
||||
indexController.currentAction[0][0]["like"] = false;
|
||||
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);
|
||||
},
|
||||
// )
|
||||
// ),
|
||||
// indexController.currentAction[0][0]["like"] == false ?
|
||||
// ElevatedButton(
|
||||
// onPressed: (){
|
||||
// if(indexController.currentAction.isNotEmpty){
|
||||
// print(indexController.currentAction[0]);
|
||||
// indexController.currentAction[0][0]["like"] = 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("like".tr)
|
||||
// ) :
|
||||
// ElevatedButton(
|
||||
// onPressed: (){
|
||||
// if(indexController.currentAction.isNotEmpty){
|
||||
// print(indexController.currentAction[0]);
|
||||
// indexController.currentAction[0][0]["like"] = false;
|
||||
// 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: IconButton(
|
||||
icon: Icon(Icons.favorite, color: Colors.red, semanticLabel: "like".tr,), onPressed: () {
|
||||
// child: IconButton(
|
||||
// icon: Icon(Icons.favorite, color: Colors.red, semanticLabel: "like".tr,), onPressed: () {
|
||||
|
||||
},
|
||||
// },
|
||||
|
||||
)
|
||||
),
|
||||
],
|
||||
)
|
||||
// )
|
||||
// ),
|
||||
// ],
|
||||
// )
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:
|
||||
Container(width: 0, height: 0,),
|
||||
indexController.rog_mode.value == 1 ?
|
||||
indexController.currentAction[0][0]["checkin"] == false ?
|
||||
Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
child: Text("Image"), onPressed: (){
|
||||
final ImagePicker _picker = ImagePicker();
|
||||
_picker.pickImage(source: ImageSource.camera).then((value){
|
||||
print("----- image---- ${value!.path}");
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
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(
|
||||
onPressed: (){
|
||||
if(indexController.currentAction.isNotEmpty){
|
||||
print(indexController.currentAction[0]);
|
||||
indexController.currentAction[0][0]["checkin"] = false;
|
||||
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);
|
||||
},
|
||||
// :
|
||||
// Container(width: 0, height: 0,),
|
||||
// indexController.rog_mode.value == 1 ?
|
||||
// indexController.currentAction[0][0]["checkin"] == false ?
|
||||
// Column(
|
||||
// children: [
|
||||
// Row(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// children: [
|
||||
// ElevatedButton(
|
||||
// child: Text("Image"), onPressed: (){
|
||||
// final ImagePicker _picker = ImagePicker();
|
||||
// _picker.pickImage(source: ImageSource.camera).then((value){
|
||||
// print("----- image---- ${value!.path}");
|
||||
// });
|
||||
// },
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// 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(
|
||||
// onPressed: (){
|
||||
// if(indexController.currentAction.isNotEmpty){
|
||||
// print(indexController.currentAction[0]);
|
||||
// indexController.currentAction[0][0]["checkin"] = false;
|
||||
// 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: Icon(
|
||||
Icons.favorite, color: Colors.red)
|
||||
// child: Icon(
|
||||
// Icons.favorite, color: Colors.red)
|
||||
|
||||
,
|
||||
):
|
||||
Container(width: 0, height: 0,),
|
||||
],
|
||||
): Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: (){
|
||||
Get.toNamed(AppPages.LOGIN);
|
||||
},
|
||||
child: Flexible(child: Text("その他のオプションについてはログインしてください")))
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(height: 60.0,),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// ,
|
||||
// ):
|
||||
// Container(width: 0, height: 0,),
|
||||
// ],
|
||||
// ): Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// TextButton(
|
||||
// onPressed: (){
|
||||
// Get.toNamed(AppPages.LOGIN);
|
||||
// },
|
||||
// child: Flexible(child: Text("その他のオプションについてはログインしてください")))
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// Row(
|
||||
// children: [
|
||||
// SizedBox(height: 60.0,),
|
||||
// ],
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
@ -1,34 +1,34 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:flutter_breadcrumb/flutter_breadcrumb.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/widgets/perfecture_widget.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:flutter_map/flutter_map.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// import 'package:flutter_breadcrumb/flutter_breadcrumb.dart';
|
||||
// import 'package:rogapp/pages/index/index_controller.dart';
|
||||
// import 'package:rogapp/widgets/perfecture_widget.dart';
|
||||
|
||||
class BreadCrumbWidget extends StatelessWidget {
|
||||
BreadCrumbWidget({Key? key, this.mapController}) : super(key: key);
|
||||
// class BreadCrumbWidget extends StatelessWidget {
|
||||
// BreadCrumbWidget({Key? key, this.mapController}) : super(key: key);
|
||||
|
||||
final MapController? mapController;
|
||||
// final MapController? mapController;
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
// final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print("------ map controller is ${mapController}------------");
|
||||
return
|
||||
Obx(()=>
|
||||
indexController.perfectures.isNotEmpty && mapController != null ?
|
||||
BreadCrumb.builder(
|
||||
itemCount: indexController.perfectures.length,
|
||||
builder: (index){
|
||||
return
|
||||
BreadCrumbItem(
|
||||
content: PerfectureWidget(indexController: indexController, mapController: mapController!) //Text('Item$index')
|
||||
);
|
||||
}
|
||||
):
|
||||
const Text("Empty")
|
||||
);
|
||||
}
|
||||
}
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// print("------ map controller is ${mapController}------------");
|
||||
// return
|
||||
// Obx(()=>
|
||||
// indexController.perfectures.isNotEmpty && mapController != null ?
|
||||
// BreadCrumb.builder(
|
||||
// itemCount: indexController.perfectures.length,
|
||||
// builder: (index){
|
||||
// return
|
||||
// BreadCrumbItem(
|
||||
// content: PerfectureWidget(indexController: indexController, mapController: mapController!) //Text('Item$index')
|
||||
// );
|
||||
// }
|
||||
// ):
|
||||
// const Text("Empty")
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
@ -1,50 +1,50 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/services/location_service.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:rogapp/pages/index/index_controller.dart';
|
||||
// import 'package:rogapp/services/location_service.dart';
|
||||
|
||||
class CatWidget extends StatefulWidget {
|
||||
CatWidget({ Key? key, required this.indexController, }) : super(key: key);
|
||||
// class CatWidget extends StatefulWidget {
|
||||
// CatWidget({ Key? key, required this.indexController, }) : super(key: key);
|
||||
|
||||
IndexController indexController;
|
||||
// IndexController indexController;
|
||||
|
||||
@override
|
||||
State<CatWidget> createState() => _CatWidgetState();
|
||||
}
|
||||
// @override
|
||||
// State<CatWidget> createState() => _CatWidgetState();
|
||||
// }
|
||||
|
||||
class _CatWidgetState extends State<CatWidget> {
|
||||
String defaultValue = "---";
|
||||
// class _CatWidgetState extends State<CatWidget> {
|
||||
// String defaultValue = "---";
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return
|
||||
PopupMenuButton(
|
||||
onSelected: (value) {
|
||||
widget.indexController.currentCat.clear();
|
||||
widget.indexController.currentCat.add(value.toString());
|
||||
widget.indexController.refreshLocationForCat();
|
||||
setState(() {
|
||||
print(value);
|
||||
//widget.indexController.is_loading.value = true;
|
||||
defaultValue = value.toString();
|
||||
});
|
||||
},
|
||||
itemBuilder: (BuildContext context){
|
||||
List<PopupMenuItem> itms = <PopupMenuItem>[];
|
||||
for(dynamic d in widget.indexController.cats[0]){
|
||||
PopupMenuItem itm = PopupMenuItem(child: Text(d['category'].toString()), value: d['category'].toString());
|
||||
itms.add(itm);
|
||||
}
|
||||
return itms;
|
||||
}
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return
|
||||
// PopupMenuButton(
|
||||
// onSelected: (value) {
|
||||
// widget.indexController.currentCat.clear();
|
||||
// widget.indexController.currentCat.add(value.toString());
|
||||
// widget.indexController.refreshLocationForCat();
|
||||
// setState(() {
|
||||
// print(value);
|
||||
// //widget.indexController.is_loading.value = true;
|
||||
// defaultValue = value.toString();
|
||||
// });
|
||||
// },
|
||||
// itemBuilder: (BuildContext context){
|
||||
// List<PopupMenuItem> itms = <PopupMenuItem>[];
|
||||
// for(dynamic d in widget.indexController.cats[0]){
|
||||
// PopupMenuItem itm = PopupMenuItem(child: Text(d['category'].toString()), value: d['category'].toString());
|
||||
// itms.add(itm);
|
||||
// }
|
||||
// return itms;
|
||||
// }
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// widget.indexController.cats.map((e) =>
|
||||
// PopupMenuItem(
|
||||
// value: defaultValue,
|
||||
// child: Text(e[0]['category'].toString()),
|
||||
// )
|
||||
// ).toList(),
|
||||
// // widget.indexController.cats.map((e) =>
|
||||
// // PopupMenuItem(
|
||||
// // value: defaultValue,
|
||||
// // child: Text(e[0]['category'].toString()),
|
||||
// // )
|
||||
// // ).toList(),
|
||||
31
lib/widgets/collapsed_widget.dart
Normal file
31
lib/widgets/collapsed_widget.dart
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
|
||||
class CollapsedWidget extends StatelessWidget {
|
||||
|
||||
void Function()? addIncident;
|
||||
|
||||
CollapsedWidget({ this.addIncident, Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: addIncident,
|
||||
icon: Icon(Icons.add_circle_outline_rounded, size: 30,)),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,219 +1,219 @@
|
||||
import 'dart:ffi';
|
||||
// import 'dart:ffi';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
import 'package:timeline_tile/timeline_tile.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:geojson/geojson.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// import 'package:rogapp/model/destination.dart';
|
||||
// import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
// import 'package:rogapp/pages/index/index_controller.dart';
|
||||
// import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||
// import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
// import 'package:timeline_tile/timeline_tile.dart';
|
||||
|
||||
class DestinationWidget extends StatelessWidget {
|
||||
DestinationWidget({ Key? key }) : super(key: key);
|
||||
// class DestinationWidget extends StatelessWidget {
|
||||
// DestinationWidget({ Key? key }) : super(key: key);
|
||||
|
||||
final DestinationController destinationController = Get.find<DestinationController>();
|
||||
// final DestinationController destinationController = Get.find<DestinationController>();
|
||||
|
||||
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);
|
||||
|
||||
Image getImage(int index){
|
||||
if(destinationController.destinations[index].photos== null || destinationController.destinations[index].photos == ""){
|
||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
}
|
||||
else{
|
||||
print("------- image is ${destinationController.destinations[index].photos!}------");
|
||||
return Image(image: NetworkImage(
|
||||
destinationController.destinations[index].photos!),
|
||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
return Image.asset("assets/images/empty_image.png");
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
// Image getImage(int index){
|
||||
// if(destinationController.destinations[index].photos== null || destinationController.destinations[index].photos == ""){
|
||||
// return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
// }
|
||||
// else{
|
||||
// print("------- image is ${destinationController.destinations[index].photos!}------");
|
||||
// return Image(image: NetworkImage(
|
||||
// destinationController.destinations[index].photos!),
|
||||
// errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
// return Image.asset("assets/images/empty_image.png");
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
bool getSelection(int index){
|
||||
bool ret = false;
|
||||
destinationController.destination_index_data.forEach((element) {
|
||||
if(index == element["index"]){
|
||||
if(element["selected"] == true){
|
||||
ret = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
// bool getSelection(int index){
|
||||
// bool ret = false;
|
||||
// destinationController.destination_index_data.forEach((element) {
|
||||
// if(index == element["index"]){
|
||||
// if(element["selected"] == true){
|
||||
// ret = true;
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// return ret;
|
||||
// }
|
||||
|
||||
void doDelete() {
|
||||
destinationController.currentSelectedDestinations.forEach((element) {
|
||||
destinationController.deleteDestination(element);
|
||||
});
|
||||
// destinationController.destination_index_data.forEach((element) {
|
||||
// //print(element["index"]);
|
||||
// destinationController.deleteDestination(element["index"]);
|
||||
// });
|
||||
// destinationController.destination_index_data.clear();
|
||||
}
|
||||
// void doDelete() {
|
||||
// destinationController.currentSelectedDestinations.forEach((element) {
|
||||
// destinationController.deleteDestination(element);
|
||||
// });
|
||||
// // destinationController.destination_index_data.forEach((element) {
|
||||
// // //print(element["index"]);
|
||||
// // destinationController.deleteDestination(element["index"]);
|
||||
// // });
|
||||
// // destinationController.destination_index_data.clear();
|
||||
// }
|
||||
|
||||
void moveUp() {
|
||||
destinationController.destination_index_data.forEach((element) {
|
||||
//print(element["index"]);
|
||||
//int action_id = destinationController.destinations[element["index"]]["id"] as int;
|
||||
//destinationController.makeOrder(action_id, (element["index"] as int) - 1, "up");
|
||||
});
|
||||
}
|
||||
// void moveUp() {
|
||||
// destinationController.destination_index_data.forEach((element) {
|
||||
// //print(element["index"]);
|
||||
// //int action_id = destinationController.destinations[element["index"]]["id"] as int;
|
||||
// //destinationController.makeOrder(action_id, (element["index"] as int) - 1, "up");
|
||||
// });
|
||||
// }
|
||||
|
||||
void moveDown() {
|
||||
destinationController.destination_index_data.forEach((element) {
|
||||
//print(element["index"]);
|
||||
//int action_id = destinationController.destinations[element["index"]]["id"] as int;
|
||||
//destinationController.makeOrder(action_id, (element["index"] as int) + 1, "up");
|
||||
});
|
||||
}
|
||||
// void moveDown() {
|
||||
// destinationController.destination_index_data.forEach((element) {
|
||||
// //print(element["index"]);
|
||||
// //int action_id = destinationController.destinations[element["index"]]["id"] as int;
|
||||
// //destinationController.makeOrder(action_id, (element["index"] as int) + 1, "up");
|
||||
// });
|
||||
// }
|
||||
|
||||
void interChange() {
|
||||
// int first_index = -1;
|
||||
// destinationController.destination_index_data.forEach((element) {
|
||||
// //print(element["index"]);
|
||||
// int action_id = destinationController.destinations[element["index"]]["id"] as int;
|
||||
// destinationController.makeOrder(action_id, (element["index"] as int) + 1, "up");
|
||||
// void interChange() {
|
||||
// // int first_index = -1;
|
||||
// // destinationController.destination_index_data.forEach((element) {
|
||||
// // //print(element["index"]);
|
||||
// // int action_id = destinationController.destinations[element["index"]]["id"] as int;
|
||||
// // destinationController.makeOrder(action_id, (element["index"] as int) + 1, "up");
|
||||
|
||||
// });
|
||||
}
|
||||
// // });
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
|
||||
print("------ destination widget------ ${destinationController.destinationCount.value} ----------");
|
||||
// print("------ destination widget------ ${destinationController.destinationCount.value} ----------");
|
||||
|
||||
return
|
||||
Obx(() =>
|
||||
Stack(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top:45.0),
|
||||
child: ListView.builder(
|
||||
itemCount: destinationController.destinationCount.value,
|
||||
// return
|
||||
// Obx(() =>
|
||||
// Stack(
|
||||
// children: [
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(top:45.0),
|
||||
// child: ListView.builder(
|
||||
// itemCount: destinationController.destinationCount.value,
|
||||
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return
|
||||
TimelineTile(
|
||||
alignment: TimelineAlign.manual,
|
||||
lineXY: 0.2,
|
||||
isFirst: index == 0 ? true : false,
|
||||
indicatorStyle: IndicatorStyle(
|
||||
color: index == 0 ? (Colors.red) : (Colors.grey[400])!
|
||||
),
|
||||
key: Key(index.toString()),
|
||||
endChild: Card(
|
||||
child: Container(
|
||||
constraints: const BoxConstraints(
|
||||
minHeight: 80,
|
||||
),
|
||||
child: ListTile(
|
||||
onTap: () async {
|
||||
{
|
||||
Destination? fs = destinationController.destinations[index];
|
||||
print("----fsf-----${fs}");
|
||||
if(fs != null){
|
||||
// itemBuilder: (BuildContext context, int index) {
|
||||
// return
|
||||
// TimelineTile(
|
||||
// alignment: TimelineAlign.manual,
|
||||
// lineXY: 0.2,
|
||||
// isFirst: index == 0 ? true : false,
|
||||
// indicatorStyle: IndicatorStyle(
|
||||
// color: index == 0 ? (Colors.red) : (Colors.grey[400])!
|
||||
// ),
|
||||
// key: Key(index.toString()),
|
||||
// endChild: Card(
|
||||
// child: Container(
|
||||
// constraints: const BoxConstraints(
|
||||
// minHeight: 80,
|
||||
// ),
|
||||
// child: ListTile(
|
||||
// onTap: () async {
|
||||
// {
|
||||
// Destination? fs = destinationController.destinations[index];
|
||||
// print("----fsf-----${fs}");
|
||||
// if(fs != null){
|
||||
|
||||
if(indexController.currentDestinationFeature.length > 0) {
|
||||
indexController.currentDestinationFeature.clear();
|
||||
}
|
||||
indexController.currentDestinationFeature.add(fs);
|
||||
//indexController.getAction();
|
||||
// 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())
|
||||
);
|
||||
}
|
||||
};
|
||||
},
|
||||
onLongPress: (){
|
||||
// showModalBottomSheet(context: context, isScrollControlled: true,
|
||||
// //builder:((context) => BottomSheetWidget())
|
||||
// builder:((context) => BottomSheetNew())
|
||||
// );
|
||||
// }
|
||||
// };
|
||||
// },
|
||||
// onLongPress: (){
|
||||
|
||||
Destination? match_element = null;
|
||||
destinationController.currentSelectedDestinations.forEach((element) {
|
||||
if(element.location_id == destinationController.destinations[index].location_id){
|
||||
match_element = element;
|
||||
return;
|
||||
}
|
||||
});
|
||||
// Destination? match_element = null;
|
||||
// destinationController.currentSelectedDestinations.forEach((element) {
|
||||
// if(element.location_id == destinationController.destinations[index].location_id){
|
||||
// match_element = element;
|
||||
// return;
|
||||
// }
|
||||
// });
|
||||
|
||||
if(match_element != null){
|
||||
destinationController.currentSelectedDestinations.remove(destinationController.destinations[index]);
|
||||
}
|
||||
// if(match_element != null){
|
||||
// destinationController.currentSelectedDestinations.remove(destinationController.destinations[index]);
|
||||
// }
|
||||
|
||||
destinationController.currentSelectedDestinations.add(destinationController.destinations[index]);
|
||||
// destinationController.currentSelectedDestinations.add(destinationController.destinations[index]);
|
||||
|
||||
destinationController.PopulateDestinations();
|
||||
// destinationController.PopulateDestinations();
|
||||
|
||||
},
|
||||
selectedTileColor: Colors.amberAccent,
|
||||
selected:destinationController.destinations[index].selected!,
|
||||
leading: getImage(index),
|
||||
title: Text(destinationController.destinations[index].name!),
|
||||
subtitle: Text(destinationController.destinations[index].category!),
|
||||
),
|
||||
),
|
||||
),
|
||||
startChild:
|
||||
destinationController.matrix["rows"][0]["elements"] != null ?
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
//Text(destinationController.matrix["rows"][0]["elements"][index]["distance"]["text"].toString()),
|
||||
//Text(destinationController.matrix["rows"][0]["elements"][index]["duration"]["text"].toString())
|
||||
],
|
||||
):
|
||||
Container()
|
||||
,
|
||||
);
|
||||
// },
|
||||
// selectedTileColor: Colors.amberAccent,
|
||||
// selected:destinationController.destinations[index].selected!,
|
||||
// leading: getImage(index),
|
||||
// title: Text(destinationController.destinations[index].name!),
|
||||
// subtitle: Text(destinationController.destinations[index].category!),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// startChild:
|
||||
// destinationController.matrix["rows"][0]["elements"] != null ?
|
||||
// Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
// children: [
|
||||
// //Text(destinationController.matrix["rows"][0]["elements"][index]["distance"]["text"].toString()),
|
||||
// //Text(destinationController.matrix["rows"][0]["elements"][index]["duration"]["text"].toString())
|
||||
// ],
|
||||
// ):
|
||||
// Container()
|
||||
// ,
|
||||
// );
|
||||
|
||||
}
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.3),
|
||||
spreadRadius: 5,
|
||||
blurRadius: 3,
|
||||
offset: Offset(0, 7), // changes position of shadow
|
||||
),
|
||||
],
|
||||
),
|
||||
height: 44.0,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
IconButton(
|
||||
icon:Icon(Icons.cancel),
|
||||
//onPressed: (){doDelete();},
|
||||
onPressed: destinationController.currentSelectedDestinations.length > 0 ? doDelete : null,
|
||||
),
|
||||
IconButton(
|
||||
icon:Icon(Icons.move_up),
|
||||
onPressed: destinationController.destination_index_data.length > 0 ? moveUp : null,
|
||||
),
|
||||
IconButton(
|
||||
icon:Icon(Icons.move_down),
|
||||
onPressed: destinationController.destination_index_data.length > 0 ? moveDown : null,
|
||||
),
|
||||
IconButton(
|
||||
icon:Icon(Icons.sync),
|
||||
onPressed: destinationController.destination_index_data.length == 2 ? interChange : null,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
// }
|
||||
// ),
|
||||
// ),
|
||||
// Container(
|
||||
// decoration: BoxDecoration(
|
||||
// boxShadow: [
|
||||
// BoxShadow(
|
||||
// color: Colors.grey.withOpacity(0.3),
|
||||
// spreadRadius: 5,
|
||||
// blurRadius: 3,
|
||||
// offset: Offset(0, 7), // changes position of shadow
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// height: 44.0,
|
||||
// width: MediaQuery.of(context).size.width,
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// IconButton(
|
||||
// icon:Icon(Icons.cancel),
|
||||
// //onPressed: (){doDelete();},
|
||||
// onPressed: destinationController.currentSelectedDestinations.length > 0 ? doDelete : null,
|
||||
// ),
|
||||
// IconButton(
|
||||
// icon:Icon(Icons.move_up),
|
||||
// onPressed: destinationController.destination_index_data.length > 0 ? moveUp : null,
|
||||
// ),
|
||||
// IconButton(
|
||||
// icon:Icon(Icons.move_down),
|
||||
// onPressed: destinationController.destination_index_data.length > 0 ? moveDown : null,
|
||||
// ),
|
||||
// IconButton(
|
||||
// icon:Icon(Icons.sync),
|
||||
// onPressed: destinationController.destination_index_data.length == 2 ? interChange : null,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// )
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
@ -1,45 +1,45 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rogapp/pages/search/search_page.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:rogapp/pages/search/search_page.dart';
|
||||
|
||||
class FakeSearch extends StatelessWidget {
|
||||
const FakeSearch({
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
// class FakeSearch extends StatelessWidget {
|
||||
// const FakeSearch({
|
||||
// Key? key,
|
||||
// }) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: (){
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => SearchPage()));
|
||||
},
|
||||
child: Container(
|
||||
height: 35,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color:Colors.blue, width: 1.4),
|
||||
borderRadius: BorderRadius.circular(25)
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: Icon(Icons.search, color: Colors.grey,),
|
||||
),
|
||||
const Text("What are you looking for", style: TextStyle(fontSize: 16, color: Colors.grey),),
|
||||
Container(
|
||||
height: 32,
|
||||
width: 75,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blue,
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return InkWell(
|
||||
// onTap: (){
|
||||
// Navigator.push(context, MaterialPageRoute(builder: (context) => SearchPage()));
|
||||
// },
|
||||
// child: Container(
|
||||
// height: 35,
|
||||
// decoration: BoxDecoration(
|
||||
// border: Border.all(color:Colors.blue, width: 1.4),
|
||||
// borderRadius: BorderRadius.circular(25)
|
||||
// ),
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// const Padding(
|
||||
// padding: EdgeInsets.symmetric(horizontal: 8.0),
|
||||
// child: Icon(Icons.search, color: Colors.grey,),
|
||||
// ),
|
||||
// const Text("What are you looking for", style: TextStyle(fontSize: 16, color: Colors.grey),),
|
||||
// Container(
|
||||
// height: 32,
|
||||
// width: 75,
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.blue,
|
||||
// borderRadius: BorderRadius.circular(25),
|
||||
|
||||
),
|
||||
child: const Center(child: Text("Search", style: TextStyle(fontSize: 16, color: Colors.white),)),
|
||||
)
|
||||
// ),
|
||||
// child: const Center(child: Text("Search", style: TextStyle(fontSize: 16, color: Colors.white),)),
|
||||
// )
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
@ -1,63 +1,63 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:geojson/geojson.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// import 'package:rogapp/pages/index/index_controller.dart';
|
||||
// import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||
// import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
|
||||
class ListWidget extends StatelessWidget {
|
||||
ListWidget({ Key? key }) : super(key: key);
|
||||
// class ListWidget extends StatelessWidget {
|
||||
// ListWidget({ Key? key }) : super(key: key);
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
// final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
Image getImage(int index){
|
||||
if(indexController.locations[0].collection[index].properties!["photos"] == null || indexController.locations[0].collection[index].properties!["photos"] == ""){
|
||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
}
|
||||
else{
|
||||
return Image(
|
||||
image: NetworkImage(indexController.locations[0].collection[index].properties!["photos"]),
|
||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
return Image.asset("assets/images/empty_image.png");
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
// Image getImage(int index){
|
||||
// if(indexController.locations[0].collection[index].properties!["photos"] == null || indexController.locations[0].collection[index].properties!["photos"] == ""){
|
||||
// return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
// }
|
||||
// else{
|
||||
// return Image(
|
||||
// image: NetworkImage(indexController.locations[0].collection[index].properties!["photos"]),
|
||||
// errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
// return Image.asset("assets/images/empty_image.png");
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
void changeCurrentFeature(GeoJsonFeature fs){
|
||||
if(indexController.currentFeature.length > 0){
|
||||
indexController.currentFeature.clear();
|
||||
}
|
||||
indexController.currentFeature.add(fs);
|
||||
}
|
||||
// void changeCurrentFeature(GeoJsonFeature fs){
|
||||
// if(indexController.currentFeature.length > 0){
|
||||
// indexController.currentFeature.clear();
|
||||
// }
|
||||
// indexController.currentFeature.add(fs);
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Obx(() =>
|
||||
indexController.locations.length > 0 ?
|
||||
ListView.builder(
|
||||
itemCount: indexController.locations[0].collection.length,
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (_, index){
|
||||
return Card(
|
||||
child: ListTile(
|
||||
onTap: (){
|
||||
GeoJsonFeature gf = indexController.locations[0].collection[index];
|
||||
changeCurrentFeature(gf);
|
||||
showModalBottomSheet(
|
||||
isScrollControlled: true,
|
||||
context: context,
|
||||
//builder: (context) => BottomSheetWidget(),
|
||||
builder:((context) => BottomSheetNew())
|
||||
);
|
||||
},
|
||||
leading: getImage(index),
|
||||
title: indexController.locations[0].collection[index].properties!['location_name'] != null ? Text(indexController.locations[0].collection[index].properties!['location_name'].toString()) : Text(""),
|
||||
subtitle: indexController.locations[0].collection[index].properties!['category'] != null ? Text(indexController.locations[0].collection[index].properties!['category']) : Text(""),
|
||||
),
|
||||
);
|
||||
},
|
||||
) : Container(width: 0, height: 0,),
|
||||
);
|
||||
}
|
||||
}
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Obx(() =>
|
||||
// indexController.locations.length > 0 ?
|
||||
// ListView.builder(
|
||||
// itemCount: indexController.locations[0].collection.length,
|
||||
// shrinkWrap: true,
|
||||
// itemBuilder: (_, index){
|
||||
// return Card(
|
||||
// child: ListTile(
|
||||
// onTap: (){
|
||||
// GeoJsonFeature gf = indexController.locations[0].collection[index];
|
||||
// changeCurrentFeature(gf);
|
||||
// showModalBottomSheet(
|
||||
// isScrollControlled: true,
|
||||
// context: context,
|
||||
// //builder: (context) => BottomSheetWidget(),
|
||||
// builder:((context) => BottomSheetNew())
|
||||
// );
|
||||
// },
|
||||
// leading: getImage(index),
|
||||
// title: indexController.locations[0].collection[index].properties!['location_name'] != null ? Text(indexController.locations[0].collection[index].properties!['location_name'].toString()) : Text(""),
|
||||
// subtitle: indexController.locations[0].collection[index].properties!['category'] != null ? Text(indexController.locations[0].collection[index].properties!['category']) : Text(""),
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// ) : Container(width: 0, height: 0,),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
@ -1,202 +1,150 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/plugin_api.dart';
|
||||
import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
|
||||
import 'package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_state_manager/get_state_manager.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/widgets/base_layer_widget.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
// import 'dart:async';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:flutter_map/plugin_api.dart';
|
||||
// import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
|
||||
// import 'package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart';2
|
||||
// import 'package:get/get.dart';
|
||||
// import 'package:get/get_state_manager/get_state_manager.dart';
|
||||
// import 'package:latlong2/latlong.dart';
|
||||
// import 'package:rogapp/pages/index/index_controller.dart';
|
||||
// import 'package:rogapp/widgets/base_layer_widget.dart';
|
||||
// import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||
// import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
|
||||
class MapWidget extends StatelessWidget {
|
||||
// class MapWidget extends StatelessWidget {
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
// final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
MapWidget({ Key? key}) : super(key: key);
|
||||
// MapWidget({ Key? key}) : super(key: key);
|
||||
|
||||
StreamSubscription? subscription;
|
||||
// StreamSubscription? subscription;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
|
||||
print("---------- rog mode is ${indexController.rog_mode.value.toString()}----------");
|
||||
// print("---------- rog mode is ${indexController.rog_mode.value.toString()}----------");
|
||||
|
||||
final PopupController _popupController = PopupController();
|
||||
return Stack(
|
||||
children: [
|
||||
Obx(() =>
|
||||
indexController.is_loading == true ? Padding(
|
||||
padding: const EdgeInsets.only(top: 60.0),
|
||||
child: CircularProgressIndicator(),
|
||||
):
|
||||
FlutterMap(
|
||||
//mapController: mapController,
|
||||
options: MapOptions(
|
||||
onMapCreated: (c){
|
||||
indexController.mapController = c;
|
||||
// final PopupController _popupController = PopupController();
|
||||
// return Stack(
|
||||
// children: [
|
||||
// Obx(() =>
|
||||
// indexController.is_loading == true ? Padding(
|
||||
// padding: const EdgeInsets.only(top: 60.0),
|
||||
// child: CircularProgressIndicator(),
|
||||
// ):
|
||||
// FlutterMap(
|
||||
// //mapController: mapController,
|
||||
// options: MapOptions(
|
||||
// onMapCreated: (c){
|
||||
// indexController.mapController = c;
|
||||
|
||||
indexController.mapController!.onReady.then((_) {
|
||||
indexController.is_mapController_loaded.value = true;
|
||||
subscription = indexController.mapController!.mapEventStream.listen((MapEvent mapEvent) {
|
||||
if (mapEvent is MapEventMoveStart) {
|
||||
//print(DateTime.now().toString() + ' [MapEventMoveStart] START');
|
||||
// do something
|
||||
}
|
||||
if (mapEvent is MapEventMoveEnd) {
|
||||
//print(DateTime.now().toString() + ' [MapEventMoveStart] END');
|
||||
indexController.loadLocationsBound();
|
||||
}
|
||||
});
|
||||
});
|
||||
// indexController.mapController!.onReady.then((_) {
|
||||
// indexController.is_mapController_loaded.value = true;
|
||||
// subscription = indexController.mapController!.mapEventStream.listen((MapEvent mapEvent) {
|
||||
// if (mapEvent is MapEventMoveStart) {
|
||||
// //print(DateTime.now().toString() + ' [MapEventMoveStart] START');
|
||||
// // do something
|
||||
// }
|
||||
// if (mapEvent is MapEventMoveEnd) {
|
||||
// //print(DateTime.now().toString() + ' [MapEventMoveStart] END');
|
||||
// indexController.loadLocationsBound();
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
|
||||
},
|
||||
//center: LatLng(37.15319600454702, 139.58765950528198),
|
||||
bounds: indexController.currentBound.length > 0 ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]),
|
||||
zoom: 1,
|
||||
maxZoom: 24,
|
||||
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
|
||||
plugins: [
|
||||
MarkerClusterPlugin(),
|
||||
],
|
||||
// },
|
||||
// //center: LatLng(37.15319600454702, 139.58765950528198),
|
||||
// bounds: indexController.currentBound.length > 0 ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]),
|
||||
// zoom: 1,
|
||||
// maxZoom: 24,
|
||||
// interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
|
||||
// plugins: [
|
||||
// MarkerClusterPlugin(),
|
||||
// ],
|
||||
|
||||
onPositionChanged: (MapPosition pos, isvalue){
|
||||
|
||||
// LatLng c1 = pos.center?? LatLng(0, 0);
|
||||
|
||||
// Timer(Duration(milliseconds:800), () {
|
||||
// print(pos.bounds!.center);
|
||||
// print("Yeah, this line is printed after 3 second");
|
||||
// LatLng c2 = pos.center?? LatLng(0, 0);
|
||||
// if(c1.latitude != 0 && c1.latitude == c2.latitude){
|
||||
// print("------ calling ----");
|
||||
// //indexController.loadLocationsBound();
|
||||
// }
|
||||
|
||||
// });
|
||||
|
||||
//
|
||||
},
|
||||
onTap: (_, __) =>
|
||||
_popupController
|
||||
.hideAllPopups(), // Hide popup when the map is tapped.
|
||||
),
|
||||
layers: [
|
||||
// MarkerLayerOptions(
|
||||
// markers: indexController.locations[0].collection.map((i) {
|
||||
// print("i si ${i.properties!['location_id']}");
|
||||
// GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
|
||||
// print("lat is ${p.geoSerie!.geoPoints[0].latitude} and lon is ${p.geoSerie!.geoPoints[0].longitude}");
|
||||
// return Marker(
|
||||
// anchorPos: AnchorPos.align(AnchorAlign.center),
|
||||
// height: 70.0,
|
||||
// width: 70.0,
|
||||
// point: LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude),
|
||||
// builder: (ctx) =>
|
||||
// IconButton(
|
||||
// icon: const Icon(Icons.pin_drop),
|
||||
// tooltip: 'Increase volume by 10',
|
||||
// onPressed: () {
|
||||
// GeoJsonFeature? fs = indexController.getFeatureForLatLong(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude);
|
||||
// print(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())
|
||||
// );
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
|
||||
// );
|
||||
// }).toList(),
|
||||
// ),
|
||||
],
|
||||
children: [
|
||||
BaseLayer(),
|
||||
LocationMarkerLayerWidget(),
|
||||
// onPositionChanged: (MapPosition pos, isvalue){
|
||||
// },
|
||||
// onTap: (_, __) =>
|
||||
// _popupController
|
||||
// .hideAllPopups(), // Hide popup when the map is tapped.
|
||||
// ),
|
||||
// children: [
|
||||
// BaseLayer(),
|
||||
// LocationMarkerLayerWidget(),
|
||||
|
||||
indexController.locations.length > 0 ?
|
||||
MarkerClusterLayerWidget(
|
||||
options: MarkerClusterLayerOptions(
|
||||
spiderfyCircleRadius: 0,
|
||||
spiderfySpiralDistanceMultiplier: 2,
|
||||
circleSpiralSwitchover: 12,
|
||||
maxClusterRadius: 0,
|
||||
rotate: true,
|
||||
onMarkerTap: (marker){
|
||||
GeoJsonFeature? fs = indexController.getFeatureForLatLong(marker.point.latitude, marker.point.longitude);
|
||||
//print("------- fs ${fs}------");
|
||||
if(fs != null){
|
||||
indexController.currentFeature.clear();
|
||||
indexController.currentFeature.add(fs);
|
||||
//print("----- fs is ${fs.properties!['photos']}");
|
||||
indexController.getAction();
|
||||
// indexController.locations.length > 0 ?
|
||||
// MarkerClusterLayerWidget(
|
||||
// options: MarkerClusterLayerOptions(
|
||||
// spiderfyCircleRadius: 0,
|
||||
// spiderfySpiralDistanceMultiplier: 2,
|
||||
// circleSpiralSwitchover: 12,
|
||||
// maxClusterRadius: 0,
|
||||
// rotate: true,
|
||||
// onMarkerTap: (marker){
|
||||
// GeoJsonFeature? fs = indexController.getFeatureForLatLong(marker.point.latitude, marker.point.longitude);
|
||||
// //print("------- fs ${fs}------");
|
||||
// if(fs != null){
|
||||
// indexController.currentFeature.clear();
|
||||
// indexController.currentFeature.add(fs);
|
||||
// //print("----- fs is ${fs.properties!['photos']}");
|
||||
// indexController.getAction();
|
||||
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
isDismissible: true,
|
||||
builder:((context) => BottomSheetNew())
|
||||
//builder:((context) => BottomSheetWidget())
|
||||
);
|
||||
}
|
||||
// showModalBottomSheet(
|
||||
// context: context,
|
||||
// isScrollControlled: true,
|
||||
// isDismissible: true,
|
||||
// builder:((context) => BottomSheetNew())
|
||||
// //builder:((context) => BottomSheetWidget())
|
||||
// );
|
||||
// }
|
||||
|
||||
},
|
||||
// },
|
||||
|
||||
size: Size(40, 40),
|
||||
anchor: AnchorPos.align(AnchorAlign.center),
|
||||
fitBoundsOptions: const FitBoundsOptions(
|
||||
padding: EdgeInsets.all(50),
|
||||
maxZoom: 265,
|
||||
),
|
||||
markers:indexController.locations[0].collection.map((i) {
|
||||
print("i si ${i.properties!['location_id']}");
|
||||
GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
|
||||
print("lat is ${p.geoSerie!.geoPoints[0].latitude} and lon is ${p.geoSerie!.geoPoints[0].longitude}");
|
||||
return Marker(
|
||||
anchorPos: AnchorPos.align(AnchorAlign.center),
|
||||
height: 22.0,
|
||||
width: 22.0,
|
||||
point: LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude),
|
||||
builder: (ctx) => Icon(Icons.pin_drop),
|
||||
// builder: (ctx) => i.properties!["category"] != null ?
|
||||
// ImageIcon(
|
||||
// AssetImage("assets/images/${i.properties!["category"]}.png"),
|
||||
// color: Color(0xFF3A5A98),
|
||||
// size:12.0,
|
||||
// )
|
||||
// : Icon(Icons.pin_drop),
|
||||
// size: Size(40, 40),
|
||||
// anchor: AnchorPos.align(AnchorAlign.center),
|
||||
// fitBoundsOptions: const FitBoundsOptions(
|
||||
// padding: EdgeInsets.all(50),
|
||||
// maxZoom: 265,
|
||||
// ),
|
||||
// markers:indexController.locations[0].collection.map((i) {
|
||||
// print("i si ${i.properties!['location_id']}");
|
||||
// GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
|
||||
// print("lat is ${p.geoSerie!.geoPoints[0].latitude} and lon is ${p.geoSerie!.geoPoints[0].longitude}");
|
||||
// return Marker(
|
||||
// anchorPos: AnchorPos.align(AnchorAlign.center),
|
||||
// height: 22.0,
|
||||
// width: 22.0,
|
||||
// point: LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude),
|
||||
// builder: (ctx) => Icon(Icons.pin_drop),
|
||||
// // builder: (ctx) => i.properties!["category"] != null ?
|
||||
// // ImageIcon(
|
||||
// // AssetImage("assets/images/${i.properties!["category"]}.png"),
|
||||
// // color: Color(0xFF3A5A98),
|
||||
// // size:12.0,
|
||||
// // )
|
||||
// // : Icon(Icons.pin_drop),
|
||||
|
||||
);
|
||||
}).toList(),
|
||||
builder: (context, markers) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20.0),
|
||||
color: Colors.blue),
|
||||
child: Center(
|
||||
child: Text(
|
||||
markers.length.toString(),
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
): Container(height:0,width: 0),
|
||||
],
|
||||
)
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
// );
|
||||
// }).toList(),
|
||||
// builder: (context, markers) {
|
||||
// return Container(
|
||||
// decoration: BoxDecoration(
|
||||
// borderRadius: BorderRadius.circular(20.0),
|
||||
// color: Colors.blue),
|
||||
// child: Center(
|
||||
// child: Text(
|
||||
// markers.length.toString(),
|
||||
// style: TextStyle(color: Colors.white),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// ): Container(height:0,width: 0),
|
||||
// ],
|
||||
// )
|
||||
// )
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
@ -1,265 +1,44 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/widgets/cat_widget.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:flutter_map/flutter_map.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// import 'package:rogapp/pages/index/index_controller.dart';
|
||||
// import 'package:rogapp/widgets/cat_widget.dart';
|
||||
|
||||
|
||||
class PerfectureWidget extends StatefulWidget {
|
||||
// class PerfectureWidget extends StatefulWidget {
|
||||
|
||||
IndexController indexController;
|
||||
MapController mapController;
|
||||
|
||||
|
||||
PerfectureWidget({Key? key, required this.indexController, required this.mapController}) : super(key: key){
|
||||
//indexController.zoomtoMainPerf("9", mapController);
|
||||
}
|
||||
|
||||
@override
|
||||
State<PerfectureWidget> createState() => _PerfectureWidgetState();
|
||||
}
|
||||
|
||||
class _PerfectureWidgetState extends State<PerfectureWidget> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
||||
bool isNumeric(String s) {
|
||||
if (s == null) {
|
||||
return false;
|
||||
}
|
||||
return double.tryParse(s) != null;
|
||||
}
|
||||
|
||||
|
||||
List<DropdownMenuItem<String>> getDropdownItems() {
|
||||
List<DropdownMenuItem<String>> dropDownItems = [];
|
||||
|
||||
for (Map<String, dynamic> currency in widget.indexController.perfectures[0]) {
|
||||
//print(currency["id"].toString());
|
||||
var newDropdown = DropdownMenuItem(
|
||||
child: Text(currency["adm1_ja"].toString()),
|
||||
value: currency["id"].toString(),
|
||||
);
|
||||
|
||||
dropDownItems.add(newDropdown);
|
||||
}
|
||||
return dropDownItems;
|
||||
}
|
||||
|
||||
List<DropdownMenuItem<String>> getSubDropdownItems() {
|
||||
List<DropdownMenuItem<String>> dropDownItems = [];
|
||||
|
||||
if(widget.indexController.subPerfs.isNotEmpty){
|
||||
|
||||
for (Map<String, dynamic> currency in widget.indexController.subPerfs[0]) {
|
||||
var newDropdown = DropdownMenuItem(
|
||||
child: Text(currency["adm2_ja"].toString()),
|
||||
value: currency["id"].toString(),
|
||||
);
|
||||
|
||||
dropDownItems.add(newDropdown);
|
||||
}
|
||||
}
|
||||
return dropDownItems;
|
||||
}
|
||||
|
||||
List<DropdownMenuItem<String>> getCustomArea(){
|
||||
List<DropdownMenuItem<String>> dropDownItems = [];
|
||||
if(widget.indexController.areas.isNotEmpty){
|
||||
|
||||
for (Map<String, dynamic> currency in widget.indexController.areas[0]) {
|
||||
var newDropdown = DropdownMenuItem(
|
||||
child: Text(currency["area_nm"].toString()),
|
||||
value: currency["id"].toString(),
|
||||
);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
List<DropdownMenuItem<String>> getCategory(){
|
||||
List<DropdownMenuItem<String>> dropDownItems = [];
|
||||
|
||||
dropDownItems.clear();
|
||||
|
||||
//print("--------cats ------############### ${widget.indexController.cats.toString()} -------------");
|
||||
for(dynamic d in widget.indexController.cats){
|
||||
//print("-------- ddd ------############### ${d} --------dddd-----");
|
||||
var newDropdown = DropdownMenuItem(child: Text(d['category'].toString()), value: d['category'].toString());
|
||||
//print("--------cats ------############### ${d['category'].toString()} -------------");
|
||||
dropDownItems.add(newDropdown);
|
||||
}
|
||||
|
||||
//return [];
|
||||
|
||||
return dropDownItems;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return Obx(() =>
|
||||
Row(
|
||||
children: [
|
||||
DropdownButton<String>(
|
||||
value: widget.indexController.dropdownValue,
|
||||
icon: const Icon(Icons.arrow_downward),
|
||||
elevation: 16,
|
||||
style: const TextStyle(color: Colors.deepPurple),
|
||||
underline: Container(
|
||||
height: 2,
|
||||
color: Colors.deepPurpleAccent,
|
||||
),
|
||||
onChanged: (String? newValue) {
|
||||
//setState(() {
|
||||
if(newValue != null){
|
||||
widget.indexController.is_loading.value = true;
|
||||
widget.indexController.dropdownValue = newValue;
|
||||
widget.indexController.populateForPerf(newValue, widget.mapController);
|
||||
}
|
||||
//});
|
||||
},
|
||||
items: getDropdownItems()
|
||||
),
|
||||
|
||||
// Gifu areas
|
||||
widget.indexController.areas.isNotEmpty ?
|
||||
DropdownButton<String>(
|
||||
value: widget.indexController.areaDropdownValue,
|
||||
icon: const Icon(Icons.arrow_downward),
|
||||
elevation: 16,
|
||||
style: const TextStyle(color: Colors.deepPurple),
|
||||
hint: const Text("select"),
|
||||
underline: Container(
|
||||
height: 2,
|
||||
color: Colors.deepPurpleAccent,
|
||||
),
|
||||
onChanged: (String? newValue) {
|
||||
if (isNumeric(newValue!)){
|
||||
widget.indexController.is_custom_area_selected.value = false;
|
||||
}
|
||||
else{
|
||||
widget.indexController.loadCustomLocation(newValue);
|
||||
widget.indexController.is_custom_area_selected.value = true;
|
||||
widget.indexController.subPerfs.clear();
|
||||
widget.indexController.cats.clear();
|
||||
}
|
||||
setState(() {
|
||||
widget.indexController.locations.clear();
|
||||
if(newValue != null){
|
||||
widget.indexController.is_loading.value = true;
|
||||
widget.indexController.areaDropdownValue = newValue;
|
||||
widget.indexController.populateSubPerForArea(newValue, widget.mapController);
|
||||
}
|
||||
});
|
||||
},
|
||||
items: getCustomArea(),
|
||||
): const Text(""),
|
||||
|
||||
widget.indexController.subPerfs.isNotEmpty ?
|
||||
DropdownButton<String>(
|
||||
value: widget.indexController.subDropdownValue,
|
||||
icon: const Icon(Icons.arrow_downward),
|
||||
elevation: 16,
|
||||
style: const TextStyle(color: Colors.deepPurple),
|
||||
hint: const Text("select"),
|
||||
underline: Container(
|
||||
height: 2,
|
||||
color: Colors.deepPurpleAccent,
|
||||
),
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
if(newValue != null){
|
||||
//widget.indexController.is_loading.value = true;
|
||||
//widget.indexController.populateForSubPerf(newValue, widget.mapController);
|
||||
//widget.indexController.loadLocationforSubPerf(newValue, widget.mapController);
|
||||
widget.indexController.subDropdownValue = newValue;
|
||||
widget.indexController.loadCatForCity(newValue);
|
||||
}
|
||||
});
|
||||
},
|
||||
items:
|
||||
getSubDropdownItems()
|
||||
) :
|
||||
const Text(""),
|
||||
//CatWidget(indexController: widget.indexController,),
|
||||
widget.indexController.cats.length > 0 ?
|
||||
DropdownButton<String>(
|
||||
value: widget.indexController.cateogory,
|
||||
icon: const Icon(Icons.arrow_downward),
|
||||
elevation: 16,
|
||||
style: const TextStyle(color: Colors.deepPurple),
|
||||
hint: const Text("select"),
|
||||
underline: Container(
|
||||
height: 2,
|
||||
color: Colors.deepPurpleAccent,
|
||||
),
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
if(newValue != null){
|
||||
widget.indexController.is_loading.value = true;
|
||||
widget.indexController.cateogory = newValue;
|
||||
widget.indexController.currentCat.clear();
|
||||
widget.indexController.currentCat.add(newValue);
|
||||
widget.indexController.populateForSubPerf(widget.indexController.subDropdownValue, widget.mapController);
|
||||
//widget.indexController.loadLocationforSubPerf(newValue, widget.mapController);
|
||||
//widget.indexController.subDropdownValue = newValue;
|
||||
}
|
||||
});
|
||||
},
|
||||
items:
|
||||
getCategory(),
|
||||
)
|
||||
:
|
||||
Container(),
|
||||
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// class PerfectureWidget extends StatefulWidget {
|
||||
|
||||
// HomeController homeController;
|
||||
// IndexController indexController;
|
||||
// MapController mapController;
|
||||
|
||||
// PerfectureWidget({required this.homeController, required this.mapController});
|
||||
|
||||
// PerfectureWidget({Key? key, required this.indexController, required this.mapController}) : super(key: key){
|
||||
// //indexController.zoomtoMainPerf("9", mapController);
|
||||
// }
|
||||
|
||||
// @override
|
||||
// State<PerfectureWidget> createState() => _PerfectureWidgetState();
|
||||
// }
|
||||
|
||||
// class _PerfectureWidgetState extends State<PerfectureWidget> {
|
||||
// String dropdownValue = "9";
|
||||
|
||||
// @override
|
||||
// void initState() {
|
||||
// super.initState();
|
||||
// }
|
||||
|
||||
|
||||
// bool isNumeric(String s) {
|
||||
// if (s == null) {
|
||||
// return false;
|
||||
// }
|
||||
// return double.tryParse(s) != null;
|
||||
// }
|
||||
|
||||
|
||||
// List<DropdownMenuItem<String>> getDropdownItems() {
|
||||
// List<DropdownMenuItem<String>> dropDownItems = [];
|
||||
|
||||
// for (Map<String, dynamic> currency in widget.homeController.perfectures[0]) {
|
||||
// for (Map<String, dynamic> currency in widget.indexController.perfectures[0]) {
|
||||
// //print(currency["id"].toString());
|
||||
// var newDropdown = DropdownMenuItem(
|
||||
// child: Text(currency["adm1_ja"].toString()),
|
||||
@ -274,9 +53,9 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
|
||||
// List<DropdownMenuItem<String>> getSubDropdownItems() {
|
||||
// List<DropdownMenuItem<String>> dropDownItems = [];
|
||||
|
||||
// if(widget.homeController.subPerfs.length > 0){
|
||||
// if(widget.indexController.subPerfs.isNotEmpty){
|
||||
|
||||
// for (Map<String, dynamic> currency in widget.homeController.subPerfs[0]) {
|
||||
// for (Map<String, dynamic> currency in widget.indexController.subPerfs[0]) {
|
||||
// var newDropdown = DropdownMenuItem(
|
||||
// child: Text(currency["adm2_ja"].toString()),
|
||||
// value: currency["id"].toString(),
|
||||
@ -288,13 +67,55 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
|
||||
// return dropDownItems;
|
||||
// }
|
||||
|
||||
// @override
|
||||
// void initState() {
|
||||
// super.initState();
|
||||
// widget.homeController.loadSubPerfFor("9");
|
||||
// widget.homeController.zoomtoMainPerf("9", widget.mapController);
|
||||
// List<DropdownMenuItem<String>> getCustomArea(){
|
||||
// List<DropdownMenuItem<String>> dropDownItems = [];
|
||||
// if(widget.indexController.areas.isNotEmpty){
|
||||
|
||||
// for (Map<String, dynamic> currency in widget.indexController.areas[0]) {
|
||||
// var newDropdown = DropdownMenuItem(
|
||||
// child: Text(currency["area_nm"].toString()),
|
||||
// value: currency["id"].toString(),
|
||||
// );
|
||||
|
||||
// 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;
|
||||
// }
|
||||
|
||||
|
||||
// List<DropdownMenuItem<String>> getCategory(){
|
||||
// List<DropdownMenuItem<String>> dropDownItems = [];
|
||||
|
||||
// dropDownItems.clear();
|
||||
|
||||
// //print("--------cats ------############### ${widget.indexController.cats.toString()} -------------");
|
||||
// for(dynamic d in widget.indexController.cats){
|
||||
// //print("-------- ddd ------############### ${d} --------dddd-----");
|
||||
// var newDropdown = DropdownMenuItem(child: Text(d['category'].toString()), value: d['category'].toString());
|
||||
// //print("--------cats ------############### ${d['category'].toString()} -------------");
|
||||
// dropDownItems.add(newDropdown);
|
||||
// }
|
||||
|
||||
// //return [];
|
||||
|
||||
// return dropDownItems;
|
||||
// }
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
|
||||
@ -302,7 +123,7 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
|
||||
// Row(
|
||||
// children: [
|
||||
// DropdownButton<String>(
|
||||
// value: dropdownValue,
|
||||
// value: widget.indexController.dropdownValue,
|
||||
// icon: const Icon(Icons.arrow_downward),
|
||||
// elevation: 16,
|
||||
// style: const TextStyle(color: Colors.deepPurple),
|
||||
@ -313,45 +134,105 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
|
||||
// onChanged: (String? newValue) {
|
||||
// //setState(() {
|
||||
// if(newValue != null){
|
||||
// dropdownValue = newValue;
|
||||
// widget.homeController.loadLocationforPerf(newValue, widget.mapController);
|
||||
// widget.homeController.loadSubPerfFor(newValue);
|
||||
// //SubDropdownValue = widget.homeController.getSubInitialVal();
|
||||
// //widget.mapController.fitBounds(widget.homeController.currentBound[0]);
|
||||
// widget.homeController.zoomtoMainPerf(newValue, widget.mapController);
|
||||
// widget.indexController.is_loading.value = true;
|
||||
// widget.indexController.dropdownValue = newValue;
|
||||
// widget.indexController.populateForPerf(newValue, widget.mapController);
|
||||
// }
|
||||
// //});
|
||||
// },
|
||||
// items: getDropdownItems()
|
||||
// ),
|
||||
|
||||
// widget.homeController.subPerfs.length > 0 ?
|
||||
|
||||
// // Gifu areas
|
||||
// widget.indexController.areas.isNotEmpty ?
|
||||
// DropdownButton<String>(
|
||||
// value: widget.homeController.SubDropdownValue,
|
||||
// value: widget.indexController.areaDropdownValue,
|
||||
// icon: const Icon(Icons.arrow_downward),
|
||||
// elevation: 16,
|
||||
// style: const TextStyle(color: Colors.deepPurple),
|
||||
// hint: const Text("select"),
|
||||
// underline: Container(
|
||||
// height: 2,
|
||||
// color: Colors.deepPurpleAccent,
|
||||
// ),
|
||||
// onChanged: (String? newValue) {
|
||||
// if (isNumeric(newValue!)){
|
||||
// widget.indexController.is_custom_area_selected.value = false;
|
||||
// }
|
||||
// else{
|
||||
// widget.indexController.loadCustomLocation(newValue);
|
||||
// widget.indexController.is_custom_area_selected.value = true;
|
||||
// widget.indexController.subPerfs.clear();
|
||||
// widget.indexController.cats.clear();
|
||||
// }
|
||||
// setState(() {
|
||||
// widget.indexController.locations.clear();
|
||||
// if(newValue != null){
|
||||
// widget.indexController.is_loading.value = true;
|
||||
// widget.indexController.areaDropdownValue = newValue;
|
||||
// widget.indexController.populateSubPerForArea(newValue, widget.mapController);
|
||||
// }
|
||||
// });
|
||||
// },
|
||||
// items: getCustomArea(),
|
||||
// ): const Text(""),
|
||||
|
||||
// widget.indexController.subPerfs.isNotEmpty ?
|
||||
// DropdownButton<String>(
|
||||
// value: widget.indexController.subDropdownValue,
|
||||
// icon: const Icon(Icons.arrow_downward),
|
||||
// elevation: 16,
|
||||
// style: const TextStyle(color: Colors.deepPurple),
|
||||
// hint: Container(
|
||||
// child: Text("select"),
|
||||
// ),
|
||||
// hint: const Text("select"),
|
||||
// underline: Container(
|
||||
// height: 2,
|
||||
// color: Colors.deepPurpleAccent,
|
||||
// ),
|
||||
// onChanged: (String? newValue) {
|
||||
// //setState(() {
|
||||
// setState(() {
|
||||
// if(newValue != null){
|
||||
// widget.homeController.loadLocationforSubPerf(newValue, widget.mapController);
|
||||
// widget.homeController.SubDropdownValue = newValue;
|
||||
// widget.homeController.zoomtoSubPerf(newValue, widget.mapController);
|
||||
// //widget.indexController.is_loading.value = true;
|
||||
// //widget.indexController.populateForSubPerf(newValue, widget.mapController);
|
||||
// //widget.indexController.loadLocationforSubPerf(newValue, widget.mapController);
|
||||
// widget.indexController.subDropdownValue = newValue;
|
||||
// widget.indexController.loadCatForCity(newValue);
|
||||
// }
|
||||
// //});
|
||||
// });
|
||||
// },
|
||||
// items:
|
||||
// getSubDropdownItems()
|
||||
// ) :
|
||||
// Text("")
|
||||
// const Text(""),
|
||||
// //CatWidget(indexController: widget.indexController,),
|
||||
// widget.indexController.cats.length > 0 ?
|
||||
// DropdownButton<String>(
|
||||
// value: widget.indexController.cateogory,
|
||||
// icon: const Icon(Icons.arrow_downward),
|
||||
// elevation: 16,
|
||||
// style: const TextStyle(color: Colors.deepPurple),
|
||||
// hint: const Text("select"),
|
||||
// underline: Container(
|
||||
// height: 2,
|
||||
// color: Colors.deepPurpleAccent,
|
||||
// ),
|
||||
// onChanged: (String? newValue) {
|
||||
// setState(() {
|
||||
// if(newValue != null){
|
||||
// widget.indexController.is_loading.value = true;
|
||||
// widget.indexController.cateogory = newValue;
|
||||
// widget.indexController.currentCat.clear();
|
||||
// widget.indexController.currentCat.add(newValue);
|
||||
// widget.indexController.populateForSubPerf(widget.indexController.subDropdownValue, widget.mapController);
|
||||
// //widget.indexController.loadLocationforSubPerf(newValue, widget.mapController);
|
||||
// //widget.indexController.subDropdownValue = newValue;
|
||||
// }
|
||||
// });
|
||||
// },
|
||||
// items:
|
||||
// getCategory(),
|
||||
// )
|
||||
// :
|
||||
// Container(),
|
||||
|
||||
// ],
|
||||
// ),
|
||||
@ -359,3 +240,122 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// // class PerfectureWidget extends StatefulWidget {
|
||||
|
||||
// // HomeController homeController;
|
||||
// // MapController mapController;
|
||||
|
||||
// // PerfectureWidget({required this.homeController, required this.mapController});
|
||||
|
||||
// // @override
|
||||
// // State<PerfectureWidget> createState() => _PerfectureWidgetState();
|
||||
// // }
|
||||
|
||||
// // class _PerfectureWidgetState extends State<PerfectureWidget> {
|
||||
// // String dropdownValue = "9";
|
||||
|
||||
// // List<DropdownMenuItem<String>> getDropdownItems() {
|
||||
// // List<DropdownMenuItem<String>> dropDownItems = [];
|
||||
|
||||
// // for (Map<String, dynamic> currency in widget.homeController.perfectures[0]) {
|
||||
// // //print(currency["id"].toString());
|
||||
// // var newDropdown = DropdownMenuItem(
|
||||
// // child: Text(currency["adm1_ja"].toString()),
|
||||
// // value: currency["id"].toString(),
|
||||
// // );
|
||||
|
||||
// // dropDownItems.add(newDropdown);
|
||||
// // }
|
||||
// // return dropDownItems;
|
||||
// // }
|
||||
|
||||
// // List<DropdownMenuItem<String>> getSubDropdownItems() {
|
||||
// // List<DropdownMenuItem<String>> dropDownItems = [];
|
||||
|
||||
// // if(widget.homeController.subPerfs.length > 0){
|
||||
|
||||
// // for (Map<String, dynamic> currency in widget.homeController.subPerfs[0]) {
|
||||
// // var newDropdown = DropdownMenuItem(
|
||||
// // child: Text(currency["adm2_ja"].toString()),
|
||||
// // value: currency["id"].toString(),
|
||||
// // );
|
||||
|
||||
// // dropDownItems.add(newDropdown);
|
||||
// // }
|
||||
// // }
|
||||
// // return dropDownItems;
|
||||
// // }
|
||||
|
||||
// // @override
|
||||
// // void initState() {
|
||||
// // super.initState();
|
||||
// // widget.homeController.loadSubPerfFor("9");
|
||||
// // widget.homeController.zoomtoMainPerf("9", widget.mapController);
|
||||
// // }
|
||||
|
||||
// // @override
|
||||
// // Widget build(BuildContext context) {
|
||||
|
||||
// // return Obx(() =>
|
||||
// // Row(
|
||||
// // children: [
|
||||
// // DropdownButton<String>(
|
||||
// // value: dropdownValue,
|
||||
// // icon: const Icon(Icons.arrow_downward),
|
||||
// // elevation: 16,
|
||||
// // style: const TextStyle(color: Colors.deepPurple),
|
||||
// // underline: Container(
|
||||
// // height: 2,
|
||||
// // color: Colors.deepPurpleAccent,
|
||||
// // ),
|
||||
// // onChanged: (String? newValue) {
|
||||
// // //setState(() {
|
||||
// // if(newValue != null){
|
||||
// // dropdownValue = newValue;
|
||||
// // widget.homeController.loadLocationforPerf(newValue, widget.mapController);
|
||||
// // widget.homeController.loadSubPerfFor(newValue);
|
||||
// // //SubDropdownValue = widget.homeController.getSubInitialVal();
|
||||
// // //widget.mapController.fitBounds(widget.homeController.currentBound[0]);
|
||||
// // widget.homeController.zoomtoMainPerf(newValue, widget.mapController);
|
||||
// // }
|
||||
// // //});
|
||||
// // },
|
||||
// // items: getDropdownItems()
|
||||
// // ),
|
||||
|
||||
// // widget.homeController.subPerfs.length > 0 ?
|
||||
|
||||
// // DropdownButton<String>(
|
||||
// // value: widget.homeController.SubDropdownValue,
|
||||
// // icon: const Icon(Icons.arrow_downward),
|
||||
// // elevation: 16,
|
||||
// // style: const TextStyle(color: Colors.deepPurple),
|
||||
// // hint: Container(
|
||||
// // child: Text("select"),
|
||||
// // ),
|
||||
// // underline: Container(
|
||||
// // height: 2,
|
||||
// // color: Colors.deepPurpleAccent,
|
||||
// // ),
|
||||
// // onChanged: (String? newValue) {
|
||||
// // //setState(() {
|
||||
// // if(newValue != null){
|
||||
// // widget.homeController.loadLocationforSubPerf(newValue, widget.mapController);
|
||||
// // widget.homeController.SubDropdownValue = newValue;
|
||||
// // widget.homeController.zoomtoSubPerf(newValue, widget.mapController);
|
||||
// // }
|
||||
// // //});
|
||||
// // },
|
||||
// // items:
|
||||
// // getSubDropdownItems()
|
||||
// // ) :
|
||||
// // Text("")
|
||||
|
||||
// // ],
|
||||
// // ),
|
||||
// // );
|
||||
// // }
|
||||
// // }
|
||||
|
||||
|
||||
136
pubspec.lock
136
pubspec.lock
@ -14,7 +14,7 @@ packages:
|
||||
name: async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.8.2"
|
||||
version: "2.9.0"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -28,21 +28,14 @@ packages:
|
||||
name: characters
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
charcode:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: charcode
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.1"
|
||||
version: "1.2.1"
|
||||
clock:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: clock
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
version: "1.1.1"
|
||||
collection:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -71,20 +64,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
extra_pedantic:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: extra_pedantic
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.5.0"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fake_async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
version: "1.3.1"
|
||||
ffi:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -152,35 +138,35 @@ packages:
|
||||
name: flutter_lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
version: "2.0.1"
|
||||
flutter_map:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_map
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
version: "3.0.0"
|
||||
flutter_map_location_marker:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_map_location_marker
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.1.0"
|
||||
version: "5.0.0+1"
|
||||
flutter_map_marker_cluster:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_map_marker_cluster
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.5.0"
|
||||
version: "1.0.1"
|
||||
flutter_map_marker_popup:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_map_marker_popup
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.2.1"
|
||||
version: "4.0.0"
|
||||
flutter_plugin_android_lifecycle:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -212,34 +198,27 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
geodesy:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: geodesy
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.0-nullsafety.0"
|
||||
geojson:
|
||||
geojson_vi:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: geojson
|
||||
name: geojson_vi
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
version: "2.0.7"
|
||||
geolocator:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: geolocator
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "8.2.1"
|
||||
version: "9.0.2"
|
||||
geolocator_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: geolocator_android
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.2.1"
|
||||
version: "4.1.4"
|
||||
geolocator_apple:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -268,13 +247,6 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.1"
|
||||
geopoint:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: geopoint
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
get:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -373,13 +345,6 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.17.0"
|
||||
iso:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: iso
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -400,7 +365,7 @@ packages:
|
||||
name: lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
version: "2.0.1"
|
||||
lists:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -414,28 +379,28 @@ packages:
|
||||
name: matcher
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.12.11"
|
||||
version: "0.12.12"
|
||||
material_color_utilities:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: material_color_utilities
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.4"
|
||||
version: "0.1.5"
|
||||
material_design_icons_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: material_design_icons_flutter
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "5.0.6595"
|
||||
version: "6.0.7096"
|
||||
meta:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: meta
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.7.0"
|
||||
version: "1.8.0"
|
||||
mgrs_dart:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -443,13 +408,20 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
nested:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: nested
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.1"
|
||||
version: "1.8.2"
|
||||
path_provider:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -512,14 +484,35 @@ packages:
|
||||
name: permission_handler
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "8.3.0"
|
||||
version: "10.2.0"
|
||||
permission_handler_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_android
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "10.2.0"
|
||||
permission_handler_apple:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_apple
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "9.0.7"
|
||||
permission_handler_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.7.0"
|
||||
version: "3.9.0"
|
||||
permission_handler_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: permission_handler_windows
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.2"
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -568,7 +561,14 @@ packages:
|
||||
name: proj4dart
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "2.1.0"
|
||||
provider:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: provider
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "6.0.4"
|
||||
quiver:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -581,20 +581,20 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.99"
|
||||
slugify:
|
||||
dependency: transitive
|
||||
sliding_up_panel:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: slugify
|
||||
name: sliding_up_panel
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "2.0.0+1"
|
||||
source_span:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.2"
|
||||
version: "1.9.0"
|
||||
sqflite:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -636,7 +636,7 @@ packages:
|
||||
name: string_scanner
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
version: "1.1.1"
|
||||
synchronized:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -650,14 +650,14 @@ packages:
|
||||
name: term_glyph
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.2.1"
|
||||
test_api:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.9"
|
||||
version: "0.4.12"
|
||||
timeline_tile:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -778,5 +778,5 @@ packages:
|
||||
source: hosted
|
||||
version: "0.2.0+1"
|
||||
sdks:
|
||||
dart: ">=2.17.0 <3.0.0"
|
||||
flutter: ">=3.0.0"
|
||||
dart: ">=2.17.5 <3.0.0"
|
||||
flutter: ">=3.3.0"
|
||||
|
||||
16
pubspec.yaml
16
pubspec.yaml
@ -36,9 +36,9 @@ dependencies:
|
||||
cupertino_icons: ^1.0.2
|
||||
sqflite: ^2.0.1
|
||||
get: ^4.6.5
|
||||
flutter_map: any
|
||||
geolocator: ^8.0.1
|
||||
permission_handler: ^8.3.0
|
||||
flutter_map: ^3.0.0
|
||||
geolocator: ^9.0.1
|
||||
permission_handler: ^10.0.0
|
||||
google_api_availability: ^3.0.1
|
||||
tuple: ^2.0.0
|
||||
latlong2: ^0.8.1
|
||||
@ -53,11 +53,11 @@ dependencies:
|
||||
path_provider: ^2.0.8
|
||||
flutter_map_location_marker: any
|
||||
flutter_map_marker_cluster: any
|
||||
material_design_icons_flutter: ^5.0.6595
|
||||
material_design_icons_flutter: ^6.0.7096
|
||||
google_fonts: any
|
||||
image_picker: ^0.8.4+4
|
||||
#geojson_vi: ^2.0.7
|
||||
geojson: ^1.0.0
|
||||
geojson_vi: ^2.0.7
|
||||
#geojson: ^1.0.0
|
||||
url_launcher: ^6.0.20
|
||||
flutter_breadcrumb: ^1.0.1
|
||||
timeline_tile: ^2.0.0
|
||||
@ -66,6 +66,8 @@ dependencies:
|
||||
flutter_polyline_points: ^1.0.0
|
||||
google_maps_webservice: ^0.0.19
|
||||
flutter_typeahead: ^4.0.0
|
||||
sliding_up_panel: ^2.0.0+1
|
||||
|
||||
|
||||
|
||||
dev_dependencies:
|
||||
@ -77,7 +79,7 @@ dev_dependencies:
|
||||
# activated in the `analysis_options.yaml` file located at the root of your
|
||||
# package. See that file for information about deactivating specific lint
|
||||
# rules and activating additional ones.
|
||||
flutter_lints: ^1.0.0
|
||||
flutter_lints: ^2.0.1
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
@ -7,11 +7,14 @@
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <geolocator_windows/geolocator_windows.h>
|
||||
#include <permission_handler_windows/permission_handler_windows_plugin.h>
|
||||
#include <url_launcher_windows/url_launcher_windows.h>
|
||||
|
||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||
GeolocatorWindowsRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("GeolocatorWindows"));
|
||||
PermissionHandlerWindowsPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
|
||||
UrlLauncherWindowsRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
geolocator_windows
|
||||
permission_handler_windows
|
||||
url_launcher_windows
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user