Compare commits
2 Commits
b9c641954d
...
rog3
| Author | SHA1 | Date | |
|---|---|---|---|
| e9bf50fc14 | |||
| 244b7eb9ac |
@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
|
|||||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion flutter.compileSdkVersion
|
compileSdkVersion 33
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
|||||||
@ -3,15 +3,24 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:permission_handler/permission_handler.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/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';
|
import 'package:rogapp/utils/string_values.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
//WidgetsFlutterBinding.ensureInitialized();
|
//WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
initServices();
|
||||||
runApp(MyApp());
|
runApp(MyApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void initServices() async {
|
||||||
|
print('starting services ...');
|
||||||
|
await Get.putAsync(() => LocationService().init());
|
||||||
|
print('All services started...');
|
||||||
|
}
|
||||||
|
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
const MyApp({Key? key}) : super(key: key);
|
const MyApp({Key? key}) : super(key: key);
|
||||||
// This widget is the root of your application.
|
// This widget is the root of your application.
|
||||||
@ -32,8 +41,8 @@ class MyApp extends StatelessWidget {
|
|||||||
opaqueRoute: Get.isOpaqueRouteDefault,
|
opaqueRoute: Get.isOpaqueRouteDefault,
|
||||||
popGesture: Get.isPopGestureEnable,
|
popGesture: Get.isPopGestureEnable,
|
||||||
transitionDuration: const Duration(milliseconds: 230),
|
transitionDuration: const Duration(milliseconds: 230),
|
||||||
initialBinding: IndexBinding(), //HomeBinding(),
|
initialBinding: RogBinding(), //HomeBinding(),
|
||||||
initialRoute: AppPages.PERMISSION,
|
initialRoute: AppPages.ROG,
|
||||||
getPages: AppPages.routes,
|
getPages: AppPages.routes,
|
||||||
enableLog: true,
|
enableLog: true,
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,93 +1,93 @@
|
|||||||
|
|
||||||
|
|
||||||
class Destination {
|
// class Destination {
|
||||||
String? name;
|
// String? name;
|
||||||
String? address;
|
// String? address;
|
||||||
String? phone;
|
// String? phone;
|
||||||
String? email;
|
// String? email;
|
||||||
String? webcontents;
|
// String? webcontents;
|
||||||
String? videos;
|
// String? videos;
|
||||||
String? category;
|
// String? category;
|
||||||
int? series;
|
// int? series;
|
||||||
double? lat;
|
// double? lat;
|
||||||
double? lon;
|
// double? lon;
|
||||||
int? location_id;
|
// int? location_id;
|
||||||
int? list_order;
|
// int? list_order;
|
||||||
String? photos;
|
// String? photos;
|
||||||
double? checkin_radious;
|
// double? checkin_radious;
|
||||||
int? auto_checkin;
|
// int? auto_checkin;
|
||||||
bool? selected = false;
|
// bool? selected = false;
|
||||||
bool? checkedin = false;
|
// bool? checkedin = false;
|
||||||
|
|
||||||
Destination({
|
// Destination({
|
||||||
this.name,
|
// this.name,
|
||||||
this.address,
|
// this.address,
|
||||||
this.phone,
|
// this.phone,
|
||||||
this.email,
|
// this.email,
|
||||||
this.webcontents,
|
// this.webcontents,
|
||||||
this.videos,
|
// this.videos,
|
||||||
this.category,
|
// this.category,
|
||||||
this.series,
|
// this.series,
|
||||||
this.lat,
|
// this.lat,
|
||||||
this.lon,
|
// this.lon,
|
||||||
this.location_id,
|
// this.location_id,
|
||||||
this.list_order,
|
// this.list_order,
|
||||||
this.photos,
|
// this.photos,
|
||||||
this.checkin_radious,
|
// this.checkin_radious,
|
||||||
this.auto_checkin,
|
// this.auto_checkin,
|
||||||
this.selected,
|
// this.selected,
|
||||||
this.checkedin
|
// this.checkedin
|
||||||
});
|
// });
|
||||||
|
|
||||||
factory Destination.fromMap(Map<String, dynamic> json) {
|
// factory Destination.fromMap(Map<String, dynamic> json) {
|
||||||
|
|
||||||
bool selec = json['selected'] == 0 ? false : true;
|
// bool selec = json['selected'] == 0 ? false : true;
|
||||||
bool checkin = json['checkedin'] == 0 ? false : true;
|
// bool checkin = json['checkedin'] == 0 ? false : true;
|
||||||
|
|
||||||
return Destination(
|
// return Destination(
|
||||||
name: json['name'],
|
// name: json['name'],
|
||||||
address: json['address'],
|
// address: json['address'],
|
||||||
phone: json['phone'],
|
// phone: json['phone'],
|
||||||
email: json['email'],
|
// email: json['email'],
|
||||||
webcontents: json['webcontents'],
|
// webcontents: json['webcontents'],
|
||||||
videos: json['videos'],
|
// videos: json['videos'],
|
||||||
category: json['category'],
|
// category: json['category'],
|
||||||
series: json['series'],
|
// series: json['series'],
|
||||||
lat: json['lat'],
|
// lat: json['lat'],
|
||||||
lon: json['lon'],
|
// lon: json['lon'],
|
||||||
location_id: json['location_id'],
|
// location_id: json['location_id'],
|
||||||
list_order: json['list_order'],
|
// list_order: json['list_order'],
|
||||||
photos: json['photos'],
|
// photos: json['photos'],
|
||||||
checkin_radious: json['checkin_radious'],
|
// checkin_radious: json['checkin_radious'],
|
||||||
auto_checkin:json['auto_checkin'],
|
// auto_checkin:json['auto_checkin'],
|
||||||
selected: selec,
|
// selected: selec,
|
||||||
checkedin: checkin
|
// checkedin: checkin
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
Map<String, dynamic> toMap(){
|
// Map<String, dynamic> toMap(){
|
||||||
int sel = selected == false ? 0 : 1;
|
// int sel = selected == false ? 0 : 1;
|
||||||
int check = checkedin == false ? 0 : 1;
|
// int check = checkedin == false ? 0 : 1;
|
||||||
return {
|
// return {
|
||||||
'name':name,
|
// 'name':name,
|
||||||
'address': address,
|
// 'address': address,
|
||||||
'phone': phone,
|
// 'phone': phone,
|
||||||
'email': email,
|
// 'email': email,
|
||||||
'webcontents': webcontents,
|
// 'webcontents': webcontents,
|
||||||
'videos': videos,
|
// 'videos': videos,
|
||||||
'category':category,
|
// 'category':category,
|
||||||
'series':series,
|
// 'series':series,
|
||||||
'lat':lat,
|
// 'lat':lat,
|
||||||
'lon':lon,
|
// 'lon':lon,
|
||||||
'location_id':location_id,
|
// 'location_id':location_id,
|
||||||
'list_order':list_order,
|
// 'list_order':list_order,
|
||||||
'photos':photos,
|
// 'photos':photos,
|
||||||
'checkin_radious': checkin_radious,
|
// 'checkin_radious': checkin_radious,
|
||||||
'auto_checkin': auto_checkin,
|
// 'auto_checkin': auto_checkin,
|
||||||
'selected': sel,
|
// 'selected': sel,
|
||||||
'checkedin': check
|
// '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:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
// import 'package:get/get.dart';
|
||||||
import 'package:rogapp/routes/app_pages.dart';
|
// import 'package:rogapp/routes/app_pages.dart';
|
||||||
|
|
||||||
class LandingPage extends StatefulWidget {
|
// class LandingPage extends StatefulWidget {
|
||||||
const LandingPage({ Key? key }) : super(key: key);
|
// const LandingPage({ Key? key }) : super(key: key);
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
State<LandingPage> createState() => _LandingPageState();
|
// State<LandingPage> createState() => _LandingPageState();
|
||||||
}
|
// }
|
||||||
|
|
||||||
class _LandingPageState extends State<LandingPage> {
|
// class _LandingPageState extends State<LandingPage> {
|
||||||
@override
|
// @override
|
||||||
Widget build(BuildContext context) {
|
// Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
// return Scaffold(
|
||||||
body: SafeArea(
|
// body: SafeArea(
|
||||||
child: Container(
|
// child: Container(
|
||||||
width: double.infinity,
|
// width: double.infinity,
|
||||||
height: MediaQuery.of(context).size.height,
|
// height: MediaQuery.of(context).size.height,
|
||||||
padding: EdgeInsets.symmetric(horizontal: 30,vertical: 30),
|
// padding: EdgeInsets.symmetric(horizontal: 30,vertical: 30),
|
||||||
child: Column(
|
// child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
// children: [
|
||||||
Column(
|
// Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
// children: [
|
||||||
Text(
|
// Text(
|
||||||
"こんにちは!",
|
// "こんにちは!",
|
||||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 40),
|
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 40),
|
||||||
),
|
// ),
|
||||||
SizedBox(height: 30,),
|
// SizedBox(height: 30,),
|
||||||
Text("ログインを有効にして本人確認を行うと、サーバーが改善されます",
|
// Text("ログインを有効にして本人確認を行うと、サーバーが改善されます",
|
||||||
textAlign: TextAlign.center,
|
// textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
// style: TextStyle(
|
||||||
color: Colors.grey[700],
|
// color: Colors.grey[700],
|
||||||
fontSize: 15
|
// fontSize: 15
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
Container(
|
// Container(
|
||||||
height: MediaQuery.of(context).size.height/3,
|
// height: MediaQuery.of(context).size.height/3,
|
||||||
decoration: BoxDecoration(
|
// decoration: BoxDecoration(
|
||||||
image:DecorationImage(image: AssetImage('assets/gradient_japanese_temple.jpg'))
|
// image:DecorationImage(image: AssetImage('assets/gradient_japanese_temple.jpg'))
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
SizedBox(height: 20.0,),
|
// SizedBox(height: 20.0,),
|
||||||
MaterialButton(
|
// MaterialButton(
|
||||||
minWidth: double.infinity,
|
// minWidth: double.infinity,
|
||||||
height:60,
|
// height:60,
|
||||||
onPressed: (){
|
// onPressed: (){
|
||||||
Get.toNamed(AppPages.LOGIN);
|
// Get.toNamed(AppPages.LOGIN);
|
||||||
},
|
// },
|
||||||
color: Colors.indigoAccent[400],
|
// color: Colors.indigoAccent[400],
|
||||||
shape: RoundedRectangleBorder(
|
// shape: RoundedRectangleBorder(
|
||||||
side: BorderSide(
|
// side: BorderSide(
|
||||||
color: Colors.black,
|
// color: Colors.black,
|
||||||
),
|
// ),
|
||||||
borderRadius: BorderRadius.circular(40)
|
// borderRadius: BorderRadius.circular(40)
|
||||||
),
|
// ),
|
||||||
child: Text("ログイン",style: TextStyle(
|
// child: Text("ログイン",style: TextStyle(
|
||||||
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
// fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
||||||
|
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
SizedBox(height: 15.0,),
|
// SizedBox(height: 15.0,),
|
||||||
|
|
||||||
MaterialButton(
|
// MaterialButton(
|
||||||
minWidth: double.infinity,
|
// minWidth: double.infinity,
|
||||||
height:60,
|
// height:60,
|
||||||
onPressed: (){
|
// onPressed: (){
|
||||||
Get.toNamed(AppPages.REGISTER);
|
// Get.toNamed(AppPages.REGISTER);
|
||||||
},
|
// },
|
||||||
color: Colors.redAccent,
|
// color: Colors.redAccent,
|
||||||
shape: RoundedRectangleBorder(
|
// shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(40)
|
// borderRadius: BorderRadius.circular(40)
|
||||||
),
|
// ),
|
||||||
child: Text("サインアップ",style: TextStyle(
|
// child: Text("サインアップ",style: TextStyle(
|
||||||
fontWeight: FontWeight.w600,fontSize: 16,
|
// fontWeight: FontWeight.w600,fontSize: 16,
|
||||||
|
|
||||||
),),
|
// ),),
|
||||||
),
|
// ),
|
||||||
|
|
||||||
],
|
// ],
|
||||||
)
|
// )
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
@ -1,178 +1,178 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
// import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
// import 'package:get/get.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
// //import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
import 'package:rogapp/routes/app_pages.dart';
|
// import 'package:rogapp/routes/app_pages.dart';
|
||||||
|
|
||||||
class LoginPage extends StatelessWidget {
|
// class LoginPage extends StatelessWidget {
|
||||||
|
|
||||||
final IndexController indexController = Get.find<IndexController>();
|
// // final IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
TextEditingController emailController = TextEditingController();
|
// TextEditingController emailController = TextEditingController();
|
||||||
TextEditingController passwordController = TextEditingController();
|
// TextEditingController passwordController = TextEditingController();
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
Widget build(BuildContext context) {
|
// Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
// return Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
// resizeToAvoidBottomInset: false,
|
||||||
backgroundColor: Colors.white,
|
// backgroundColor: Colors.white,
|
||||||
appBar: AppBar(
|
// appBar: AppBar(
|
||||||
elevation: 0,
|
// elevation: 0,
|
||||||
brightness: Brightness.light,
|
// brightness: Brightness.light,
|
||||||
backgroundColor: Colors.white,
|
// backgroundColor: Colors.white,
|
||||||
leading:
|
// leading:
|
||||||
IconButton( onPressed: (){
|
// IconButton( onPressed: (){
|
||||||
Navigator.pop(context);
|
// Navigator.pop(context);
|
||||||
},icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
|
// },icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
|
||||||
),
|
// ),
|
||||||
body: Container(
|
// body: Container(
|
||||||
height: MediaQuery.of(context).size.height,
|
// height: MediaQuery.of(context).size.height,
|
||||||
width: double.infinity,
|
// width: double.infinity,
|
||||||
child: Column(
|
// child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: [
|
// children: [
|
||||||
Column(
|
// Column(
|
||||||
children: [
|
// children: [
|
||||||
Column(
|
// Column(
|
||||||
children: [
|
// children: [
|
||||||
Text ("ログイン", style: TextStyle(
|
// Text ("ログイン", style: TextStyle(
|
||||||
fontSize: 30,
|
// fontSize: 30,
|
||||||
fontWeight: FontWeight.bold,
|
// fontWeight: FontWeight.bold,
|
||||||
),),
|
// ),),
|
||||||
SizedBox(height: 20,),
|
// SizedBox(height: 20,),
|
||||||
Text("お帰りなさい !資格情報を使用してログインします",style: TextStyle(
|
// Text("お帰りなさい !資格情報を使用してログインします",style: TextStyle(
|
||||||
fontSize: 15,
|
// fontSize: 15,
|
||||||
color: Colors.grey[700],
|
// color: Colors.grey[700],
|
||||||
),),
|
// ),),
|
||||||
SizedBox(height: 30,)
|
// SizedBox(height: 30,)
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
Padding(
|
// Padding(
|
||||||
padding: EdgeInsets.symmetric(
|
// padding: EdgeInsets.symmetric(
|
||||||
horizontal: 40
|
// horizontal: 40
|
||||||
),
|
// ),
|
||||||
child: Column(
|
// child: Column(
|
||||||
children: [
|
// children: [
|
||||||
makeInput(label: "Eメール", controller: emailController),
|
// makeInput(label: "Eメール", controller: emailController),
|
||||||
makeInput(label: "パスワード", controller: passwordController, obsureText: true),
|
// makeInput(label: "パスワード", controller: passwordController, obsureText: true),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
Padding(
|
// Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 40),
|
// padding: EdgeInsets.symmetric(horizontal: 40),
|
||||||
child: Container(
|
// child: Container(
|
||||||
padding: EdgeInsets.only(top: 3,left: 3),
|
// padding: EdgeInsets.only(top: 3,left: 3),
|
||||||
decoration: BoxDecoration(
|
// decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(40),
|
// borderRadius: BorderRadius.circular(40),
|
||||||
border: Border(
|
// border: Border(
|
||||||
bottom: BorderSide(color: Colors.black),
|
// bottom: BorderSide(color: Colors.black),
|
||||||
top: BorderSide(color: Colors.black),
|
// top: BorderSide(color: Colors.black),
|
||||||
right: BorderSide(color: Colors.black),
|
// right: BorderSide(color: Colors.black),
|
||||||
left: BorderSide(color: Colors.black)
|
// left: BorderSide(color: Colors.black)
|
||||||
)
|
// )
|
||||||
),
|
// ),
|
||||||
child: Obx((() =>
|
// child: Obx((() =>
|
||||||
indexController.is_loading == true ? MaterialButton(
|
// indexController.is_loading == true ? MaterialButton(
|
||||||
minWidth: double.infinity,
|
// minWidth: double.infinity,
|
||||||
height:60,
|
// height:60,
|
||||||
onPressed: (){
|
// onPressed: (){
|
||||||
|
|
||||||
},
|
// },
|
||||||
color: Colors.grey[400],
|
// color: Colors.grey[400],
|
||||||
shape: RoundedRectangleBorder(
|
// shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(40)
|
// borderRadius: BorderRadius.circular(40)
|
||||||
),
|
// ),
|
||||||
child: CircularProgressIndicator(),
|
// child: CircularProgressIndicator(),
|
||||||
) :
|
// ) :
|
||||||
MaterialButton(
|
// MaterialButton(
|
||||||
minWidth: double.infinity,
|
// minWidth: double.infinity,
|
||||||
height:60,
|
// height:60,
|
||||||
onPressed: (){
|
// onPressed: (){
|
||||||
if(emailController.text.isEmpty || passwordController.text.isEmpty){
|
// if(emailController.text.isEmpty || passwordController.text.isEmpty){
|
||||||
Get.snackbar(
|
// Get.snackbar(
|
||||||
"No values",
|
// "No values",
|
||||||
"Email and password required",
|
// "Email and password required",
|
||||||
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
// icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
||||||
snackPosition: SnackPosition.TOP,
|
// snackPosition: SnackPosition.TOP,
|
||||||
duration: Duration(milliseconds: 800),
|
// duration: Duration(milliseconds: 800),
|
||||||
backgroundColor: Colors.yellow,
|
// backgroundColor: Colors.yellow,
|
||||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
// //icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||||
);
|
// );
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
indexController.is_loading.value = true;
|
// indexController.is_loading.value = true;
|
||||||
indexController.login(emailController.text, passwordController.text, context);
|
// indexController.login(emailController.text, passwordController.text, context);
|
||||||
},
|
// },
|
||||||
color: Colors.indigoAccent[400],
|
// color: Colors.indigoAccent[400],
|
||||||
shape: RoundedRectangleBorder(
|
// shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(40)
|
// borderRadius: BorderRadius.circular(40)
|
||||||
),
|
// ),
|
||||||
child: Text("ログイン",style: TextStyle(
|
// child: Text("ログイン",style: TextStyle(
|
||||||
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
// fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
)
|
// )
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
)
|
// )
|
||||||
),
|
// ),
|
||||||
SizedBox(height: 20,),
|
// SizedBox(height: 20,),
|
||||||
Row(
|
// Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
// mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
// children: [
|
||||||
Flexible(
|
// Flexible(
|
||||||
child: Text("アカウントをお持ちではありませんか?", style: TextStyle(
|
// child: Text("アカウントをお持ちではありませんか?", style: TextStyle(
|
||||||
overflow: TextOverflow.ellipsis,
|
// overflow: TextOverflow.ellipsis,
|
||||||
),),
|
// ),),
|
||||||
),
|
// ),
|
||||||
TextButton(
|
// TextButton(
|
||||||
onPressed: (){
|
// onPressed: (){
|
||||||
Get.toNamed(AppPages.REGISTER);
|
// Get.toNamed(AppPages.REGISTER);
|
||||||
},
|
// },
|
||||||
child: Text("サインアップ",style: TextStyle(
|
// child: Text("サインアップ",style: TextStyle(
|
||||||
fontWeight: FontWeight.w600,
|
// fontWeight: FontWeight.w600,
|
||||||
fontSize: 18
|
// fontSize: 18
|
||||||
),),
|
// ),),
|
||||||
),
|
// ),
|
||||||
],
|
// ],
|
||||||
)
|
// )
|
||||||
],
|
// ],
|
||||||
|
|
||||||
),
|
// ),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
Widget makeInput({label, required TextEditingController controller, obsureText = false}){
|
// Widget makeInput({label, required TextEditingController controller, obsureText = false}){
|
||||||
return Column(
|
// return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
// children: [
|
||||||
Text(label,style:TextStyle(
|
// Text(label,style:TextStyle(
|
||||||
fontSize: 15,
|
// fontSize: 15,
|
||||||
fontWeight: FontWeight.w400,
|
// fontWeight: FontWeight.w400,
|
||||||
color: Colors.black87
|
// color: Colors.black87
|
||||||
),),
|
// ),),
|
||||||
SizedBox(height: 5,),
|
// SizedBox(height: 5,),
|
||||||
TextField(
|
// TextField(
|
||||||
controller: controller,
|
// controller: controller,
|
||||||
obscureText: obsureText,
|
// obscureText: obsureText,
|
||||||
decoration: InputDecoration(
|
// decoration: InputDecoration(
|
||||||
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
|
// contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
|
||||||
enabledBorder: OutlineInputBorder(
|
// enabledBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
// borderSide: BorderSide(
|
||||||
color: (Colors.grey[400])!,
|
// color: (Colors.grey[400])!,
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
border: OutlineInputBorder(
|
// border: OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: (Colors.grey[400])!
|
// borderSide: BorderSide(color: (Colors.grey[400])!
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
SizedBox(height: 30.0,)
|
// 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:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
// import 'package:get/get.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
// import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:rogapp/routes/app_pages.dart';
|
// import 'package:rogapp/routes/app_pages.dart';
|
||||||
|
|
||||||
class PermissionHandlerScreen extends StatefulWidget {
|
// class PermissionHandlerScreen extends StatefulWidget {
|
||||||
PermissionHandlerScreen({Key? key}) : super(key: key);
|
// PermissionHandlerScreen({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
State<PermissionHandlerScreen> createState() => _PermissionHandlerScreenState();
|
// State<PermissionHandlerScreen> createState() => _PermissionHandlerScreenState();
|
||||||
}
|
// }
|
||||||
|
|
||||||
class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
|
// class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
void initState() {
|
// void initState() {
|
||||||
// TODO: implement initState
|
// // TODO: implement initState
|
||||||
super.initState();
|
// super.initState();
|
||||||
permissionServiceCall();
|
// permissionServiceCall();
|
||||||
}
|
// }
|
||||||
|
|
||||||
permissionServiceCall() async {
|
// permissionServiceCall() async {
|
||||||
await permissionServices().then(
|
// await permissionServices().then(
|
||||||
(value) {
|
// (value) {
|
||||||
if (value != null) {
|
// if (value != null) {
|
||||||
if (value[Permission.location]!.isGranted ) {
|
// if (value[Permission.location]!.isGranted ) {
|
||||||
/* ========= New Screen Added ============= */
|
// /* ========= New Screen Added ============= */
|
||||||
|
|
||||||
Get.toNamed(AppPages.TRAVEL);
|
// Get.toNamed(AppPages.TRAVEL);
|
||||||
|
|
||||||
// Navigator.pushReplacement(
|
// // Navigator.pushReplacement(
|
||||||
// context,
|
// // context,
|
||||||
// MaterialPageRoute(builder: (context) => SplashScreen()),
|
// // MaterialPageRoute(builder: (context) => SplashScreen()),
|
||||||
// );
|
// // );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
/*Permission services*/
|
// /*Permission services*/
|
||||||
Future<Map<Permission, PermissionStatus>> permissionServices() async {
|
// Future<Map<Permission, PermissionStatus>> permissionServices() async {
|
||||||
// You can request multiple permissions at once.
|
// // You can request multiple permissions at once.
|
||||||
Map<Permission, PermissionStatus> statuses = await [
|
// Map<Permission, PermissionStatus> statuses = await [
|
||||||
Permission.location,
|
// Permission.location,
|
||||||
|
|
||||||
//add more permission to request here.
|
// //add more permission to request here.
|
||||||
].request();
|
// ].request();
|
||||||
|
|
||||||
if (statuses[Permission.location]!.isPermanentlyDenied) {
|
// if (statuses[Permission.location]!.isPermanentlyDenied) {
|
||||||
await openAppSettings().then(
|
// await openAppSettings().then(
|
||||||
(value) async {
|
// (value) async {
|
||||||
if (value) {
|
// if (value) {
|
||||||
if (await Permission.location.status.isPermanentlyDenied == true &&
|
// if (await Permission.location.status.isPermanentlyDenied == true &&
|
||||||
await Permission.location.status.isGranted == false) {
|
// await Permission.location.status.isGranted == false) {
|
||||||
// openAppSettings();
|
// // openAppSettings();
|
||||||
permissionServiceCall(); /* opens app settings until permission is granted */
|
// permissionServiceCall(); /* opens app settings until permission is granted */
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
);
|
// );
|
||||||
} else {
|
// } else {
|
||||||
if (statuses[Permission.location]!.isDenied) {
|
// if (statuses[Permission.location]!.isDenied) {
|
||||||
permissionServiceCall();
|
// permissionServiceCall();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/*{Permission.camera: PermissionStatus.granted, Permission.storage: PermissionStatus.granted}*/
|
// /*{Permission.camera: PermissionStatus.granted, Permission.storage: PermissionStatus.granted}*/
|
||||||
return statuses;
|
// return statuses;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
Widget build(BuildContext context) {
|
// Widget build(BuildContext context) {
|
||||||
return Container();
|
// return Container();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
@ -1,179 +1,179 @@
|
|||||||
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
// import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
// import 'package:get/get.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
// import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
import 'package:rogapp/routes/app_pages.dart';
|
// import 'package:rogapp/routes/app_pages.dart';
|
||||||
|
|
||||||
class RegisterPage extends StatelessWidget {
|
// class RegisterPage extends StatelessWidget {
|
||||||
|
|
||||||
final IndexController indexController = Get.find<IndexController>();
|
// final IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
TextEditingController emailController = TextEditingController();
|
// TextEditingController emailController = TextEditingController();
|
||||||
TextEditingController passwordController = TextEditingController();
|
// TextEditingController passwordController = TextEditingController();
|
||||||
TextEditingController confirmPasswordController = TextEditingController();
|
// TextEditingController confirmPasswordController = TextEditingController();
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
Widget build(BuildContext context) {
|
// Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
// return Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
// resizeToAvoidBottomInset: false,
|
||||||
backgroundColor: Colors.white,
|
// backgroundColor: Colors.white,
|
||||||
appBar: AppBar(
|
// appBar: AppBar(
|
||||||
elevation: 0,
|
// elevation: 0,
|
||||||
brightness: Brightness.light,
|
// brightness: Brightness.light,
|
||||||
backgroundColor: Colors.white,
|
// backgroundColor: Colors.white,
|
||||||
leading:
|
// leading:
|
||||||
IconButton( onPressed: (){
|
// IconButton( onPressed: (){
|
||||||
Navigator.pop(context);
|
// Navigator.pop(context);
|
||||||
},icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
|
// },icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
|
||||||
),
|
// ),
|
||||||
body: SafeArea(
|
// body: SafeArea(
|
||||||
child: SingleChildScrollView(
|
// child: SingleChildScrollView(
|
||||||
child: Container(
|
// child: Container(
|
||||||
height: MediaQuery.of(context).size.height,
|
// height: MediaQuery.of(context).size.height,
|
||||||
width: double.infinity,
|
// width: double.infinity,
|
||||||
child: Column(
|
// child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
// children: [
|
||||||
Column(
|
// Column(
|
||||||
children: [
|
// children: [
|
||||||
Column(
|
// Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: [
|
// children: [
|
||||||
Text ("サインアップ", style: TextStyle(
|
// Text ("サインアップ", style: TextStyle(
|
||||||
fontSize: 30,
|
// fontSize: 30,
|
||||||
fontWeight: FontWeight.bold,
|
// fontWeight: FontWeight.bold,
|
||||||
),),
|
// ),),
|
||||||
SizedBox(height: 20,),
|
// SizedBox(height: 20,),
|
||||||
Text("アカウントを作成し、無料です",style: TextStyle(
|
// Text("アカウントを作成し、無料です",style: TextStyle(
|
||||||
fontSize: 15,
|
// fontSize: 15,
|
||||||
color: Colors.grey[700],
|
// color: Colors.grey[700],
|
||||||
),),
|
// ),),
|
||||||
SizedBox(height: 30,)
|
// SizedBox(height: 30,)
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
Padding(
|
// Padding(
|
||||||
padding: EdgeInsets.symmetric(
|
// padding: EdgeInsets.symmetric(
|
||||||
horizontal: 40
|
// horizontal: 40
|
||||||
),
|
// ),
|
||||||
child: Column(
|
// child: Column(
|
||||||
children: [
|
// children: [
|
||||||
makeInput(label: "Eメール", controller: emailController),
|
// makeInput(label: "Eメール", controller: emailController),
|
||||||
makeInput(label: "パスワード", controller: passwordController,obsureText: true),
|
// makeInput(label: "パスワード", controller: passwordController,obsureText: true),
|
||||||
makeInput(label: "パスワードを認証する", controller: confirmPasswordController,obsureText: true)
|
// makeInput(label: "パスワードを認証する", controller: confirmPasswordController,obsureText: true)
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
Padding(
|
// Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 40),
|
// padding: EdgeInsets.symmetric(horizontal: 40),
|
||||||
child: Container(
|
// child: Container(
|
||||||
padding: EdgeInsets.only(top: 3,left: 3),
|
// padding: EdgeInsets.only(top: 3,left: 3),
|
||||||
decoration: BoxDecoration(
|
// decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(40),
|
// borderRadius: BorderRadius.circular(40),
|
||||||
border: Border(
|
// border: Border(
|
||||||
bottom: BorderSide(color: Colors.black),
|
// bottom: BorderSide(color: Colors.black),
|
||||||
top: BorderSide(color: Colors.black),
|
// top: BorderSide(color: Colors.black),
|
||||||
right: BorderSide(color: Colors.black),
|
// right: BorderSide(color: Colors.black),
|
||||||
left: BorderSide(color: Colors.black)
|
// left: BorderSide(color: Colors.black)
|
||||||
)
|
// )
|
||||||
),
|
// ),
|
||||||
child: MaterialButton(
|
// child: MaterialButton(
|
||||||
minWidth: double.infinity,
|
// minWidth: double.infinity,
|
||||||
height:60,
|
// height:60,
|
||||||
onPressed: (){
|
// onPressed: (){
|
||||||
if(passwordController.text != confirmPasswordController.text){
|
// if(passwordController.text != confirmPasswordController.text){
|
||||||
Get.snackbar(
|
// Get.snackbar(
|
||||||
"No match",
|
// "No match",
|
||||||
"Passwords does not match",
|
// "Passwords does not match",
|
||||||
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
// icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
||||||
snackPosition: SnackPosition.TOP,
|
// snackPosition: SnackPosition.TOP,
|
||||||
duration: Duration(milliseconds: 800),
|
// duration: Duration(milliseconds: 800),
|
||||||
backgroundColor: Colors.yellow,
|
// backgroundColor: Colors.yellow,
|
||||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
// //icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
if(emailController.text.isEmpty || passwordController.text.isEmpty){
|
// if(emailController.text.isEmpty || passwordController.text.isEmpty){
|
||||||
Get.snackbar(
|
// Get.snackbar(
|
||||||
"No values",
|
// "No values",
|
||||||
"Email and password required",
|
// "Email and password required",
|
||||||
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
// icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
||||||
snackPosition: SnackPosition.TOP,
|
// snackPosition: SnackPosition.TOP,
|
||||||
duration: Duration(milliseconds: 800),
|
// duration: Duration(milliseconds: 800),
|
||||||
backgroundColor: Colors.yellow,
|
// backgroundColor: Colors.yellow,
|
||||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
// //icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||||
);
|
// );
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
indexController.is_loading.value = true;
|
// indexController.is_loading.value = true;
|
||||||
indexController.register(emailController.text, passwordController.text, context);
|
// indexController.register(emailController.text, passwordController.text, context);
|
||||||
},
|
// },
|
||||||
color: Colors.redAccent,
|
// color: Colors.redAccent,
|
||||||
shape: RoundedRectangleBorder(
|
// shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(40)
|
// borderRadius: BorderRadius.circular(40)
|
||||||
),
|
// ),
|
||||||
child: Text("サインアップ",style: TextStyle(
|
// child: Text("サインアップ",style: TextStyle(
|
||||||
fontWeight: FontWeight.w600,fontSize: 16,
|
// fontWeight: FontWeight.w600,fontSize: 16,
|
||||||
|
|
||||||
),),
|
// ),),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
SizedBox(height: 20,),
|
// SizedBox(height: 20,),
|
||||||
Row(
|
// Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
// mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
// children: [
|
||||||
Flexible(child: Text("すでにアカウントをお持ちですか?")),
|
// Flexible(child: Text("すでにアカウントをお持ちですか?")),
|
||||||
TextButton(
|
// TextButton(
|
||||||
onPressed: (){
|
// onPressed: (){
|
||||||
Get.toNamed(AppPages.LOGIN);
|
// Get.toNamed(AppPages.LOGIN);
|
||||||
},
|
// },
|
||||||
child: Text("ログイン",style: TextStyle(
|
// child: Text("ログイン",style: TextStyle(
|
||||||
fontWeight: FontWeight.w600,
|
// fontWeight: FontWeight.w600,
|
||||||
fontSize: 18
|
// fontSize: 18
|
||||||
),),
|
// ),),
|
||||||
),
|
// ),
|
||||||
],
|
// ],
|
||||||
)
|
// )
|
||||||
],
|
// ],
|
||||||
|
|
||||||
),
|
// ),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
Widget makeInput({label, required TextEditingController controller, obsureText = false}){
|
// Widget makeInput({label, required TextEditingController controller, obsureText = false}){
|
||||||
return Column(
|
// return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
// children: [
|
||||||
Text(label,style:TextStyle(
|
// Text(label,style:TextStyle(
|
||||||
fontSize: 15,
|
// fontSize: 15,
|
||||||
fontWeight: FontWeight.w400,
|
// fontWeight: FontWeight.w400,
|
||||||
color: Colors.black87
|
// color: Colors.black87
|
||||||
),),
|
// ),),
|
||||||
SizedBox(height: 5,),
|
// SizedBox(height: 5,),
|
||||||
TextField(
|
// TextField(
|
||||||
controller: controller,
|
// controller: controller,
|
||||||
obscureText: obsureText,
|
// obscureText: obsureText,
|
||||||
decoration: InputDecoration(
|
// decoration: InputDecoration(
|
||||||
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
|
// contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
|
||||||
enabledBorder: OutlineInputBorder(
|
// enabledBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
// borderSide: BorderSide(
|
||||||
color: (Colors.grey[400])!,
|
// color: (Colors.grey[400])!,
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
border: OutlineInputBorder(
|
// border: OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: (Colors.grey[400])!
|
// borderSide: BorderSide(color: (Colors.grey[400])!
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
SizedBox(height: 30,)
|
// 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:get/get.dart';
|
||||||
import 'package:rogapp/pages/search/search_controller.dart';
|
// import 'package:rogapp/pages/search/search_controller.dart';
|
||||||
|
|
||||||
class SearchBinding extends Bindings {
|
// class SearchBinding extends Bindings {
|
||||||
@override
|
// @override
|
||||||
void dependencies() {
|
// void dependencies() {
|
||||||
Get.put<SearchController>(SearchController());
|
// Get.put<SearchController>(SearchController());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|||||||
@ -1,26 +1,26 @@
|
|||||||
import 'package:flutter/material.dart';
|
// import 'package:flutter/material.dart';
|
||||||
import 'package:geojson/geojson.dart';
|
// import 'package:geojson/geojson.dart';
|
||||||
import 'package:get/get.dart';
|
// import 'package:get/get.dart';
|
||||||
import 'package:get/get_state_manager/get_state_manager.dart';
|
// import 'package:get/get_state_manager/get_state_manager.dart';
|
||||||
import 'package:rogapp/model/destination.dart';
|
// import 'package:rogapp/model/destination.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.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
|
// @override
|
||||||
void onInit() {
|
// void onInit() {
|
||||||
IndexController indexController = Get.find<IndexController>();
|
// IndexController indexController = Get.find<IndexController>();
|
||||||
if(indexController.locations.isNotEmpty){
|
// if(indexController.locations.isNotEmpty){
|
||||||
for(int i=0; i<= indexController.locations[0].collection.length - 1; i++){
|
// for(int i=0; i<= indexController.locations[0].collection.length - 1; i++){
|
||||||
GeoJsonFeature p = indexController.locations[0].collection[i];
|
// GeoJsonFeature p = indexController.locations[0].collection[i];
|
||||||
searchResults.add(p);
|
// searchResults.add(p);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
super.onInit();
|
// super.onInit();
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
// }
|
||||||
@ -1,97 +1,96 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
// import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
// import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_typeahead/flutter_typeahead.dart';
|
// import 'package:flutter_typeahead/flutter_typeahead.dart';
|
||||||
import 'package:geojson/geojson.dart';
|
// import 'package:get/get.dart';
|
||||||
import 'package:get/get.dart';
|
// import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
// import 'package:rogapp/pages/search/search_controller.dart';
|
||||||
import 'package:rogapp/pages/search/search_controller.dart';
|
// import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
|
||||||
|
|
||||||
class SearchPage extends StatelessWidget {
|
// class SearchPage extends StatelessWidget {
|
||||||
SearchPage({Key? key}) : super(key: key);
|
// SearchPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
SearchController searchController = Get.find<SearchController>();
|
// SearchController searchController = Get.find<SearchController>();
|
||||||
IndexController indexController = Get.find<IndexController>();
|
// IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
Image getImage(int index){
|
// Image getImage(int index){
|
||||||
if(searchController.searchResults[index].properties!["photos"] == null || searchController.searchResults[index].properties!["photos"] == ""){
|
// if(searchController.searchResults[index].properties!["photos"] == null || searchController.searchResults[index].properties!["photos"] == ""){
|
||||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
// return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||||
}
|
// }
|
||||||
else{
|
// else{
|
||||||
return Image(
|
// return Image(
|
||||||
image: NetworkImage(searchController.searchResults[index].properties!["photos"]),
|
// image: NetworkImage(searchController.searchResults[index].properties!["photos"]),
|
||||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
// errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||||
return Image.asset("assets/images/empty_image.png");
|
// return Image.asset("assets/images/empty_image.png");
|
||||||
},
|
// },
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
Widget build(BuildContext context) {
|
// Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
// return Scaffold(
|
||||||
appBar: AppBar(
|
// appBar: AppBar(
|
||||||
elevation: 0,
|
// elevation: 0,
|
||||||
backgroundColor: Colors.white,
|
// backgroundColor: Colors.white,
|
||||||
leading: IconButton(
|
// leading: IconButton(
|
||||||
onPressed:(){
|
// onPressed:(){
|
||||||
Navigator.pop(context);
|
// Navigator.pop(context);
|
||||||
},
|
// },
|
||||||
icon: const Icon(Icons.arrow_back_ios_new, color: Colors.black,)),
|
// icon: const Icon(Icons.arrow_back_ios_new, color: Colors.black,)),
|
||||||
title: TypeAheadField(
|
// title: TypeAheadField(
|
||||||
textFieldConfiguration: TextFieldConfiguration(
|
// textFieldConfiguration: TextFieldConfiguration(
|
||||||
autofocus: true,
|
// autofocus: true,
|
||||||
),
|
// ),
|
||||||
suggestionsCallback: (pattern) async{
|
// suggestionsCallback: (pattern) async{
|
||||||
return searchController.searchResults.where((GeoJsonFeature element) => element.properties!["location_name"].toString().contains(pattern));
|
// return searchController.searchResults.where((GeoJsonFeature element) => element.properties!["location_name"].toString().contains(pattern));
|
||||||
//return await
|
// //return await
|
||||||
},
|
// },
|
||||||
itemBuilder: (context, GeoJsonFeature suggestion){
|
// itemBuilder: (context, GeoJsonFeature suggestion){
|
||||||
return ListTile(
|
// return ListTile(
|
||||||
title: Text(suggestion.properties!["location_name"]),
|
// title: Text(suggestion.properties!["location_name"]),
|
||||||
subtitle: suggestion.properties!["category"] != null ? Text(suggestion.properties!["category"]) : Text(""),
|
// subtitle: suggestion.properties!["category"] != null ? Text(suggestion.properties!["category"]) : Text(""),
|
||||||
//leading: getImage(index),
|
// //leading: getImage(index),
|
||||||
);
|
// );
|
||||||
},
|
// },
|
||||||
onSuggestionSelected: (GeoJsonFeature suggestion){
|
// onSuggestionSelected: (GeoJsonFeature suggestion){
|
||||||
indexController.currentFeature.clear();
|
// indexController.currentFeature.clear();
|
||||||
indexController.currentFeature.add(suggestion);
|
// indexController.currentFeature.add(suggestion);
|
||||||
Get.back();
|
// Get.back();
|
||||||
showModalBottomSheet(
|
// showModalBottomSheet(
|
||||||
isScrollControlled: true,
|
// isScrollControlled: true,
|
||||||
context: context,
|
// context: context,
|
||||||
//builder: (context) => BottomSheetWidget(),
|
// //builder: (context) => BottomSheetWidget(),
|
||||||
builder:((context) => BottomSheetNew())
|
// builder:((context) => BottomSheetNew())
|
||||||
);
|
// );
|
||||||
},
|
// },
|
||||||
),
|
// ),
|
||||||
//title: const CupertinoSearchTextField(),
|
// //title: const CupertinoSearchTextField(),
|
||||||
|
|
||||||
),
|
// ),
|
||||||
//body:
|
// //body:
|
||||||
// Obx(() =>
|
// // Obx(() =>
|
||||||
// ListView.builder(
|
// // ListView.builder(
|
||||||
// itemCount: searchController.searchResults.length,
|
// // itemCount: searchController.searchResults.length,
|
||||||
// itemBuilder: (context, index){
|
// // itemBuilder: (context, index){
|
||||||
// return ListTile(
|
// // return ListTile(
|
||||||
// title: searchController.searchResults[index].properties!["location_name"] != null ? Text(searchController.searchResults[index].properties!["location_name"]) : Text(""),
|
// // 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(""),
|
// // subtitle: searchController.searchResults[index].properties!["category"] != null ? Text(searchController.searchResults[index].properties!["category"]) : Text(""),
|
||||||
// leading: getImage(index),
|
// // leading: getImage(index),
|
||||||
// onTap: (){
|
// // onTap: (){
|
||||||
// indexController.currentFeature.clear();
|
// // indexController.currentFeature.clear();
|
||||||
// indexController.currentFeature.add(searchController.searchResults[index]);
|
// // indexController.currentFeature.add(searchController.searchResults[index]);
|
||||||
// Get.back();
|
// // Get.back();
|
||||||
// showModalBottomSheet(
|
// // showModalBottomSheet(
|
||||||
// isScrollControlled: true,
|
// // isScrollControlled: true,
|
||||||
// context: context,
|
// // context: context,
|
||||||
// //builder: (context) => BottomSheetWidget(),
|
// // //builder: (context) => BottomSheetWidget(),
|
||||||
// builder:((context) => BottomSheetNew())
|
// // 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:get/get_navigation/src/routes/get_route.dart';
|
||||||
import 'package:rogapp/pages/category/category_page.dart';
|
import 'package:rogapp/pages/category/category_page.dart';
|
||||||
import 'package:rogapp/pages/city/city_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/landing/landing_page.dart';
|
||||||
import 'package:rogapp/pages/loading/loading_page.dart';
|
import 'package:rogapp/pages/loading/loading_page.dart';
|
||||||
import 'package:rogapp/pages/login/login_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/permission/permission.dart';
|
||||||
import 'package:rogapp/pages/register/register_page.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_binding.dart';
|
||||||
import 'package:rogapp/pages/search/search_page.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/pages/subperf/subperf_page.dart';
|
||||||
import 'package:rogapp/spa/spa_binding.dart';
|
import 'package:rogapp/spa/spa_binding.dart';
|
||||||
import 'package:rogapp/spa/spa_page.dart';
|
import 'package:rogapp/spa/spa_page.dart';
|
||||||
@ -30,92 +26,25 @@ class AppPages {
|
|||||||
// ignore: constant_identifier_names
|
// ignore: constant_identifier_names
|
||||||
static const SPA = Routes.SPA;
|
static const SPA = Routes.SPA;
|
||||||
static const LANDING = Routes.LANDING;
|
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 LOADING = Routes.LOADING;
|
||||||
static const DESTINATION_MAP = Routes.DESTINATION_MAP;
|
static const DESTINATION_MAP = Routes.DESTINATION_MAP;
|
||||||
static const HOME = Routes.HOME;
|
|
||||||
static const PERMISSION = Routes.PERMISSION;
|
static const PERMISSION = Routes.PERMISSION;
|
||||||
static const SEARCH = Routes.SEARCH;
|
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 CATEGORY = Routes.CATEOGORY;
|
||||||
|
static const SELECT = Routes.SELECT;
|
||||||
|
static const ROG = Routes.ROG;
|
||||||
|
|
||||||
static final routes = [
|
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(
|
GetPage(
|
||||||
name: Routes.SPA,
|
name: Routes.SPA,
|
||||||
page: () => const SpaPage(),
|
page: () => const SpaPage(),
|
||||||
binding: SpaBinding(),
|
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(
|
GetPage(
|
||||||
name: Routes.LOADING,
|
name: Routes.LOADING,
|
||||||
page: () => LoadingPage(),
|
page: () => LoadingPage(),
|
||||||
//binding: DestinationBinding(),
|
//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(
|
GetPage(
|
||||||
name: Routes.CITY,
|
name: Routes.CITY,
|
||||||
page: () => CityPage(),
|
page: () => CityPage(),
|
||||||
@ -123,6 +52,14 @@ class AppPages {
|
|||||||
GetPage(
|
GetPage(
|
||||||
name: Routes.CATEOGORY,
|
name: Routes.CATEOGORY,
|
||||||
page: () => CategoryPage(),
|
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 SUBPERF = '/subperf';
|
||||||
static const CITY = '/city';
|
static const CITY = '/city';
|
||||||
static const CATEOGORY = '/category';
|
static const CATEOGORY = '/category';
|
||||||
|
static const SELECT = '/select';
|
||||||
|
static const ROG = '/rog';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,103 +1,103 @@
|
|||||||
import 'dart:convert';
|
// import 'dart:convert';
|
||||||
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
|
// import 'package:flutter_polyline_points/flutter_polyline_points.dart';
|
||||||
//import 'package:google_maps_webservice/directions.dart';
|
// //import 'package:google_maps_webservice/directions.dart';
|
||||||
import 'package:http/http.dart' as http;
|
// import 'package:http/http.dart' as http;
|
||||||
import 'package:rogapp/model/destination.dart';
|
// import 'package:rogapp/model/destination.dart';
|
||||||
|
|
||||||
import '../utils/const.dart';
|
// import '../utils/const.dart';
|
||||||
|
|
||||||
|
|
||||||
class DestinationService{
|
// class DestinationService{
|
||||||
|
|
||||||
static Future<List<dynamic>> getDestinations(int user_id) async {
|
// static Future<List<dynamic>> getDestinations(int user_id) async {
|
||||||
List<dynamic> cats = [];
|
// List<dynamic> cats = [];
|
||||||
String server_url = ConstValues.currentServer();
|
// String server_url = ConstValues.currentServer();
|
||||||
String url = "${server_url}/api/destinations/?user_id=${user_id}";
|
// String url = "${server_url}/api/destinations/?user_id=${user_id}";
|
||||||
//String url = "http://localhost:8100/api/destinations/?user_id=${user_id}";
|
// //String url = "http://localhost:8100/api/destinations/?user_id=${user_id}";
|
||||||
final http.Response response = await http.get(
|
// final http.Response response = await http.get(
|
||||||
Uri.parse(url),
|
// Uri.parse(url),
|
||||||
headers: <String, String>{
|
// headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
// 'Content-Type': 'application/json; charset=UTF-8',
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
// if (response.statusCode == 200) {
|
||||||
cats = json.decode(utf8.decode(response.bodyBytes));
|
// cats = json.decode(utf8.decode(response.bodyBytes));
|
||||||
}
|
// }
|
||||||
return cats;
|
// return cats;
|
||||||
}
|
// }
|
||||||
|
|
||||||
static Future<Map<String, dynamic>> deleteDestination(int dest_id) async {
|
// static Future<Map<String, dynamic>> deleteDestination(int dest_id) async {
|
||||||
Map<String, dynamic> cats = {};
|
// Map<String, dynamic> cats = {};
|
||||||
String server_url = ConstValues.currentServer();
|
// String server_url = ConstValues.currentServer();
|
||||||
String url = "${server_url}/api/delete_destination/?dest_id=${dest_id}";
|
// String url = "${server_url}/api/delete_destination/?dest_id=${dest_id}";
|
||||||
//String url = "http://localhost:8100/api/delete_destination/?dest_id=${dest_id}";
|
// //String url = "http://localhost:8100/api/delete_destination/?dest_id=${dest_id}";
|
||||||
final http.Response response = await http.get(
|
// final http.Response response = await http.get(
|
||||||
Uri.parse(url),
|
// Uri.parse(url),
|
||||||
headers: <String, String>{
|
// headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
// 'Content-Type': 'application/json; charset=UTF-8',
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
// if (response.statusCode == 200) {
|
||||||
cats = json.decode(utf8.decode(response.bodyBytes));
|
// cats = json.decode(utf8.decode(response.bodyBytes));
|
||||||
}
|
// }
|
||||||
print("####### ---- ${cats}");
|
// print("####### ---- ${cats}");
|
||||||
return cats;
|
// return cats;
|
||||||
}
|
// }
|
||||||
|
|
||||||
static Future<int> updateOrder(int action_id, int order, String dir) async {
|
// static Future<int> updateOrder(int action_id, int order, String dir) async {
|
||||||
int cats = 0;
|
// int cats = 0;
|
||||||
String server_url = ConstValues.currentServer();
|
// String server_url = ConstValues.currentServer();
|
||||||
String url = "${server_url}/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
|
// String url = "${server_url}/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
|
||||||
print("---- url is ${url} -----");
|
// print("---- url is ${url} -----");
|
||||||
//String url = "http://localhost:8100/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
|
// //String url = "http://localhost:8100/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
|
||||||
final http.Response response = await http.get(
|
// final http.Response response = await http.get(
|
||||||
Uri.parse(url),
|
// Uri.parse(url),
|
||||||
headers: <String, String>{
|
// headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
// 'Content-Type': 'application/json; charset=UTF-8',
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
// if (response.statusCode == 200) {
|
||||||
cats = json.decode(utf8.decode(response.bodyBytes));
|
// cats = json.decode(utf8.decode(response.bodyBytes));
|
||||||
}
|
// }
|
||||||
return cats;
|
// return cats;
|
||||||
}
|
// }
|
||||||
|
|
||||||
static Future<List<PointLatLng>>? getDestinationLine(List<Destination> destinations) async{
|
// static Future<List<PointLatLng>>? getDestinationLine(List<Destination> destinations) async{
|
||||||
PolylinePoints polylinePoints = PolylinePoints();
|
// PolylinePoints polylinePoints = PolylinePoints();
|
||||||
|
|
||||||
if(destinations.length <= 0){
|
// if(destinations.length <= 0){
|
||||||
return [];
|
// return [];
|
||||||
}
|
// }
|
||||||
|
|
||||||
//print("##### @@@@@ ${destinations[0].lat}");
|
// //print("##### @@@@@ ${destinations[0].lat}");
|
||||||
PointLatLng origin = PointLatLng(destinations[0].lat!, destinations[0].lon!);
|
// PointLatLng origin = PointLatLng(destinations[0].lat!, destinations[0].lon!);
|
||||||
PointLatLng dest = PointLatLng(destinations[destinations.length -1].lat!, destinations[destinations.length -1].lon!);
|
// PointLatLng dest = PointLatLng(destinations[destinations.length -1].lat!, destinations[destinations.length -1].lon!);
|
||||||
|
|
||||||
|
|
||||||
List<PolylineWayPoint> wayPoints = [];
|
// List<PolylineWayPoint> wayPoints = [];
|
||||||
int i=0;
|
// int i=0;
|
||||||
for(dynamic d in destinations){
|
// for(dynamic d in destinations){
|
||||||
if(i == 0 || i == (destinations.length -1)){
|
// if(i == 0 || i == (destinations.length -1)){
|
||||||
i+=1;
|
// i+=1;
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
double la = d.lat;
|
// double la = d.lat;
|
||||||
double ln = d.lon;
|
// double ln = d.lon;
|
||||||
PolylineWayPoint pwp = PolylineWayPoint(location: "${la},${ln}", stopOver: true);
|
// PolylineWayPoint pwp = PolylineWayPoint(location: "${la},${ln}", stopOver: true);
|
||||||
//print("----- UUUUUU ${pwp}");
|
// //print("----- UUUUUU ${pwp}");
|
||||||
//PointLatLng wp = PointLatLng(d["Location"]["geometry"][0][1], d["Location"]["geometry"][0][0]);
|
// //PointLatLng wp = PointLatLng(d["Location"]["geometry"][0][1], d["Location"]["geometry"][0][0]);
|
||||||
wayPoints.add(pwp);
|
// wayPoints.add(pwp);
|
||||||
i+=1;
|
// 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", PointLatLng(35.389282, 136.498027), PointLatLng(36.285848, 137.575186));
|
||||||
PolylineResult result = await polylinePoints.getRouteBetweenCoordinates("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE", origin,dest, travelMode: TravelMode.driving, wayPoints: wayPoints);
|
// PolylineResult result = await polylinePoints.getRouteBetweenCoordinates("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE", origin,dest, travelMode: TravelMode.driving, wayPoints: wayPoints);
|
||||||
//print("#####@@@@@ ${result.points}");
|
// //print("#####@@@@@ ${result.points}");
|
||||||
return result.points;
|
// return result.points;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|||||||
@ -1,35 +1,35 @@
|
|||||||
import 'package:geojson/geojson.dart';
|
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
import '../utils/const.dart';
|
import '../utils/const.dart';
|
||||||
|
|
||||||
class LocationLineService{
|
class LocationLineService{
|
||||||
|
|
||||||
static Future<GeoJsonFeature?> loadLocationLines() async {
|
// static Future<GeoJsonFeature?> loadLocationLines() async {
|
||||||
final geo = GeoJson();
|
// final geo = GeoJson();
|
||||||
GeoJsonFeature? fs;
|
// GeoJsonFeature? fs;
|
||||||
String server_url = ConstValues.currentServer();
|
// String server_url = ConstValues.currentServer();
|
||||||
String url = '${server_url}/api/location_line/';
|
// String url = '${server_url}/api/location_line/';
|
||||||
//String url = 'http://localhost:8100/api/location_line/';
|
// //String url = 'http://localhost:8100/api/location_line/';
|
||||||
final response = await http.get(Uri.parse(url),
|
// final response = await http.get(Uri.parse(url),
|
||||||
headers: <String, String>{
|
// headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
// 'Content-Type': 'application/json; charset=UTF-8',
|
||||||
},
|
// },
|
||||||
);
|
// );
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
// if (response.statusCode == 200) {
|
||||||
|
|
||||||
geo.processedFeatures.listen((fst) {
|
// geo.processedFeatures.listen((fst) {
|
||||||
fs = fst;
|
// fs = fst;
|
||||||
});
|
// });
|
||||||
|
|
||||||
await geo.parse(response.body, verbose:true);
|
// await geo.parse(response.body, verbose:true);
|
||||||
|
|
||||||
return fs;
|
// return fs;
|
||||||
|
|
||||||
} else {
|
// } else {
|
||||||
throw Exception('Failed to create album.');
|
// throw Exception('Failed to create album.');
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,36 +1,35 @@
|
|||||||
import 'package:geojson/geojson.dart';
|
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
import '../utils/const.dart';
|
import '../utils/const.dart';
|
||||||
|
|
||||||
class LocationPolygonervice{
|
class LocationPolygonervice{
|
||||||
|
|
||||||
static Future<GeoJsonFeature?> loadLocationLines() async {
|
// static Future<GeoJsonFeature?> loadLocationLines() async {
|
||||||
final geo = GeoJson();
|
// final geo = GeoJson();
|
||||||
GeoJsonFeature? fs;
|
// GeoJsonFeature? fs;
|
||||||
|
|
||||||
String server_url = ConstValues.currentServer();
|
// String server_url = ConstValues.currentServer();
|
||||||
String url = '${server_url}/api/location_polygon/';
|
// String url = '${server_url}/api/location_polygon/';
|
||||||
//String url = 'http://localhost:8100/api/location_polygon/';
|
// //String url = 'http://localhost:8100/api/location_polygon/';
|
||||||
final response = await http.get(Uri.parse(url),
|
// final response = await http.get(Uri.parse(url),
|
||||||
headers: <String, String>{
|
// headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
// 'Content-Type': 'application/json; charset=UTF-8',
|
||||||
},
|
// },
|
||||||
);
|
// );
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
// if (response.statusCode == 200) {
|
||||||
|
|
||||||
geo.processedFeatures.listen((fst) {
|
// geo.processedFeatures.listen((fst) {
|
||||||
fs = fst;
|
// fs = fst;
|
||||||
});
|
// });
|
||||||
|
|
||||||
await geo.parse(response.body, verbose:true);
|
// await geo.parse(response.body, verbose:true);
|
||||||
|
|
||||||
return fs;
|
// return fs;
|
||||||
|
|
||||||
} else {
|
// } else {
|
||||||
throw Exception('Failed to create album.');
|
// throw Exception('Failed to create album.');
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,15 +1,20 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'package:geojson_vi/geojson_vi.dart';
|
||||||
import 'package:geojson/geojson.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:rogapp/model/location.dart';
|
||||||
import 'package:rogapp/utils/const.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 {
|
Future<List<Location>> loadLocations() async {
|
||||||
String server_url = ConstValues.currentServer();
|
List<Location> locs = [];
|
||||||
String url = '${server_url}/api/location/';
|
String serverUrl = ConstValues.currentServer();
|
||||||
//String url = 'http://localhost:8100/api/location/';
|
String url = '${serverUrl}/api/location/';
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
@ -17,25 +22,29 @@ class LocationService{
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
|
GeoJSONFeatureCollection coll = GeoJSONFeatureCollection.fromJSON(utf8.decode(response.bodyBytes));
|
||||||
return featuresFromGeoJson(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 url = "";
|
||||||
String server_url = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
if(cat.isNotEmpty){
|
if(cat.isNotEmpty){
|
||||||
url = '${server_url}/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
url = '${serverUrl}/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
||||||
//url = 'http://localhost:8100/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
url = '${server_url}/api/inperf/?perf=' + perfecture;
|
url = '${serverUrl}/api/inperf/?perf=' + perfecture;
|
||||||
//url = 'http://localhost:8100/api/inperf/?perf=' + perfecture;
|
|
||||||
}
|
}
|
||||||
//print("----- url ---- ${url} --- ${cat}");
|
//print("----- url ---- ${url} --- ${cat}");
|
||||||
//String url = 'http://localhost:8100/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
@ -43,25 +52,29 @@ class LocationService{
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
GeoJsonFeatureCollection cc = await featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
GeoJSONFeatureCollection coll = GeoJSONFeatureCollection.fromJSON(utf8.decode(response.bodyBytes));
|
||||||
//print(cc);
|
for(int i=0; i<coll.features.length; i++ ){
|
||||||
return cc; //featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
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 url = "";
|
||||||
String server_url = ConstValues.currentServer();
|
String server_url = ConstValues.currentServer();
|
||||||
if(cat.isNotEmpty){
|
if(cat.isNotEmpty){
|
||||||
url = '${server_url}/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
|
url = '${server_url}/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
|
||||||
//url = 'http://localhost:8100/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
print("------ loading location in sub----");
|
print("------ loading location in sub----");
|
||||||
url = '${server_url}/api/insubperf?subperf=' + subperfecture;
|
url = '${server_url}/api/insubperf?subperf=' + subperfecture;
|
||||||
//url = 'http://localhost:8100/api/insubperf?subperf=' + subperfecture;
|
|
||||||
}
|
}
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
@ -70,55 +83,52 @@ class LocationService{
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
GeoJsonFeatureCollection cc = await featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
GeoJSONFeatureCollection coll = GeoJSONFeatureCollection.fromJSON(utf8.decode(response.bodyBytes));
|
||||||
//print(cc);
|
for(int i=0; i<coll.features.length; i++ ){
|
||||||
return cc; //featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
GeoJSONFeature? gf = coll.features[i];
|
||||||
|
if(gf != null){
|
||||||
|
Location l = Location.fromGeoJSONFeture(gf);
|
||||||
|
locs.add(l);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return locs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<List<Location>> loadLocationsBound(double lat1, double lon1, double lat2, double lon2, double lat3, double lon3, double lat4, double lon4, String cat) async {
|
||||||
static Future<GeoJsonFeatureCollection?> loadLocationsBound(double lat1, double lon1, double lat2, double lon2, double lat3, double lon3, double lat4, double lon4, String cat) async {
|
List<Location> locs = [];
|
||||||
String url = "";
|
String url = "";
|
||||||
String server_url = ConstValues.currentServer();
|
String server_url = ConstValues.currentServer();
|
||||||
print("cat is ----- ${cat}");
|
//print("cat is ----- ${cat}");
|
||||||
if(cat.isNotEmpty){
|
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 = '${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{
|
else{
|
||||||
url = '${server_url}/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
url = '${server_url}/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
||||||
//url = 'http://localhost:8100/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
|
||||||
}
|
}
|
||||||
print("----url --- ${url}");
|
//print("----url --- ${url}");
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 500) {
|
|
||||||
return GeoJsonFeatureCollection(); //featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
GeoJsonFeatureCollection cc = await featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
GeoJSONFeatureCollection coll = GeoJSONFeatureCollection.fromJSON(utf8.decode(response.bodyBytes));
|
||||||
if(cc.collection.isEmpty){
|
for(int i=0; i<coll.features.length; i++ ){
|
||||||
return null;
|
GeoJSONFeature? gf = coll.features[i];
|
||||||
}
|
if(gf != null){
|
||||||
else{
|
Location l = Location.fromGeoJSONFeture(gf);
|
||||||
return cc;
|
locs.add(l);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return locs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<List<Location>> loadCustomLocations(String name, String cat) async {
|
||||||
static Future<GeoJsonFeatureCollection?> loadCustomLocations(String name, String cat) async {
|
List<Location> locs = [];
|
||||||
String url = "";
|
String url = "";
|
||||||
if(cat == "-all-"){
|
|
||||||
cat = "";
|
|
||||||
}
|
|
||||||
String server_url = ConstValues.currentServer();
|
String server_url = ConstValues.currentServer();
|
||||||
print("cat is ----- ${cat}");
|
print("cat is ----- ${cat}");
|
||||||
if(cat.isNotEmpty){
|
if(cat.isNotEmpty){
|
||||||
@ -136,23 +146,18 @@ class LocationService{
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 500) {
|
if (response.statusCode == 200) {
|
||||||
return GeoJsonFeatureCollection(); //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 (response.statusCode == 200) {
|
if(gf != null){
|
||||||
GeoJsonFeatureCollection cc = await featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
Location l = Location.fromGeoJSONFeture(gf);
|
||||||
if(cc.collection.isEmpty){
|
locs.add(l);
|
||||||
return null;
|
}
|
||||||
}
|
|
||||||
else{
|
|
||||||
return cc;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return locs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,47 +1,47 @@
|
|||||||
|
|
||||||
import 'dart:convert';
|
// import 'dart:convert';
|
||||||
import 'package:http/http.dart' as http;
|
// import 'package:http/http.dart' as http;
|
||||||
import 'package:rogapp/model/destination.dart';
|
// import 'package:rogapp/model/destination.dart';
|
||||||
|
|
||||||
|
|
||||||
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 locs = "";
|
||||||
String origin = "";
|
// String origin = "";
|
||||||
int i = 0;
|
// int i = 0;
|
||||||
for(Destination d in destinations){
|
// for(Destination d in destinations){
|
||||||
|
|
||||||
print("---- getting matrix for ${d} ------------");
|
// print("---- getting matrix for ${d} ------------");
|
||||||
|
|
||||||
if(i==0){
|
// if(i==0){
|
||||||
origin = "${d.lat}, ${d.lon}";
|
// origin = "${d.lat}, ${d.lon}";
|
||||||
}
|
// }
|
||||||
|
|
||||||
print("lat is ${d.lat}, long is ${d.lon}");
|
// print("lat is ${d.lat}, long is ${d.lon}");
|
||||||
locs += "${d.lat}, ${d.lon}|";
|
// locs += "${d.lat}, ${d.lon}|";
|
||||||
i++;
|
// i++;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//print(locs);
|
// //print(locs);
|
||||||
|
|
||||||
Map<String, dynamic> cats = {};
|
// Map<String, dynamic> cats = {};
|
||||||
String url = "https://maps.googleapis.com/maps/api/distancematrix/json?destinations=${locs}&origins=${origin}&key=AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE";
|
// String url = "https://maps.googleapis.com/maps/api/distancematrix/json?destinations=${locs}&origins=${origin}&key=AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE";
|
||||||
print(url);
|
// print(url);
|
||||||
final http.Response response = await http.get(
|
// final http.Response response = await http.get(
|
||||||
Uri.parse(url),
|
// Uri.parse(url),
|
||||||
headers: <String, String>{
|
// headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
// 'Content-Type': 'application/json; charset=UTF-8',
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
// if (response.statusCode == 200) {
|
||||||
cats = json.decode(utf8.decode(response.bodyBytes));
|
// cats = json.decode(utf8.decode(response.bodyBytes));
|
||||||
}
|
// }
|
||||||
return cats;
|
// 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 'dart:io';
|
||||||
import 'package:path_provider/path_provider.dart';
|
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:sqflite/sqflite.dart';
|
||||||
import 'package:path/path.dart';
|
import 'package:path/path.dart';
|
||||||
|
|
||||||
@ -22,44 +22,62 @@ class DatabaseHelper{
|
|||||||
return openDatabase(join(await getDatabasesPath(), 'rog.db',), version: 1, onCreate: _onCreate);
|
return openDatabase(join(await getDatabasesPath(), 'rog.db',), version: 1, onCreate: _onCreate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Future _onCreate(Database db, int version) async {
|
Future _onCreate(Database db, int version) async {
|
||||||
await db.execute('''
|
await db.execute('''
|
||||||
CREATE TABLE destination(
|
CREATE TABLE destination(
|
||||||
location_id INTEGER PRIMARY KEY,
|
location_id INTEGER PRIMARY KEY,
|
||||||
name TEXT,
|
location_name TEXT,
|
||||||
address TEXT,
|
|
||||||
phone TEXT,
|
|
||||||
email TEXT,
|
|
||||||
webcontents TEXT,
|
|
||||||
videos TEXT,
|
|
||||||
category TEXT,
|
category TEXT,
|
||||||
series INTEGER,
|
zip TEXT,
|
||||||
lat REAL,
|
address TEXT,
|
||||||
lon REAL,
|
prefecture TEXT,
|
||||||
list_order INTEGER,
|
area TEXT,
|
||||||
|
city TEXT,
|
||||||
|
latitude REAL,
|
||||||
|
longitude REAL,
|
||||||
photos TEXT,
|
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,
|
auto_checkin INTEGER,
|
||||||
selected INTEGER,
|
checkin_radius INTEGER,
|
||||||
checkedin 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;
|
Database db = await instance.database;
|
||||||
var dest = await db.query('destination');
|
var dest = await db.query('destination');
|
||||||
List<Destination> destList = dest.isNotEmpty ?
|
List<Location> destList = dest.isNotEmpty ?
|
||||||
dest.map((e) => Destination.fromMap(e)).toList() : [];
|
dest.map((e) => Location.fromMap(e)).toList() : [];
|
||||||
print("--------- ${destList}");
|
print("--------- ${destList}");
|
||||||
return 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;
|
Database db = await instance.database;
|
||||||
var dest = await db.query('destination', where: "lat = ${lat} and lon= ${lon}");
|
var dest = await db.query('destination', where: "lat = ${lat} and lon= ${lon}");
|
||||||
List<Destination> destList = dest.isNotEmpty
|
List<Location> destList = dest.isNotEmpty
|
||||||
? dest.map((e) => Destination.fromMap(e)).toList() : [];
|
? dest.map((e) => Location.fromMap(e)).toList() : [];
|
||||||
return destList;
|
return destList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +94,7 @@ class DatabaseHelper{
|
|||||||
return dest > 0 ? true : false;
|
return dest > 0 ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> insertDestination(Destination dest) async {
|
Future<int> insertDestination(Location dest) async {
|
||||||
Database db = await instance.database;
|
Database db = await instance.database;
|
||||||
int res = await db.insert(
|
int res = await db.insert(
|
||||||
'destination',
|
'destination',
|
||||||
@ -87,7 +105,7 @@ class DatabaseHelper{
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> updateAction(Destination destination, bool checkin)async {
|
Future<int> updateAction(Location destination, bool checkin)async {
|
||||||
Database db = await instance.database;
|
Database db = await instance.database;
|
||||||
int act = checkin == false ? 0 : 1;
|
int act = checkin == false ? 0 : 1;
|
||||||
Map<String, dynamic> row = {
|
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/material.dart';
|
||||||
import 'package:flutter_map/flutter_map.dart';
|
// import 'package:flutter_map/flutter_map.dart';
|
||||||
|
|
||||||
class BaseLayer extends StatelessWidget {
|
// class BaseLayer extends StatelessWidget {
|
||||||
const BaseLayer({Key? key}) : super(key: key);
|
// const BaseLayer({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
Widget build(BuildContext context) {
|
// Widget build(BuildContext context) {
|
||||||
return TileLayerWidget(
|
// return TileLayerWidget(
|
||||||
options: TileLayerOptions(
|
// options: TileLayerOptions(
|
||||||
backgroundColor: Colors.transparent,
|
// backgroundColor: Colors.transparent,
|
||||||
urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
// 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}',
|
// //urlTemplate: 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
|
||||||
subdomains: ['a', 'b', 'c'],
|
// subdomains: ['a', 'b', 'c'],
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// var Esri_WorldImagery = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
|
// // 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'
|
// // 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:geojson/geojson.dart';
|
||||||
import 'package:get/get_state_manager/get_state_manager.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:flutter/material.dart';
|
||||||
import 'package:geojson/geojson.dart';
|
// import 'package:geojson/geojson.dart';
|
||||||
import 'package:get/get.dart';
|
// import 'package:get/get.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
// import 'package:image_picker/image_picker.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
// import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
import 'package:rogapp/routes/app_pages.dart';
|
// import 'package:rogapp/routes/app_pages.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
// import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
class BottomSheetWidget extends StatelessWidget {
|
// class BottomSheetWidget extends StatelessWidget {
|
||||||
//const BottomSheetWidget({ Key? key }, GeoJsonFeature? pt) : super(key: key);
|
// //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){
|
// Image getImage(GeoJsonFeature? gf){
|
||||||
if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){
|
// if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){
|
||||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
// return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||||
}
|
// }
|
||||||
else{
|
// else{
|
||||||
return Image(image: NetworkImage(
|
// return Image(image: NetworkImage(
|
||||||
gf.properties!["photos"],
|
// gf.properties!["photos"],
|
||||||
),
|
// ),
|
||||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
// errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||||
return Image.asset("assets/images/empty_image.png");
|
// return Image.asset("assets/images/empty_image.png");
|
||||||
},
|
// },
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
void _launchURL(url) async {
|
// void _launchURL(url) async {
|
||||||
if (!await launch(url)) throw 'Could not launch $url';
|
// if (!await launch(url)) throw 'Could not launch $url';
|
||||||
}
|
// }
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
Widget build(BuildContext context) {
|
// Widget build(BuildContext context) {
|
||||||
return SingleChildScrollView(
|
// return SingleChildScrollView(
|
||||||
child: Column(
|
// child: Column(
|
||||||
children: [
|
// children: [
|
||||||
SizedBox(height: 5.0,),
|
// SizedBox(height: 5.0,),
|
||||||
Row(
|
// Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
// children: [
|
||||||
MaterialButton(
|
// MaterialButton(
|
||||||
onPressed: () {
|
// onPressed: () {
|
||||||
indexController.makePrevious(indexController.currentFeature[0]);
|
// indexController.makePrevious(indexController.currentFeature[0]);
|
||||||
},
|
// },
|
||||||
color: Colors.blue,
|
// color: Colors.blue,
|
||||||
textColor: Colors.white,
|
// textColor: Colors.white,
|
||||||
child: Icon(
|
// child: Icon(
|
||||||
Icons.arrow_back_ios,
|
// Icons.arrow_back_ios,
|
||||||
size: 14,
|
// size: 14,
|
||||||
),
|
// ),
|
||||||
padding: EdgeInsets.all(14),
|
// padding: EdgeInsets.all(14),
|
||||||
shape: CircleBorder(),
|
// shape: CircleBorder(),
|
||||||
),
|
// ),
|
||||||
Expanded(
|
// Expanded(
|
||||||
child: Container(
|
// child: Container(
|
||||||
alignment: Alignment.center,
|
// alignment: Alignment.center,
|
||||||
child: Obx(() =>
|
// child: Obx(() =>
|
||||||
Text(indexController.currentFeature[0].properties!["location_name"], style: TextStyle(
|
// Text(indexController.currentFeature[0].properties!["location_name"], style: TextStyle(
|
||||||
fontSize: 15.0,
|
// fontSize: 15.0,
|
||||||
fontWeight: FontWeight.bold,
|
// fontWeight: FontWeight.bold,
|
||||||
),
|
// ),
|
||||||
)
|
// )
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
MaterialButton(
|
// MaterialButton(
|
||||||
onPressed: () {
|
// onPressed: () {
|
||||||
indexController.makeNext(indexController.currentFeature[0]);
|
// indexController.makeNext(indexController.currentFeature[0]);
|
||||||
},
|
// },
|
||||||
color: Colors.blue,
|
// color: Colors.blue,
|
||||||
textColor: Colors.white,
|
// textColor: Colors.white,
|
||||||
child: Icon(
|
// child: Icon(
|
||||||
Icons.arrow_forward_ios,
|
// Icons.arrow_forward_ios,
|
||||||
size: 14,
|
// size: 14,
|
||||||
),
|
// ),
|
||||||
padding: EdgeInsets.all(14),
|
// padding: EdgeInsets.all(14),
|
||||||
shape: CircleBorder(),
|
// shape: CircleBorder(),
|
||||||
),
|
// ),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
Row(
|
// Row(
|
||||||
children: [
|
// children: [
|
||||||
Expanded(
|
// Expanded(
|
||||||
child: SizedBox(
|
// child: SizedBox(
|
||||||
height: 260.0,
|
// height: 260.0,
|
||||||
child: Obx(() => getImage(indexController.currentFeature[0])),
|
// child: Obx(() => getImage(indexController.currentFeature[0])),
|
||||||
)
|
// )
|
||||||
),
|
// ),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
Row(
|
// Row(
|
||||||
children: [
|
// children: [
|
||||||
Expanded(
|
// Expanded(
|
||||||
child: Padding(
|
// child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
// padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||||
child: Column(
|
// child: Column(
|
||||||
children: [
|
// children: [
|
||||||
indexController.currentFeature[0].properties!["address"] != null ?
|
// indexController.currentFeature[0].properties!["address"] != null ?
|
||||||
Row(
|
// Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
// mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
// children: [
|
||||||
Expanded(
|
// Expanded(
|
||||||
child: Container(
|
// child: Container(
|
||||||
alignment: Alignment.topRight,
|
// alignment: Alignment.topRight,
|
||||||
child: Text("address".tr, style: TextStyle(fontWeight: FontWeight.bold),)),
|
// child: Text("address".tr, style: TextStyle(fontWeight: FontWeight.bold),)),
|
||||||
),
|
// ),
|
||||||
SizedBox(width: 12.0,),
|
// SizedBox(width: 12.0,),
|
||||||
Expanded(
|
// Expanded(
|
||||||
child: Container(
|
// child: Container(
|
||||||
alignment: Alignment.topLeft,
|
// alignment: Alignment.topLeft,
|
||||||
child: Obx(() => Text(indexController.currentFeature[0].properties!["address"] ?? '',
|
// child: Obx(() => Text(indexController.currentFeature[0].properties!["address"] ?? '',
|
||||||
style: TextStyle(color: Colors.blue,),
|
// style: TextStyle(color: Colors.blue,),
|
||||||
softWrap: true,
|
// softWrap: true,
|
||||||
overflow: TextOverflow.ellipsis,)
|
// overflow: TextOverflow.ellipsis,)
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
)
|
// )
|
||||||
],
|
// ],
|
||||||
): Container(width: 0.0, height: 0,),
|
// ): Container(width: 0.0, height: 0,),
|
||||||
indexController.currentFeature[0].properties!["phone"] != null ?
|
// indexController.currentFeature[0].properties!["phone"] != null ?
|
||||||
Row(
|
// Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
// mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
// children: [
|
||||||
Expanded(child: Container(
|
// Expanded(child: Container(
|
||||||
alignment: Alignment.topRight,
|
// alignment: Alignment.topRight,
|
||||||
child: Text("telephone".tr, style: TextStyle(fontWeight: FontWeight.bold),))),
|
// child: Text("telephone".tr, style: TextStyle(fontWeight: FontWeight.bold),))),
|
||||||
SizedBox(width: 12.0,),
|
// SizedBox(width: 12.0,),
|
||||||
Expanded(
|
// Expanded(
|
||||||
child: Container(
|
// child: Container(
|
||||||
alignment: Alignment.topLeft,
|
// alignment: Alignment.topLeft,
|
||||||
child: Obx(() => Text(indexController.currentFeature[0].properties!["phone"] ?? '',
|
// child: Obx(() => Text(indexController.currentFeature[0].properties!["phone"] ?? '',
|
||||||
style: TextStyle(color: Colors.blue,),
|
// style: TextStyle(color: Colors.blue,),
|
||||||
overflow: TextOverflow.ellipsis,)
|
// overflow: TextOverflow.ellipsis,)
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
)
|
// )
|
||||||
],
|
// ],
|
||||||
): Container(width: 0, height: 0,),
|
// ): Container(width: 0, height: 0,),
|
||||||
indexController.currentFeature[0].properties!["email"] != null ?
|
// indexController.currentFeature[0].properties!["email"] != null ?
|
||||||
Row(
|
// Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
// mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
// children: [
|
||||||
Expanded(child: Container(
|
// Expanded(child: Container(
|
||||||
alignment: Alignment.topRight,
|
// alignment: Alignment.topRight,
|
||||||
child: Text("email".tr, style: TextStyle(fontWeight: FontWeight.bold),))),
|
// child: Text("email".tr, style: TextStyle(fontWeight: FontWeight.bold),))),
|
||||||
SizedBox(width: 12.0,),
|
// SizedBox(width: 12.0,),
|
||||||
Expanded(
|
// Expanded(
|
||||||
child: Container(
|
// child: Container(
|
||||||
alignment: Alignment.topLeft,
|
// alignment: Alignment.topLeft,
|
||||||
child: Obx(() => Text(indexController.currentFeature[0].properties!["email"] ?? '',
|
// child: Obx(() => Text(indexController.currentFeature[0].properties!["email"] ?? '',
|
||||||
style: TextStyle(color: Colors.blue,),
|
// style: TextStyle(color: Colors.blue,),
|
||||||
overflow: TextOverflow.ellipsis,)
|
// overflow: TextOverflow.ellipsis,)
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
)
|
// )
|
||||||
],
|
// ],
|
||||||
): Container(width: 0, height: 0,),
|
// ): Container(width: 0, height: 0,),
|
||||||
indexController.currentFeature[0].properties!["webcontents"] != null ?
|
// indexController.currentFeature[0].properties!["webcontents"] != null ?
|
||||||
Row(
|
// Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
// mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
// children: [
|
||||||
Expanded(child: Container(
|
// Expanded(child: Container(
|
||||||
alignment: Alignment.topRight,
|
// alignment: Alignment.topRight,
|
||||||
child: Text(
|
// child: Text(
|
||||||
"web".tr, style: TextStyle(fontWeight: FontWeight.bold)))),
|
// "web".tr, style: TextStyle(fontWeight: FontWeight.bold)))),
|
||||||
SizedBox(width: 12.0,),
|
// SizedBox(width: 12.0,),
|
||||||
Expanded(
|
// Expanded(
|
||||||
child: Container(
|
// child: Container(
|
||||||
alignment: Alignment.topLeft,
|
// alignment: Alignment.topLeft,
|
||||||
child: Obx(() => InkWell(
|
// child: Obx(() => InkWell(
|
||||||
onTap: (){
|
// onTap: (){
|
||||||
_launchURL(indexController.currentFeature[0].properties!["webcontents"]);
|
// _launchURL(indexController.currentFeature[0].properties!["webcontents"]);
|
||||||
},
|
// },
|
||||||
child: Text(indexController.currentFeature[0].properties!["webcontents"] ?? '',
|
// child: Text(indexController.currentFeature[0].properties!["webcontents"] ?? '',
|
||||||
style: TextStyle(color: Colors.blue,),
|
// style: TextStyle(color: Colors.blue,),
|
||||||
softWrap: false,
|
// softWrap: false,
|
||||||
overflow: TextOverflow.fade,),
|
// overflow: TextOverflow.fade,),
|
||||||
)),
|
// )),
|
||||||
),
|
// ),
|
||||||
)
|
// )
|
||||||
],
|
// ],
|
||||||
): Container(width: 0.0, height: 0.0,),
|
// ): Container(width: 0.0, height: 0.0,),
|
||||||
indexController.currentFeature[0].properties!["videos"] != null ?
|
// indexController.currentFeature[0].properties!["videos"] != null ?
|
||||||
Row(
|
// Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
// mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
// children: [
|
||||||
Expanded(child: Container(
|
// Expanded(child: Container(
|
||||||
alignment: Alignment.topRight,
|
// alignment: Alignment.topRight,
|
||||||
child: Text("video".tr, style: TextStyle(fontWeight: FontWeight.bold)))),
|
// child: Text("video".tr, style: TextStyle(fontWeight: FontWeight.bold)))),
|
||||||
SizedBox(width: 12.0,),
|
// SizedBox(width: 12.0,),
|
||||||
Expanded(
|
// Expanded(
|
||||||
child: Container(
|
// child: Container(
|
||||||
alignment: Alignment.topLeft,
|
// alignment: Alignment.topLeft,
|
||||||
child: Obx(() => Text(indexController.currentFeature[0].properties!["videos"] ?? '',
|
// child: Obx(() => Text(indexController.currentFeature[0].properties!["videos"] ?? '',
|
||||||
style: TextStyle(color: Colors.blue,),
|
// style: TextStyle(color: Colors.blue,),
|
||||||
overflow: TextOverflow.ellipsis,)
|
// overflow: TextOverflow.ellipsis,)
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
)
|
// )
|
||||||
],
|
// ],
|
||||||
): Container(width: 0.0, height: 0.0,),
|
// ): Container(width: 0.0, height: 0.0,),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
SizedBox(height: 20.0,),
|
// SizedBox(height: 20.0,),
|
||||||
Obx(() =>
|
// Obx(() =>
|
||||||
indexController.currentAction.isNotEmpty ?
|
// indexController.currentAction.isNotEmpty ?
|
||||||
Row(
|
// Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
// mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
// children: [
|
||||||
indexController.rog_mode.value == 0 ?
|
// indexController.rog_mode.value == 0 ?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Row(
|
// Row(
|
||||||
mainAxisSize: MainAxisSize.max,
|
// mainAxisSize: MainAxisSize.max,
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
// mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
// children: [
|
||||||
indexController.currentAction[0][0]["wanttogo"] == false ?
|
// indexController.currentAction[0][0]["wanttogo"] == false ?
|
||||||
ElevatedButton(
|
// ElevatedButton(
|
||||||
onPressed: (){
|
// onPressed: (){
|
||||||
if(indexController.currentAction.isNotEmpty){
|
// if(indexController.currentAction.isNotEmpty){
|
||||||
print(indexController.currentAction[0]);
|
// print(indexController.currentAction[0]);
|
||||||
indexController.currentAction[0][0]["wanttogo"] = true;
|
// indexController.currentAction[0][0]["wanttogo"] = true;
|
||||||
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
// Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
||||||
indexController.currentAction.clear();
|
// indexController.currentAction.clear();
|
||||||
print("---temp---${temp}");
|
// print("---temp---${temp}");
|
||||||
indexController.currentAction.add([temp]);
|
// indexController.currentAction.add([temp]);
|
||||||
}
|
// }
|
||||||
indexController.makeAction(context);
|
// indexController.makeAction(context);
|
||||||
},
|
// },
|
||||||
child: Text("want_to_go".tr)
|
// child: Text("want_to_go".tr)
|
||||||
) :
|
// ) :
|
||||||
ElevatedButton(
|
// ElevatedButton(
|
||||||
onPressed: (){
|
// onPressed: (){
|
||||||
if(indexController.currentAction.isNotEmpty){
|
// if(indexController.currentAction.isNotEmpty){
|
||||||
print(indexController.currentAction[0]);
|
// print(indexController.currentAction[0]);
|
||||||
indexController.currentAction[0][0]["wanttogo"] = false;
|
// indexController.currentAction[0][0]["wanttogo"] = false;
|
||||||
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
// Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
||||||
indexController.currentAction.clear();
|
// indexController.currentAction.clear();
|
||||||
print("---temp---${temp}");
|
// print("---temp---${temp}");
|
||||||
indexController.currentAction.add([temp]);
|
// indexController.currentAction.add([temp]);
|
||||||
}
|
// }
|
||||||
indexController.makeAction(context);
|
// indexController.makeAction(context);
|
||||||
},
|
// },
|
||||||
|
|
||||||
child: IconButton(
|
// child: IconButton(
|
||||||
icon: Icon(Icons.favorite, color: Colors.red, semanticLabel: "want_to_go".tr,), onPressed: () {
|
// icon: Icon(Icons.favorite, color: Colors.red, semanticLabel: "want_to_go".tr,), onPressed: () {
|
||||||
|
|
||||||
},
|
// },
|
||||||
|
|
||||||
)
|
// )
|
||||||
),
|
// ),
|
||||||
indexController.currentAction[0][0]["like"] == false ?
|
// indexController.currentAction[0][0]["like"] == false ?
|
||||||
ElevatedButton(
|
// ElevatedButton(
|
||||||
onPressed: (){
|
// onPressed: (){
|
||||||
if(indexController.currentAction.isNotEmpty){
|
// if(indexController.currentAction.isNotEmpty){
|
||||||
print(indexController.currentAction[0]);
|
// print(indexController.currentAction[0]);
|
||||||
indexController.currentAction[0][0]["like"] = true;
|
// indexController.currentAction[0][0]["like"] = true;
|
||||||
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
// Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
||||||
indexController.currentAction.clear();
|
// indexController.currentAction.clear();
|
||||||
print("---temp---${temp}");
|
// print("---temp---${temp}");
|
||||||
indexController.currentAction.add([temp]);
|
// indexController.currentAction.add([temp]);
|
||||||
}
|
// }
|
||||||
indexController.makeAction(context);
|
// indexController.makeAction(context);
|
||||||
},
|
// },
|
||||||
child: Text("like".tr)
|
// child: Text("like".tr)
|
||||||
) :
|
// ) :
|
||||||
ElevatedButton(
|
// ElevatedButton(
|
||||||
onPressed: (){
|
// onPressed: (){
|
||||||
if(indexController.currentAction.isNotEmpty){
|
// if(indexController.currentAction.isNotEmpty){
|
||||||
print(indexController.currentAction[0]);
|
// print(indexController.currentAction[0]);
|
||||||
indexController.currentAction[0][0]["like"] = false;
|
// indexController.currentAction[0][0]["like"] = false;
|
||||||
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
// Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
||||||
indexController.currentAction.clear();
|
// indexController.currentAction.clear();
|
||||||
print("---temp---${temp}");
|
// print("---temp---${temp}");
|
||||||
indexController.currentAction.add([temp]);
|
// indexController.currentAction.add([temp]);
|
||||||
}
|
// }
|
||||||
indexController.makeAction(context);
|
// indexController.makeAction(context);
|
||||||
},
|
// },
|
||||||
|
|
||||||
child: IconButton(
|
// child: IconButton(
|
||||||
icon: Icon(Icons.favorite, color: Colors.red, semanticLabel: "like".tr,), onPressed: () {
|
// icon: Icon(Icons.favorite, color: Colors.red, semanticLabel: "like".tr,), onPressed: () {
|
||||||
|
|
||||||
},
|
// },
|
||||||
|
|
||||||
)
|
// )
|
||||||
),
|
// ),
|
||||||
],
|
// ],
|
||||||
)
|
// )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
:
|
// :
|
||||||
Container(width: 0, height: 0,),
|
// Container(width: 0, height: 0,),
|
||||||
indexController.rog_mode.value == 1 ?
|
// indexController.rog_mode.value == 1 ?
|
||||||
indexController.currentAction[0][0]["checkin"] == false ?
|
// indexController.currentAction[0][0]["checkin"] == false ?
|
||||||
Column(
|
// Column(
|
||||||
children: [
|
// children: [
|
||||||
Row(
|
// Row(
|
||||||
mainAxisSize: MainAxisSize.max,
|
// mainAxisSize: MainAxisSize.max,
|
||||||
children: [
|
// children: [
|
||||||
ElevatedButton(
|
// ElevatedButton(
|
||||||
child: Text("Image"), onPressed: (){
|
// child: Text("Image"), onPressed: (){
|
||||||
final ImagePicker _picker = ImagePicker();
|
// final ImagePicker _picker = ImagePicker();
|
||||||
_picker.pickImage(source: ImageSource.camera).then((value){
|
// _picker.pickImage(source: ImageSource.camera).then((value){
|
||||||
print("----- image---- ${value!.path}");
|
// print("----- image---- ${value!.path}");
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
)
|
// )
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
ElevatedButton(
|
// ElevatedButton(
|
||||||
onPressed: (){
|
// onPressed: (){
|
||||||
if(indexController.currentAction.isNotEmpty){
|
// if(indexController.currentAction.isNotEmpty){
|
||||||
print(indexController.currentAction[0]);
|
// print(indexController.currentAction[0]);
|
||||||
indexController.currentAction[0][0]["checkin"] = true;
|
// indexController.currentAction[0][0]["checkin"] = true;
|
||||||
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
// Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
||||||
indexController.currentAction.clear();
|
// indexController.currentAction.clear();
|
||||||
print("---temp---${temp}");
|
// print("---temp---${temp}");
|
||||||
indexController.currentAction.add([temp]);
|
// indexController.currentAction.add([temp]);
|
||||||
}
|
// }
|
||||||
indexController.makeAction(context);
|
// indexController.makeAction(context);
|
||||||
},
|
// },
|
||||||
child: Text("checkin".tr)
|
// child: Text("checkin".tr)
|
||||||
)
|
// )
|
||||||
],
|
// ],
|
||||||
)
|
// )
|
||||||
:
|
// :
|
||||||
ElevatedButton(
|
// ElevatedButton(
|
||||||
onPressed: (){
|
// onPressed: (){
|
||||||
if(indexController.currentAction.isNotEmpty){
|
// if(indexController.currentAction.isNotEmpty){
|
||||||
print(indexController.currentAction[0]);
|
// print(indexController.currentAction[0]);
|
||||||
indexController.currentAction[0][0]["checkin"] = false;
|
// indexController.currentAction[0][0]["checkin"] = false;
|
||||||
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
// Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
||||||
indexController.currentAction.clear();
|
// indexController.currentAction.clear();
|
||||||
print("---temp---${temp}");
|
// print("---temp---${temp}");
|
||||||
indexController.currentAction.add([temp]);
|
// indexController.currentAction.add([temp]);
|
||||||
}
|
// }
|
||||||
indexController.makeAction(context);
|
// indexController.makeAction(context);
|
||||||
},
|
// },
|
||||||
|
|
||||||
child: Icon(
|
// child: Icon(
|
||||||
Icons.favorite, color: Colors.red)
|
// Icons.favorite, color: Colors.red)
|
||||||
|
|
||||||
,
|
// ,
|
||||||
):
|
// ):
|
||||||
Container(width: 0, height: 0,),
|
// Container(width: 0, height: 0,),
|
||||||
],
|
// ],
|
||||||
): Row(
|
// ): Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
// mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
// children: [
|
||||||
TextButton(
|
// TextButton(
|
||||||
onPressed: (){
|
// onPressed: (){
|
||||||
Get.toNamed(AppPages.LOGIN);
|
// Get.toNamed(AppPages.LOGIN);
|
||||||
},
|
// },
|
||||||
child: Flexible(child: Text("その他のオプションについてはログインしてください")))
|
// child: Flexible(child: Text("その他のオプションについてはログインしてください")))
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
Row(
|
// Row(
|
||||||
children: [
|
// children: [
|
||||||
SizedBox(height: 60.0,),
|
// SizedBox(height: 60.0,),
|
||||||
],
|
// ],
|
||||||
)
|
// )
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
@ -1,34 +1,34 @@
|
|||||||
import 'package:flutter/material.dart';
|
// import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_map/flutter_map.dart';
|
// import 'package:flutter_map/flutter_map.dart';
|
||||||
import 'package:get/get.dart';
|
// import 'package:get/get.dart';
|
||||||
import 'package:flutter_breadcrumb/flutter_breadcrumb.dart';
|
// import 'package:flutter_breadcrumb/flutter_breadcrumb.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
// import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
import 'package:rogapp/widgets/perfecture_widget.dart';
|
// import 'package:rogapp/widgets/perfecture_widget.dart';
|
||||||
|
|
||||||
class BreadCrumbWidget extends StatelessWidget {
|
// class BreadCrumbWidget extends StatelessWidget {
|
||||||
BreadCrumbWidget({Key? key, this.mapController}) : super(key: key);
|
// 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
|
// @override
|
||||||
Widget build(BuildContext context) {
|
// Widget build(BuildContext context) {
|
||||||
print("------ map controller is ${mapController}------------");
|
// print("------ map controller is ${mapController}------------");
|
||||||
return
|
// return
|
||||||
Obx(()=>
|
// Obx(()=>
|
||||||
indexController.perfectures.isNotEmpty && mapController != null ?
|
// indexController.perfectures.isNotEmpty && mapController != null ?
|
||||||
BreadCrumb.builder(
|
// BreadCrumb.builder(
|
||||||
itemCount: indexController.perfectures.length,
|
// itemCount: indexController.perfectures.length,
|
||||||
builder: (index){
|
// builder: (index){
|
||||||
return
|
// return
|
||||||
BreadCrumbItem(
|
// BreadCrumbItem(
|
||||||
content: PerfectureWidget(indexController: indexController, mapController: mapController!) //Text('Item$index')
|
// content: PerfectureWidget(indexController: indexController, mapController: mapController!) //Text('Item$index')
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
):
|
// ):
|
||||||
const Text("Empty")
|
// const Text("Empty")
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
@ -1,50 +1,50 @@
|
|||||||
import 'package:flutter/material.dart';
|
// import 'package:flutter/material.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
// import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
import 'package:rogapp/services/location_service.dart';
|
// import 'package:rogapp/services/location_service.dart';
|
||||||
|
|
||||||
class CatWidget extends StatefulWidget {
|
// class CatWidget extends StatefulWidget {
|
||||||
CatWidget({ Key? key, required this.indexController, }) : super(key: key);
|
// CatWidget({ Key? key, required this.indexController, }) : super(key: key);
|
||||||
|
|
||||||
IndexController indexController;
|
// IndexController indexController;
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
State<CatWidget> createState() => _CatWidgetState();
|
// State<CatWidget> createState() => _CatWidgetState();
|
||||||
}
|
// }
|
||||||
|
|
||||||
class _CatWidgetState extends State<CatWidget> {
|
// class _CatWidgetState extends State<CatWidget> {
|
||||||
String defaultValue = "---";
|
// String defaultValue = "---";
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
Widget build(BuildContext context) {
|
// Widget build(BuildContext context) {
|
||||||
return
|
// return
|
||||||
PopupMenuButton(
|
// PopupMenuButton(
|
||||||
onSelected: (value) {
|
// onSelected: (value) {
|
||||||
widget.indexController.currentCat.clear();
|
// widget.indexController.currentCat.clear();
|
||||||
widget.indexController.currentCat.add(value.toString());
|
// widget.indexController.currentCat.add(value.toString());
|
||||||
widget.indexController.refreshLocationForCat();
|
// widget.indexController.refreshLocationForCat();
|
||||||
setState(() {
|
// setState(() {
|
||||||
print(value);
|
// print(value);
|
||||||
//widget.indexController.is_loading.value = true;
|
// //widget.indexController.is_loading.value = true;
|
||||||
defaultValue = value.toString();
|
// defaultValue = value.toString();
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
itemBuilder: (BuildContext context){
|
// itemBuilder: (BuildContext context){
|
||||||
List<PopupMenuItem> itms = <PopupMenuItem>[];
|
// List<PopupMenuItem> itms = <PopupMenuItem>[];
|
||||||
for(dynamic d in widget.indexController.cats[0]){
|
// for(dynamic d in widget.indexController.cats[0]){
|
||||||
PopupMenuItem itm = PopupMenuItem(child: Text(d['category'].toString()), value: d['category'].toString());
|
// PopupMenuItem itm = PopupMenuItem(child: Text(d['category'].toString()), value: d['category'].toString());
|
||||||
itms.add(itm);
|
// itms.add(itm);
|
||||||
}
|
// }
|
||||||
return itms;
|
// return itms;
|
||||||
}
|
// }
|
||||||
|
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
// widget.indexController.cats.map((e) =>
|
// // widget.indexController.cats.map((e) =>
|
||||||
// PopupMenuItem(
|
// // PopupMenuItem(
|
||||||
// value: defaultValue,
|
// // value: defaultValue,
|
||||||
// child: Text(e[0]['category'].toString()),
|
// // child: Text(e[0]['category'].toString()),
|
||||||
// )
|
// // )
|
||||||
// ).toList(),
|
// // ).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:flutter/material.dart';
|
||||||
import 'package:geojson/geojson.dart';
|
// import 'package:geojson/geojson.dart';
|
||||||
import 'package:get/get.dart';
|
// import 'package:get/get.dart';
|
||||||
import 'package:rogapp/model/destination.dart';
|
// import 'package:rogapp/model/destination.dart';
|
||||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
// import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
// import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
// import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
// import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||||
import 'package:timeline_tile/timeline_tile.dart';
|
// import 'package:timeline_tile/timeline_tile.dart';
|
||||||
|
|
||||||
class DestinationWidget extends StatelessWidget {
|
// class DestinationWidget extends StatelessWidget {
|
||||||
DestinationWidget({ Key? key }) : super(key: key);
|
// 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){
|
// Image getImage(int index){
|
||||||
if(destinationController.destinations[index].photos== null || destinationController.destinations[index].photos == ""){
|
// if(destinationController.destinations[index].photos== null || destinationController.destinations[index].photos == ""){
|
||||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
// return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||||
}
|
// }
|
||||||
else{
|
// else{
|
||||||
print("------- image is ${destinationController.destinations[index].photos!}------");
|
// print("------- image is ${destinationController.destinations[index].photos!}------");
|
||||||
return Image(image: NetworkImage(
|
// return Image(image: NetworkImage(
|
||||||
destinationController.destinations[index].photos!),
|
// destinationController.destinations[index].photos!),
|
||||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
// errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||||
return Image.asset("assets/images/empty_image.png");
|
// return Image.asset("assets/images/empty_image.png");
|
||||||
},
|
// },
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
bool getSelection(int index){
|
// bool getSelection(int index){
|
||||||
bool ret = false;
|
// bool ret = false;
|
||||||
destinationController.destination_index_data.forEach((element) {
|
// destinationController.destination_index_data.forEach((element) {
|
||||||
if(index == element["index"]){
|
// if(index == element["index"]){
|
||||||
if(element["selected"] == true){
|
// if(element["selected"] == true){
|
||||||
ret = true;
|
// ret = true;
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
return ret;
|
// return ret;
|
||||||
}
|
// }
|
||||||
|
|
||||||
void doDelete() {
|
// void doDelete() {
|
||||||
destinationController.currentSelectedDestinations.forEach((element) {
|
// destinationController.currentSelectedDestinations.forEach((element) {
|
||||||
destinationController.deleteDestination(element);
|
// destinationController.deleteDestination(element);
|
||||||
});
|
// });
|
||||||
// destinationController.destination_index_data.forEach((element) {
|
// // destinationController.destination_index_data.forEach((element) {
|
||||||
// //print(element["index"]);
|
// // //print(element["index"]);
|
||||||
// destinationController.deleteDestination(element["index"]);
|
// // destinationController.deleteDestination(element["index"]);
|
||||||
// });
|
// // });
|
||||||
// destinationController.destination_index_data.clear();
|
// // destinationController.destination_index_data.clear();
|
||||||
}
|
// }
|
||||||
|
|
||||||
void moveUp() {
|
// void moveUp() {
|
||||||
destinationController.destination_index_data.forEach((element) {
|
// destinationController.destination_index_data.forEach((element) {
|
||||||
//print(element["index"]);
|
// //print(element["index"]);
|
||||||
//int action_id = destinationController.destinations[element["index"]]["id"] as int;
|
// //int action_id = destinationController.destinations[element["index"]]["id"] as int;
|
||||||
//destinationController.makeOrder(action_id, (element["index"] as int) - 1, "up");
|
// //destinationController.makeOrder(action_id, (element["index"] as int) - 1, "up");
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
void moveDown() {
|
// void moveDown() {
|
||||||
destinationController.destination_index_data.forEach((element) {
|
// destinationController.destination_index_data.forEach((element) {
|
||||||
//print(element["index"]);
|
// //print(element["index"]);
|
||||||
//int action_id = destinationController.destinations[element["index"]]["id"] as int;
|
// //int action_id = destinationController.destinations[element["index"]]["id"] as int;
|
||||||
//destinationController.makeOrder(action_id, (element["index"] as int) + 1, "up");
|
// //destinationController.makeOrder(action_id, (element["index"] as int) + 1, "up");
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
void interChange() {
|
// void interChange() {
|
||||||
// int first_index = -1;
|
// // int first_index = -1;
|
||||||
// destinationController.destination_index_data.forEach((element) {
|
// // destinationController.destination_index_data.forEach((element) {
|
||||||
// //print(element["index"]);
|
// // //print(element["index"]);
|
||||||
// int action_id = destinationController.destinations[element["index"]]["id"] as int;
|
// // int action_id = destinationController.destinations[element["index"]]["id"] as int;
|
||||||
// destinationController.makeOrder(action_id, (element["index"] as int) + 1, "up");
|
// // destinationController.makeOrder(action_id, (element["index"] as int) + 1, "up");
|
||||||
|
|
||||||
// });
|
// // });
|
||||||
}
|
// }
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
Widget build(BuildContext context) {
|
// Widget build(BuildContext context) {
|
||||||
|
|
||||||
print("------ destination widget------ ${destinationController.destinationCount.value} ----------");
|
// print("------ destination widget------ ${destinationController.destinationCount.value} ----------");
|
||||||
|
|
||||||
return
|
// return
|
||||||
Obx(() =>
|
// Obx(() =>
|
||||||
Stack(
|
// Stack(
|
||||||
children: [
|
// children: [
|
||||||
Padding(
|
// Padding(
|
||||||
padding: const EdgeInsets.only(top:45.0),
|
// padding: const EdgeInsets.only(top:45.0),
|
||||||
child: ListView.builder(
|
// child: ListView.builder(
|
||||||
itemCount: destinationController.destinationCount.value,
|
// itemCount: destinationController.destinationCount.value,
|
||||||
|
|
||||||
itemBuilder: (BuildContext context, int index) {
|
// itemBuilder: (BuildContext context, int index) {
|
||||||
return
|
// return
|
||||||
TimelineTile(
|
// TimelineTile(
|
||||||
alignment: TimelineAlign.manual,
|
// alignment: TimelineAlign.manual,
|
||||||
lineXY: 0.2,
|
// lineXY: 0.2,
|
||||||
isFirst: index == 0 ? true : false,
|
// isFirst: index == 0 ? true : false,
|
||||||
indicatorStyle: IndicatorStyle(
|
// indicatorStyle: IndicatorStyle(
|
||||||
color: index == 0 ? (Colors.red) : (Colors.grey[400])!
|
// color: index == 0 ? (Colors.red) : (Colors.grey[400])!
|
||||||
),
|
// ),
|
||||||
key: Key(index.toString()),
|
// key: Key(index.toString()),
|
||||||
endChild: Card(
|
// endChild: Card(
|
||||||
child: Container(
|
// child: Container(
|
||||||
constraints: const BoxConstraints(
|
// constraints: const BoxConstraints(
|
||||||
minHeight: 80,
|
// minHeight: 80,
|
||||||
),
|
// ),
|
||||||
child: ListTile(
|
// child: ListTile(
|
||||||
onTap: () async {
|
// onTap: () async {
|
||||||
{
|
// {
|
||||||
Destination? fs = destinationController.destinations[index];
|
// Destination? fs = destinationController.destinations[index];
|
||||||
print("----fsf-----${fs}");
|
// print("----fsf-----${fs}");
|
||||||
if(fs != null){
|
// if(fs != null){
|
||||||
|
|
||||||
if(indexController.currentDestinationFeature.length > 0) {
|
// if(indexController.currentDestinationFeature.length > 0) {
|
||||||
indexController.currentDestinationFeature.clear();
|
// indexController.currentDestinationFeature.clear();
|
||||||
}
|
// }
|
||||||
indexController.currentDestinationFeature.add(fs);
|
// indexController.currentDestinationFeature.add(fs);
|
||||||
//indexController.getAction();
|
// //indexController.getAction();
|
||||||
|
|
||||||
showModalBottomSheet(context: context, isScrollControlled: true,
|
// showModalBottomSheet(context: context, isScrollControlled: true,
|
||||||
//builder:((context) => BottomSheetWidget())
|
// //builder:((context) => BottomSheetWidget())
|
||||||
builder:((context) => BottomSheetNew())
|
// builder:((context) => BottomSheetNew())
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
},
|
// },
|
||||||
onLongPress: (){
|
// onLongPress: (){
|
||||||
|
|
||||||
Destination? match_element = null;
|
// Destination? match_element = null;
|
||||||
destinationController.currentSelectedDestinations.forEach((element) {
|
// destinationController.currentSelectedDestinations.forEach((element) {
|
||||||
if(element.location_id == destinationController.destinations[index].location_id){
|
// if(element.location_id == destinationController.destinations[index].location_id){
|
||||||
match_element = element;
|
// match_element = element;
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
if(match_element != null){
|
// if(match_element != null){
|
||||||
destinationController.currentSelectedDestinations.remove(destinationController.destinations[index]);
|
// 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,
|
// selectedTileColor: Colors.amberAccent,
|
||||||
selected:destinationController.destinations[index].selected!,
|
// selected:destinationController.destinations[index].selected!,
|
||||||
leading: getImage(index),
|
// leading: getImage(index),
|
||||||
title: Text(destinationController.destinations[index].name!),
|
// title: Text(destinationController.destinations[index].name!),
|
||||||
subtitle: Text(destinationController.destinations[index].category!),
|
// subtitle: Text(destinationController.destinations[index].category!),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
startChild:
|
// startChild:
|
||||||
destinationController.matrix["rows"][0]["elements"] != null ?
|
// destinationController.matrix["rows"][0]["elements"] != null ?
|
||||||
Column(
|
// Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: [
|
// children: [
|
||||||
//Text(destinationController.matrix["rows"][0]["elements"][index]["distance"]["text"].toString()),
|
// //Text(destinationController.matrix["rows"][0]["elements"][index]["distance"]["text"].toString()),
|
||||||
//Text(destinationController.matrix["rows"][0]["elements"][index]["duration"]["text"].toString())
|
// //Text(destinationController.matrix["rows"][0]["elements"][index]["duration"]["text"].toString())
|
||||||
],
|
// ],
|
||||||
):
|
// ):
|
||||||
Container()
|
// Container()
|
||||||
,
|
// ,
|
||||||
);
|
// );
|
||||||
|
|
||||||
}
|
// }
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
Container(
|
// Container(
|
||||||
decoration: BoxDecoration(
|
// decoration: BoxDecoration(
|
||||||
boxShadow: [
|
// boxShadow: [
|
||||||
BoxShadow(
|
// BoxShadow(
|
||||||
color: Colors.grey.withOpacity(0.3),
|
// color: Colors.grey.withOpacity(0.3),
|
||||||
spreadRadius: 5,
|
// spreadRadius: 5,
|
||||||
blurRadius: 3,
|
// blurRadius: 3,
|
||||||
offset: Offset(0, 7), // changes position of shadow
|
// offset: Offset(0, 7), // changes position of shadow
|
||||||
),
|
// ),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
height: 44.0,
|
// height: 44.0,
|
||||||
width: MediaQuery.of(context).size.width,
|
// width: MediaQuery.of(context).size.width,
|
||||||
child: Row(
|
// child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
// mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
// children: [
|
||||||
IconButton(
|
// IconButton(
|
||||||
icon:Icon(Icons.cancel),
|
// icon:Icon(Icons.cancel),
|
||||||
//onPressed: (){doDelete();},
|
// //onPressed: (){doDelete();},
|
||||||
onPressed: destinationController.currentSelectedDestinations.length > 0 ? doDelete : null,
|
// onPressed: destinationController.currentSelectedDestinations.length > 0 ? doDelete : null,
|
||||||
),
|
// ),
|
||||||
IconButton(
|
// IconButton(
|
||||||
icon:Icon(Icons.move_up),
|
// icon:Icon(Icons.move_up),
|
||||||
onPressed: destinationController.destination_index_data.length > 0 ? moveUp : null,
|
// onPressed: destinationController.destination_index_data.length > 0 ? moveUp : null,
|
||||||
),
|
// ),
|
||||||
IconButton(
|
// IconButton(
|
||||||
icon:Icon(Icons.move_down),
|
// icon:Icon(Icons.move_down),
|
||||||
onPressed: destinationController.destination_index_data.length > 0 ? moveDown : null,
|
// onPressed: destinationController.destination_index_data.length > 0 ? moveDown : null,
|
||||||
),
|
// ),
|
||||||
IconButton(
|
// IconButton(
|
||||||
icon:Icon(Icons.sync),
|
// icon:Icon(Icons.sync),
|
||||||
onPressed: destinationController.destination_index_data.length == 2 ? interChange : null,
|
// onPressed: destinationController.destination_index_data.length == 2 ? interChange : null,
|
||||||
),
|
// ),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
)
|
// )
|
||||||
],
|
// ],
|
||||||
)
|
// )
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
@ -1,45 +1,45 @@
|
|||||||
import 'package:flutter/material.dart';
|
// import 'package:flutter/material.dart';
|
||||||
import 'package:rogapp/pages/search/search_page.dart';
|
// import 'package:rogapp/pages/search/search_page.dart';
|
||||||
|
|
||||||
class FakeSearch extends StatelessWidget {
|
// class FakeSearch extends StatelessWidget {
|
||||||
const FakeSearch({
|
// const FakeSearch({
|
||||||
Key? key,
|
// Key? key,
|
||||||
}) : super(key: key);
|
// }) : super(key: key);
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
Widget build(BuildContext context) {
|
// Widget build(BuildContext context) {
|
||||||
return InkWell(
|
// return InkWell(
|
||||||
onTap: (){
|
// onTap: (){
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => SearchPage()));
|
// Navigator.push(context, MaterialPageRoute(builder: (context) => SearchPage()));
|
||||||
},
|
// },
|
||||||
child: Container(
|
// child: Container(
|
||||||
height: 35,
|
// height: 35,
|
||||||
decoration: BoxDecoration(
|
// decoration: BoxDecoration(
|
||||||
border: Border.all(color:Colors.blue, width: 1.4),
|
// border: Border.all(color:Colors.blue, width: 1.4),
|
||||||
borderRadius: BorderRadius.circular(25)
|
// borderRadius: BorderRadius.circular(25)
|
||||||
),
|
// ),
|
||||||
child: Row(
|
// child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
// children: [
|
||||||
const Padding(
|
// const Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 8.0),
|
// padding: EdgeInsets.symmetric(horizontal: 8.0),
|
||||||
child: Icon(Icons.search, color: Colors.grey,),
|
// child: Icon(Icons.search, color: Colors.grey,),
|
||||||
),
|
// ),
|
||||||
const Text("What are you looking for", style: TextStyle(fontSize: 16, color: Colors.grey),),
|
// const Text("What are you looking for", style: TextStyle(fontSize: 16, color: Colors.grey),),
|
||||||
Container(
|
// Container(
|
||||||
height: 32,
|
// height: 32,
|
||||||
width: 75,
|
// width: 75,
|
||||||
decoration: BoxDecoration(
|
// decoration: BoxDecoration(
|
||||||
color: Colors.blue,
|
// color: Colors.blue,
|
||||||
borderRadius: BorderRadius.circular(25),
|
// 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:flutter/material.dart';
|
||||||
import 'package:geojson/geojson.dart';
|
// import 'package:geojson/geojson.dart';
|
||||||
import 'package:get/get.dart';
|
// import 'package:get/get.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
// import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
// import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
// import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||||
|
|
||||||
class ListWidget extends StatelessWidget {
|
// class ListWidget extends StatelessWidget {
|
||||||
ListWidget({ Key? key }) : super(key: key);
|
// ListWidget({ Key? key }) : super(key: key);
|
||||||
|
|
||||||
final IndexController indexController = Get.find<IndexController>();
|
// final IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
Image getImage(int index){
|
// Image getImage(int index){
|
||||||
if(indexController.locations[0].collection[index].properties!["photos"] == null || indexController.locations[0].collection[index].properties!["photos"] == ""){
|
// if(indexController.locations[0].collection[index].properties!["photos"] == null || indexController.locations[0].collection[index].properties!["photos"] == ""){
|
||||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
// return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||||
}
|
// }
|
||||||
else{
|
// else{
|
||||||
return Image(
|
// return Image(
|
||||||
image: NetworkImage(indexController.locations[0].collection[index].properties!["photos"]),
|
// image: NetworkImage(indexController.locations[0].collection[index].properties!["photos"]),
|
||||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
// errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||||
return Image.asset("assets/images/empty_image.png");
|
// return Image.asset("assets/images/empty_image.png");
|
||||||
},
|
// },
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
void changeCurrentFeature(GeoJsonFeature fs){
|
// void changeCurrentFeature(GeoJsonFeature fs){
|
||||||
if(indexController.currentFeature.length > 0){
|
// if(indexController.currentFeature.length > 0){
|
||||||
indexController.currentFeature.clear();
|
// indexController.currentFeature.clear();
|
||||||
}
|
// }
|
||||||
indexController.currentFeature.add(fs);
|
// indexController.currentFeature.add(fs);
|
||||||
}
|
// }
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
Widget build(BuildContext context) {
|
// Widget build(BuildContext context) {
|
||||||
return Obx(() =>
|
// return Obx(() =>
|
||||||
indexController.locations.length > 0 ?
|
// indexController.locations.length > 0 ?
|
||||||
ListView.builder(
|
// ListView.builder(
|
||||||
itemCount: indexController.locations[0].collection.length,
|
// itemCount: indexController.locations[0].collection.length,
|
||||||
shrinkWrap: true,
|
// shrinkWrap: true,
|
||||||
itemBuilder: (_, index){
|
// itemBuilder: (_, index){
|
||||||
return Card(
|
// return Card(
|
||||||
child: ListTile(
|
// child: ListTile(
|
||||||
onTap: (){
|
// onTap: (){
|
||||||
GeoJsonFeature gf = indexController.locations[0].collection[index];
|
// GeoJsonFeature gf = indexController.locations[0].collection[index];
|
||||||
changeCurrentFeature(gf);
|
// changeCurrentFeature(gf);
|
||||||
showModalBottomSheet(
|
// showModalBottomSheet(
|
||||||
isScrollControlled: true,
|
// isScrollControlled: true,
|
||||||
context: context,
|
// context: context,
|
||||||
//builder: (context) => BottomSheetWidget(),
|
// //builder: (context) => BottomSheetWidget(),
|
||||||
builder:((context) => BottomSheetNew())
|
// builder:((context) => BottomSheetNew())
|
||||||
);
|
// );
|
||||||
},
|
// },
|
||||||
leading: getImage(index),
|
// leading: getImage(index),
|
||||||
title: indexController.locations[0].collection[index].properties!['location_name'] != null ? Text(indexController.locations[0].collection[index].properties!['location_name'].toString()) : Text(""),
|
// title: indexController.locations[0].collection[index].properties!['location_name'] != null ? Text(indexController.locations[0].collection[index].properties!['location_name'].toString()) : Text(""),
|
||||||
subtitle: indexController.locations[0].collection[index].properties!['category'] != null ? Text(indexController.locations[0].collection[index].properties!['category']) : Text(""),
|
// subtitle: indexController.locations[0].collection[index].properties!['category'] != null ? Text(indexController.locations[0].collection[index].properties!['category']) : Text(""),
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
},
|
// },
|
||||||
) : Container(width: 0, height: 0,),
|
// ) : Container(width: 0, height: 0,),
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
@ -1,202 +1,150 @@
|
|||||||
import 'dart:async';
|
// import 'dart:async';
|
||||||
import 'package:flutter/material.dart';
|
// import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_map/plugin_api.dart';
|
// import 'package:flutter_map/plugin_api.dart';
|
||||||
import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
|
// import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
|
||||||
import 'package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart';
|
// import 'package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart';2
|
||||||
import 'package:geojson/geojson.dart';
|
// import 'package:get/get.dart';
|
||||||
import 'package:get/get.dart';
|
// import 'package:get/get_state_manager/get_state_manager.dart';
|
||||||
import 'package:get/get_state_manager/get_state_manager.dart';
|
// import 'package:latlong2/latlong.dart';
|
||||||
import 'package:latlong2/latlong.dart';
|
// import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
// import 'package:rogapp/widgets/base_layer_widget.dart';
|
||||||
import 'package:rogapp/widgets/base_layer_widget.dart';
|
// import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
// import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
|
||||||
|
|
||||||
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
|
// @override
|
||||||
Widget build(BuildContext context) {
|
// 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();
|
// final PopupController _popupController = PopupController();
|
||||||
return Stack(
|
// return Stack(
|
||||||
children: [
|
// children: [
|
||||||
Obx(() =>
|
// Obx(() =>
|
||||||
indexController.is_loading == true ? Padding(
|
// indexController.is_loading == true ? Padding(
|
||||||
padding: const EdgeInsets.only(top: 60.0),
|
// padding: const EdgeInsets.only(top: 60.0),
|
||||||
child: CircularProgressIndicator(),
|
// child: CircularProgressIndicator(),
|
||||||
):
|
// ):
|
||||||
FlutterMap(
|
// FlutterMap(
|
||||||
//mapController: mapController,
|
// //mapController: mapController,
|
||||||
options: MapOptions(
|
// options: MapOptions(
|
||||||
onMapCreated: (c){
|
// onMapCreated: (c){
|
||||||
indexController.mapController = c;
|
// indexController.mapController = c;
|
||||||
|
|
||||||
indexController.mapController!.onReady.then((_) {
|
// indexController.mapController!.onReady.then((_) {
|
||||||
indexController.is_mapController_loaded.value = true;
|
// indexController.is_mapController_loaded.value = true;
|
||||||
subscription = indexController.mapController!.mapEventStream.listen((MapEvent mapEvent) {
|
// subscription = indexController.mapController!.mapEventStream.listen((MapEvent mapEvent) {
|
||||||
if (mapEvent is MapEventMoveStart) {
|
// if (mapEvent is MapEventMoveStart) {
|
||||||
//print(DateTime.now().toString() + ' [MapEventMoveStart] START');
|
// //print(DateTime.now().toString() + ' [MapEventMoveStart] START');
|
||||||
// do something
|
// // do something
|
||||||
}
|
// }
|
||||||
if (mapEvent is MapEventMoveEnd) {
|
// if (mapEvent is MapEventMoveEnd) {
|
||||||
//print(DateTime.now().toString() + ' [MapEventMoveStart] END');
|
// //print(DateTime.now().toString() + ' [MapEventMoveStart] END');
|
||||||
indexController.loadLocationsBound();
|
// indexController.loadLocationsBound();
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
|
|
||||||
},
|
// },
|
||||||
//center: LatLng(37.15319600454702, 139.58765950528198),
|
// //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)]),
|
// bounds: indexController.currentBound.length > 0 ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]),
|
||||||
zoom: 1,
|
// zoom: 1,
|
||||||
maxZoom: 24,
|
// maxZoom: 24,
|
||||||
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
|
// interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
|
||||||
plugins: [
|
// plugins: [
|
||||||
MarkerClusterPlugin(),
|
// MarkerClusterPlugin(),
|
||||||
],
|
// ],
|
||||||
|
|
||||||
onPositionChanged: (MapPosition pos, isvalue){
|
// onPositionChanged: (MapPosition pos, isvalue){
|
||||||
|
// },
|
||||||
// LatLng c1 = pos.center?? LatLng(0, 0);
|
// onTap: (_, __) =>
|
||||||
|
// _popupController
|
||||||
// Timer(Duration(milliseconds:800), () {
|
// .hideAllPopups(), // Hide popup when the map is tapped.
|
||||||
// print(pos.bounds!.center);
|
// ),
|
||||||
// print("Yeah, this line is printed after 3 second");
|
// children: [
|
||||||
// LatLng c2 = pos.center?? LatLng(0, 0);
|
// BaseLayer(),
|
||||||
// if(c1.latitude != 0 && c1.latitude == c2.latitude){
|
// LocationMarkerLayerWidget(),
|
||||||
// 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(),
|
|
||||||
|
|
||||||
indexController.locations.length > 0 ?
|
// indexController.locations.length > 0 ?
|
||||||
MarkerClusterLayerWidget(
|
// MarkerClusterLayerWidget(
|
||||||
options: MarkerClusterLayerOptions(
|
// options: MarkerClusterLayerOptions(
|
||||||
spiderfyCircleRadius: 0,
|
// spiderfyCircleRadius: 0,
|
||||||
spiderfySpiralDistanceMultiplier: 2,
|
// spiderfySpiralDistanceMultiplier: 2,
|
||||||
circleSpiralSwitchover: 12,
|
// circleSpiralSwitchover: 12,
|
||||||
maxClusterRadius: 0,
|
// maxClusterRadius: 0,
|
||||||
rotate: true,
|
// rotate: true,
|
||||||
onMarkerTap: (marker){
|
// onMarkerTap: (marker){
|
||||||
GeoJsonFeature? fs = indexController.getFeatureForLatLong(marker.point.latitude, marker.point.longitude);
|
// GeoJsonFeature? fs = indexController.getFeatureForLatLong(marker.point.latitude, marker.point.longitude);
|
||||||
//print("------- fs ${fs}------");
|
// //print("------- fs ${fs}------");
|
||||||
if(fs != null){
|
// if(fs != null){
|
||||||
indexController.currentFeature.clear();
|
// indexController.currentFeature.clear();
|
||||||
indexController.currentFeature.add(fs);
|
// indexController.currentFeature.add(fs);
|
||||||
//print("----- fs is ${fs.properties!['photos']}");
|
// //print("----- fs is ${fs.properties!['photos']}");
|
||||||
indexController.getAction();
|
// indexController.getAction();
|
||||||
|
|
||||||
showModalBottomSheet(
|
// showModalBottomSheet(
|
||||||
context: context,
|
// context: context,
|
||||||
isScrollControlled: true,
|
// isScrollControlled: true,
|
||||||
isDismissible: true,
|
// isDismissible: true,
|
||||||
builder:((context) => BottomSheetNew())
|
// builder:((context) => BottomSheetNew())
|
||||||
//builder:((context) => BottomSheetWidget())
|
// //builder:((context) => BottomSheetWidget())
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
},
|
// },
|
||||||
|
|
||||||
size: Size(40, 40),
|
// size: Size(40, 40),
|
||||||
anchor: AnchorPos.align(AnchorAlign.center),
|
// anchor: AnchorPos.align(AnchorAlign.center),
|
||||||
fitBoundsOptions: const FitBoundsOptions(
|
// fitBoundsOptions: const FitBoundsOptions(
|
||||||
padding: EdgeInsets.all(50),
|
// padding: EdgeInsets.all(50),
|
||||||
maxZoom: 265,
|
// maxZoom: 265,
|
||||||
),
|
// ),
|
||||||
markers:indexController.locations[0].collection.map((i) {
|
// markers:indexController.locations[0].collection.map((i) {
|
||||||
print("i si ${i.properties!['location_id']}");
|
// print("i si ${i.properties!['location_id']}");
|
||||||
GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
|
// GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
|
||||||
print("lat is ${p.geoSerie!.geoPoints[0].latitude} and lon is ${p.geoSerie!.geoPoints[0].longitude}");
|
// print("lat is ${p.geoSerie!.geoPoints[0].latitude} and lon is ${p.geoSerie!.geoPoints[0].longitude}");
|
||||||
return Marker(
|
// return Marker(
|
||||||
anchorPos: AnchorPos.align(AnchorAlign.center),
|
// anchorPos: AnchorPos.align(AnchorAlign.center),
|
||||||
height: 22.0,
|
// height: 22.0,
|
||||||
width: 22.0,
|
// width: 22.0,
|
||||||
point: LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude),
|
// point: LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude),
|
||||||
builder: (ctx) => Icon(Icons.pin_drop),
|
// builder: (ctx) => Icon(Icons.pin_drop),
|
||||||
// builder: (ctx) => i.properties!["category"] != null ?
|
// // builder: (ctx) => i.properties!["category"] != null ?
|
||||||
// ImageIcon(
|
// // ImageIcon(
|
||||||
// AssetImage("assets/images/${i.properties!["category"]}.png"),
|
// // AssetImage("assets/images/${i.properties!["category"]}.png"),
|
||||||
// color: Color(0xFF3A5A98),
|
// // color: Color(0xFF3A5A98),
|
||||||
// size:12.0,
|
// // size:12.0,
|
||||||
// )
|
// // )
|
||||||
// : Icon(Icons.pin_drop),
|
// // : Icon(Icons.pin_drop),
|
||||||
|
|
||||||
);
|
// );
|
||||||
}).toList(),
|
// }).toList(),
|
||||||
builder: (context, markers) {
|
// builder: (context, markers) {
|
||||||
return Container(
|
// return Container(
|
||||||
decoration: BoxDecoration(
|
// decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(20.0),
|
// borderRadius: BorderRadius.circular(20.0),
|
||||||
color: Colors.blue),
|
// color: Colors.blue),
|
||||||
child: Center(
|
// child: Center(
|
||||||
child: Text(
|
// child: Text(
|
||||||
markers.length.toString(),
|
// markers.length.toString(),
|
||||||
style: TextStyle(color: Colors.white),
|
// style: TextStyle(color: Colors.white),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
},
|
// },
|
||||||
),
|
// ),
|
||||||
): Container(height:0,width: 0),
|
// ): Container(height:0,width: 0),
|
||||||
],
|
// ],
|
||||||
)
|
// )
|
||||||
)
|
// )
|
||||||
],
|
// ],
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
@ -1,265 +1,44 @@
|
|||||||
import 'package:flutter/material.dart';
|
// import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_map/flutter_map.dart';
|
// import 'package:flutter_map/flutter_map.dart';
|
||||||
import 'package:get/get.dart';
|
// import 'package:get/get.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
// import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
import 'package:rogapp/widgets/cat_widget.dart';
|
// import 'package:rogapp/widgets/cat_widget.dart';
|
||||||
|
|
||||||
|
|
||||||
class PerfectureWidget extends StatefulWidget {
|
// class PerfectureWidget extends StatefulWidget {
|
||||||
|
|
||||||
IndexController indexController;
|
// 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;
|
|
||||||
// MapController mapController;
|
// 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
|
// @override
|
||||||
// State<PerfectureWidget> createState() => _PerfectureWidgetState();
|
// State<PerfectureWidget> createState() => _PerfectureWidgetState();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// class _PerfectureWidgetState extends State<PerfectureWidget> {
|
// 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>> getDropdownItems() {
|
||||||
// List<DropdownMenuItem<String>> dropDownItems = [];
|
// 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());
|
// //print(currency["id"].toString());
|
||||||
// var newDropdown = DropdownMenuItem(
|
// var newDropdown = DropdownMenuItem(
|
||||||
// child: Text(currency["adm1_ja"].toString()),
|
// child: Text(currency["adm1_ja"].toString()),
|
||||||
@ -274,9 +53,9 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
|
|||||||
// List<DropdownMenuItem<String>> getSubDropdownItems() {
|
// List<DropdownMenuItem<String>> getSubDropdownItems() {
|
||||||
// List<DropdownMenuItem<String>> dropDownItems = [];
|
// 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(
|
// var newDropdown = DropdownMenuItem(
|
||||||
// child: Text(currency["adm2_ja"].toString()),
|
// child: Text(currency["adm2_ja"].toString()),
|
||||||
// value: currency["id"].toString(),
|
// value: currency["id"].toString(),
|
||||||
@ -288,13 +67,55 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
|
|||||||
// return dropDownItems;
|
// return dropDownItems;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// @override
|
// List<DropdownMenuItem<String>> getCustomArea(){
|
||||||
// void initState() {
|
// List<DropdownMenuItem<String>> dropDownItems = [];
|
||||||
// super.initState();
|
// if(widget.indexController.areas.isNotEmpty){
|
||||||
// widget.homeController.loadSubPerfFor("9");
|
|
||||||
// widget.homeController.zoomtoMainPerf("9", widget.mapController);
|
// 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
|
// @override
|
||||||
// Widget build(BuildContext context) {
|
// Widget build(BuildContext context) {
|
||||||
|
|
||||||
@ -302,7 +123,7 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
|
|||||||
// Row(
|
// Row(
|
||||||
// children: [
|
// children: [
|
||||||
// DropdownButton<String>(
|
// DropdownButton<String>(
|
||||||
// value: dropdownValue,
|
// value: widget.indexController.dropdownValue,
|
||||||
// icon: const Icon(Icons.arrow_downward),
|
// icon: const Icon(Icons.arrow_downward),
|
||||||
// elevation: 16,
|
// elevation: 16,
|
||||||
// style: const TextStyle(color: Colors.deepPurple),
|
// style: const TextStyle(color: Colors.deepPurple),
|
||||||
@ -313,45 +134,105 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
|
|||||||
// onChanged: (String? newValue) {
|
// onChanged: (String? newValue) {
|
||||||
// //setState(() {
|
// //setState(() {
|
||||||
// if(newValue != null){
|
// if(newValue != null){
|
||||||
// dropdownValue = newValue;
|
// widget.indexController.is_loading.value = true;
|
||||||
// widget.homeController.loadLocationforPerf(newValue, widget.mapController);
|
// widget.indexController.dropdownValue = newValue;
|
||||||
// widget.homeController.loadSubPerfFor(newValue);
|
// widget.indexController.populateForPerf(newValue, widget.mapController);
|
||||||
// //SubDropdownValue = widget.homeController.getSubInitialVal();
|
|
||||||
// //widget.mapController.fitBounds(widget.homeController.currentBound[0]);
|
|
||||||
// widget.homeController.zoomtoMainPerf(newValue, widget.mapController);
|
|
||||||
// }
|
// }
|
||||||
// //});
|
// //});
|
||||||
// },
|
// },
|
||||||
// items: getDropdownItems()
|
// items: getDropdownItems()
|
||||||
// ),
|
// ),
|
||||||
|
|
||||||
// widget.homeController.subPerfs.length > 0 ?
|
// // Gifu areas
|
||||||
|
// widget.indexController.areas.isNotEmpty ?
|
||||||
// DropdownButton<String>(
|
// 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),
|
// icon: const Icon(Icons.arrow_downward),
|
||||||
// elevation: 16,
|
// elevation: 16,
|
||||||
// style: const TextStyle(color: Colors.deepPurple),
|
// style: const TextStyle(color: Colors.deepPurple),
|
||||||
// hint: Container(
|
// hint: const Text("select"),
|
||||||
// child: Text("select"),
|
|
||||||
// ),
|
|
||||||
// underline: Container(
|
// underline: Container(
|
||||||
// height: 2,
|
// height: 2,
|
||||||
// color: Colors.deepPurpleAccent,
|
// color: Colors.deepPurpleAccent,
|
||||||
// ),
|
// ),
|
||||||
// onChanged: (String? newValue) {
|
// onChanged: (String? newValue) {
|
||||||
// //setState(() {
|
// setState(() {
|
||||||
// if(newValue != null){
|
// if(newValue != null){
|
||||||
// widget.homeController.loadLocationforSubPerf(newValue, widget.mapController);
|
// //widget.indexController.is_loading.value = true;
|
||||||
// widget.homeController.SubDropdownValue = newValue;
|
// //widget.indexController.populateForSubPerf(newValue, widget.mapController);
|
||||||
// widget.homeController.zoomtoSubPerf(newValue, widget.mapController);
|
// //widget.indexController.loadLocationforSubPerf(newValue, widget.mapController);
|
||||||
|
// widget.indexController.subDropdownValue = newValue;
|
||||||
|
// widget.indexController.loadCatForCity(newValue);
|
||||||
// }
|
// }
|
||||||
// //});
|
// });
|
||||||
// },
|
// },
|
||||||
// items:
|
// items:
|
||||||
// getSubDropdownItems()
|
// 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
|
name: async
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.8.2"
|
version: "2.9.0"
|
||||||
boolean_selector:
|
boolean_selector:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -28,21 +28,14 @@ packages:
|
|||||||
name: characters
|
name: characters
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0"
|
version: "1.2.1"
|
||||||
charcode:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: charcode
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.3.1"
|
|
||||||
clock:
|
clock:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: clock
|
name: clock
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0"
|
version: "1.1.1"
|
||||||
collection:
|
collection:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -71,20 +64,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.4"
|
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:
|
fake_async:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: fake_async
|
name: fake_async
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.0"
|
version: "1.3.1"
|
||||||
ffi:
|
ffi:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -152,35 +138,35 @@ packages:
|
|||||||
name: flutter_lints
|
name: flutter_lints
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.4"
|
version: "2.0.1"
|
||||||
flutter_map:
|
flutter_map:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: flutter_map
|
name: flutter_map
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.1"
|
version: "3.0.0"
|
||||||
flutter_map_location_marker:
|
flutter_map_location_marker:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: flutter_map_location_marker
|
name: flutter_map_location_marker
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.1.0"
|
version: "5.0.0+1"
|
||||||
flutter_map_marker_cluster:
|
flutter_map_marker_cluster:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: flutter_map_marker_cluster
|
name: flutter_map_marker_cluster
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.5.0"
|
version: "1.0.1"
|
||||||
flutter_map_marker_popup:
|
flutter_map_marker_popup:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: flutter_map_marker_popup
|
name: flutter_map_marker_popup
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.1"
|
version: "4.0.0"
|
||||||
flutter_plugin_android_lifecycle:
|
flutter_plugin_android_lifecycle:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -212,34 +198,27 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
geodesy:
|
geojson_vi:
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: geodesy
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "0.4.0-nullsafety.0"
|
|
||||||
geojson:
|
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: geojson
|
name: geojson_vi
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.0"
|
version: "2.0.7"
|
||||||
geolocator:
|
geolocator:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: geolocator
|
name: geolocator
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "8.2.1"
|
version: "9.0.2"
|
||||||
geolocator_android:
|
geolocator_android:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: geolocator_android
|
name: geolocator_android
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.2.1"
|
version: "4.1.4"
|
||||||
geolocator_apple:
|
geolocator_apple:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -268,13 +247,6 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.1"
|
version: "0.1.1"
|
||||||
geopoint:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: geopoint
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.0.0"
|
|
||||||
get:
|
get:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -373,13 +345,6 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.17.0"
|
version: "0.17.0"
|
||||||
iso:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: iso
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.0.0"
|
|
||||||
js:
|
js:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -400,7 +365,7 @@ packages:
|
|||||||
name: lints
|
name: lints
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.1"
|
version: "2.0.1"
|
||||||
lists:
|
lists:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -414,28 +379,28 @@ packages:
|
|||||||
name: matcher
|
name: matcher
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.11"
|
version: "0.12.12"
|
||||||
material_color_utilities:
|
material_color_utilities:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: material_color_utilities
|
name: material_color_utilities
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.4"
|
version: "0.1.5"
|
||||||
material_design_icons_flutter:
|
material_design_icons_flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: material_design_icons_flutter
|
name: material_design_icons_flutter
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.0.6595"
|
version: "6.0.7096"
|
||||||
meta:
|
meta:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: meta
|
name: meta
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.7.0"
|
version: "1.8.0"
|
||||||
mgrs_dart:
|
mgrs_dart:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -443,13 +408,20 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.0.0"
|
||||||
|
nested:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: nested
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
path:
|
path:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path
|
name: path
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.1"
|
version: "1.8.2"
|
||||||
path_provider:
|
path_provider:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -512,14 +484,35 @@ packages:
|
|||||||
name: permission_handler
|
name: permission_handler
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
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:
|
permission_handler_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: permission_handler_platform_interface
|
name: permission_handler_platform_interface
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
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:
|
platform:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -568,7 +561,14 @@ packages:
|
|||||||
name: proj4dart
|
name: proj4dart
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
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:
|
quiver:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -581,20 +581,20 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.99"
|
version: "0.0.99"
|
||||||
slugify:
|
sliding_up_panel:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: slugify
|
name: sliding_up_panel
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.0.0+1"
|
||||||
source_span:
|
source_span:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: source_span
|
name: source_span
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.2"
|
version: "1.9.0"
|
||||||
sqflite:
|
sqflite:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -636,7 +636,7 @@ packages:
|
|||||||
name: string_scanner
|
name: string_scanner
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0"
|
version: "1.1.1"
|
||||||
synchronized:
|
synchronized:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -650,14 +650,14 @@ packages:
|
|||||||
name: term_glyph
|
name: term_glyph
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0"
|
version: "1.2.1"
|
||||||
test_api:
|
test_api:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: test_api
|
name: test_api
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.4.9"
|
version: "0.4.12"
|
||||||
timeline_tile:
|
timeline_tile:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -778,5 +778,5 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.0+1"
|
version: "0.2.0+1"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.17.0 <3.0.0"
|
dart: ">=2.17.5 <3.0.0"
|
||||||
flutter: ">=3.0.0"
|
flutter: ">=3.3.0"
|
||||||
|
|||||||
16
pubspec.yaml
16
pubspec.yaml
@ -36,9 +36,9 @@ dependencies:
|
|||||||
cupertino_icons: ^1.0.2
|
cupertino_icons: ^1.0.2
|
||||||
sqflite: ^2.0.1
|
sqflite: ^2.0.1
|
||||||
get: ^4.6.5
|
get: ^4.6.5
|
||||||
flutter_map: any
|
flutter_map: ^3.0.0
|
||||||
geolocator: ^8.0.1
|
geolocator: ^9.0.1
|
||||||
permission_handler: ^8.3.0
|
permission_handler: ^10.0.0
|
||||||
google_api_availability: ^3.0.1
|
google_api_availability: ^3.0.1
|
||||||
tuple: ^2.0.0
|
tuple: ^2.0.0
|
||||||
latlong2: ^0.8.1
|
latlong2: ^0.8.1
|
||||||
@ -53,11 +53,11 @@ dependencies:
|
|||||||
path_provider: ^2.0.8
|
path_provider: ^2.0.8
|
||||||
flutter_map_location_marker: any
|
flutter_map_location_marker: any
|
||||||
flutter_map_marker_cluster: any
|
flutter_map_marker_cluster: any
|
||||||
material_design_icons_flutter: ^5.0.6595
|
material_design_icons_flutter: ^6.0.7096
|
||||||
google_fonts: any
|
google_fonts: any
|
||||||
image_picker: ^0.8.4+4
|
image_picker: ^0.8.4+4
|
||||||
#geojson_vi: ^2.0.7
|
geojson_vi: ^2.0.7
|
||||||
geojson: ^1.0.0
|
#geojson: ^1.0.0
|
||||||
url_launcher: ^6.0.20
|
url_launcher: ^6.0.20
|
||||||
flutter_breadcrumb: ^1.0.1
|
flutter_breadcrumb: ^1.0.1
|
||||||
timeline_tile: ^2.0.0
|
timeline_tile: ^2.0.0
|
||||||
@ -66,6 +66,8 @@ dependencies:
|
|||||||
flutter_polyline_points: ^1.0.0
|
flutter_polyline_points: ^1.0.0
|
||||||
google_maps_webservice: ^0.0.19
|
google_maps_webservice: ^0.0.19
|
||||||
flutter_typeahead: ^4.0.0
|
flutter_typeahead: ^4.0.0
|
||||||
|
sliding_up_panel: ^2.0.0+1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
@ -77,7 +79,7 @@ dev_dependencies:
|
|||||||
# activated in the `analysis_options.yaml` file located at the root of your
|
# activated in the `analysis_options.yaml` file located at the root of your
|
||||||
# package. See that file for information about deactivating specific lint
|
# package. See that file for information about deactivating specific lint
|
||||||
# rules and activating additional ones.
|
# 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
|
# For information on the generic Dart part of this file, see the
|
||||||
# following page: https://dart.dev/tools/pub/pubspec
|
# following page: https://dart.dev/tools/pub/pubspec
|
||||||
|
|||||||
@ -7,11 +7,14 @@
|
|||||||
#include "generated_plugin_registrant.h"
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
#include <geolocator_windows/geolocator_windows.h>
|
#include <geolocator_windows/geolocator_windows.h>
|
||||||
|
#include <permission_handler_windows/permission_handler_windows_plugin.h>
|
||||||
#include <url_launcher_windows/url_launcher_windows.h>
|
#include <url_launcher_windows/url_launcher_windows.h>
|
||||||
|
|
||||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||||
GeolocatorWindowsRegisterWithRegistrar(
|
GeolocatorWindowsRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("GeolocatorWindows"));
|
registry->GetRegistrarForPlugin("GeolocatorWindows"));
|
||||||
|
PermissionHandlerWindowsPluginRegisterWithRegistrar(
|
||||||
|
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
|
||||||
UrlLauncherWindowsRegisterWithRegistrar(
|
UrlLauncherWindowsRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
|
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
geolocator_windows
|
geolocator_windows
|
||||||
|
permission_handler_windows
|
||||||
url_launcher_windows
|
url_launcher_windows
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user