update for flutter_map

This commit is contained in:
Mohamed Nouffer
2022-12-13 18:19:16 +05:30
parent 244b7eb9ac
commit e9bf50fc14
51 changed files with 2701 additions and 4007 deletions

View File

@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion flutter.compileSdkVersion
compileSdkVersion 33
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8

View File

@ -3,9 +3,10 @@ import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:rogapp/pages/index/index_binding.dart';
import 'package:rogapp/pages/rog/rog_binding.dart';
import 'package:rogapp/routes/app_pages.dart';
import 'package:rogapp/services/location_service.dart';
import 'package:rogapp/utils/app_binding.dart';
import 'package:rogapp/utils/string_values.dart';
void main() {
@ -40,8 +41,8 @@ class MyApp extends StatelessWidget {
opaqueRoute: Get.isOpaqueRouteDefault,
popGesture: Get.isPopGestureEnable,
transitionDuration: const Duration(milliseconds: 230),
initialBinding: IndexBinding(), //HomeBinding(),
initialRoute: AppPages.PERMISSION,
initialBinding: RogBinding(), //HomeBinding(),
initialRoute: AppPages.ROG,
getPages: AppPages.routes,
enableLog: true,
);

View File

@ -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());
}
}

View File

@ -1,306 +0,0 @@
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.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/model/location.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<Location> destinations = <Location>[].obs;
List<Map<String, dynamic>> destination_index_data = <Map<String, dynamic>>[].obs;
List<Location> currentSelectedDestinations = <Location>[].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<Location?> 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){
if(lat == d.latitude && long == d.longitude){
return d;
}
}
}
checkForCheckin(double la, double ln){
for(final d in destinations){
if(!checking_in)
{
checking_in = true;
double lat = d.latitude!;
double lon = d.longitude!;
getDEstinationForLatLong(lat, lon).then((value){
var distance = Distance();
double dist = distance.as(LengthUnit.Meter, LatLng(lat, lon), LatLng(la, ln));
int rad = value!.checkin_radius! ?? 1000000;
bool auto_checkin = value.auto_checkin == 0 ? false : true;
indexController.currentDestinationFeature.add(value);
if(rad >= dist){
if(auto_checkin){
makeCheckin(value, true);
}
}
});
}
}
}
void makeCheckin(Location destination, bool action) async {
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${action}@@@@@@@@@@@");
DatabaseHelper db = DatabaseHelper.instance;
int res = await db.updateAction(destination, action);
List<Location> 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();
}
}
}
}
}

View File

@ -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()
)
),
);
}
}

View File

@ -1,284 +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: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()!
),
),
],
);
}
}

View File

@ -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());
}
}

View File

@ -1,7 +0,0 @@
import 'package:get/get.dart';
import 'package:get/get_state_manager/get_state_manager.dart';
class HomeController extends GetxController{
}

View File

@ -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(),
);
}
}

View File

@ -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());
}
}

View File

@ -1,514 +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:get/get.dart';
import 'package:latlong2/latlong.dart';
import 'package:rogapp/model/destination.dart';
import 'package:rogapp/model/location.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<Location> locations = <Location>[].obs;
List<Location> currentFeature = <Location>[].obs;
List<Location> currentDestinationFeature = <Location>[].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-";
LocationService locationService = Get.find<LocationService>();
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.length - 1; i++){
Location p = locations[i];
LatLng latLng = LatLng(p.latitude!, p.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(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 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();
}
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);
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.addAll(value);
});
}
void loadCustomLocation(String customarea) async {
String cat = currentCat.isNotEmpty == true ? currentCat[0] : "";
print("----- ${customarea}");
locationService.loadCustomLocations(customarea, cat).then((value){
locations.clear();
locations.addAll(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.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.isNotEmpty){
//print("---- added---");
locations.addAll(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;
}
Location? getFeatureForLatLong(double lat, double long){
if(locations.length > 0){
for(Location i in locations){
if(i.latitude == lat && i.longitude == long){
return i;
}
}
}
}
void makeNext(Location fs){
if(rog_mode == 1){
DestinationController destinationController = Get.find<DestinationController>();
print("---- destination index--- ${destinationController.destination_index_data} --------");
}
for(int i=0; i<= locations.length - 1; i++){
Location p = locations[i];
if(p.latitude == fs.latitude && p.longitude == fs.longitude ){
if(currentFeature.length > 0){
currentFeature.clear();
}
if(i >= locations.length - 1 ){
currentFeature.add(locations[0]);
}
else{
currentFeature.add(locations[i + 1]);
}
}
}
}
void makePrevious(Location fs){
if(rog_mode == 1){
DestinationController destinationController = Get.find<DestinationController>();
print("---- destination index--- ${destinationController.destination_index_data} --------");
}
for(int i=0; i<= locations.length - 1; i++){
Location p = locations[i];
if(p.latitude == fs.longitude && p.longitude == fs.longitude ){
if(currentFeature.length > 0){
currentFeature.clear();
}
if(i == 0 ){
currentFeature.add(locations[locations.length -1]);
}
else{
currentFeature.add(locations[i - 1]);
}
}
}
}
}

View File

@ -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(),
)
)
],
),
),
),
);
}
}

View File

@ -1,91 +1,91 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:rogapp/routes/app_pages.dart';
// import 'package:flutter/material.dart';
// import 'package:get/get.dart';
// import 'package:rogapp/routes/app_pages.dart';
class LandingPage extends StatefulWidget {
const LandingPage({ Key? key }) : super(key: key);
// class LandingPage extends StatefulWidget {
// const LandingPage({ Key? key }) : super(key: key);
@override
State<LandingPage> createState() => _LandingPageState();
}
// @override
// State<LandingPage> createState() => _LandingPageState();
// }
class _LandingPageState extends State<LandingPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Container(
width: double.infinity,
height: MediaQuery.of(context).size.height,
padding: EdgeInsets.symmetric(horizontal: 30,vertical: 30),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"こんにちは!",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 40),
),
SizedBox(height: 30,),
Text("ログインを有効にして本人確認を行うと、サーバーが改善されます",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.grey[700],
fontSize: 15
),
),
Container(
height: MediaQuery.of(context).size.height/3,
decoration: BoxDecoration(
image:DecorationImage(image: AssetImage('assets/gradient_japanese_temple.jpg'))
),
),
SizedBox(height: 20.0,),
MaterialButton(
minWidth: double.infinity,
height:60,
onPressed: (){
Get.toNamed(AppPages.LOGIN);
},
color: Colors.indigoAccent[400],
shape: RoundedRectangleBorder(
side: BorderSide(
color: Colors.black,
),
borderRadius: BorderRadius.circular(40)
),
child: Text("ログイン",style: TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
// class _LandingPageState extends State<LandingPage> {
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// body: SafeArea(
// child: Container(
// width: double.infinity,
// height: MediaQuery.of(context).size.height,
// padding: EdgeInsets.symmetric(horizontal: 30,vertical: 30),
// child: Column(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Column(
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Text(
// "こんにちは!",
// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 40),
// ),
// SizedBox(height: 30,),
// Text("ログインを有効にして本人確認を行うと、サーバーが改善されます",
// textAlign: TextAlign.center,
// style: TextStyle(
// color: Colors.grey[700],
// fontSize: 15
// ),
// ),
// Container(
// height: MediaQuery.of(context).size.height/3,
// decoration: BoxDecoration(
// image:DecorationImage(image: AssetImage('assets/gradient_japanese_temple.jpg'))
// ),
// ),
// SizedBox(height: 20.0,),
// MaterialButton(
// minWidth: double.infinity,
// height:60,
// onPressed: (){
// Get.toNamed(AppPages.LOGIN);
// },
// color: Colors.indigoAccent[400],
// shape: RoundedRectangleBorder(
// side: BorderSide(
// color: Colors.black,
// ),
// borderRadius: BorderRadius.circular(40)
// ),
// child: Text("ログイン",style: TextStyle(
// fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
),
),
),
SizedBox(height: 15.0,),
// ),
// ),
// ),
// SizedBox(height: 15.0,),
MaterialButton(
minWidth: double.infinity,
height:60,
onPressed: (){
Get.toNamed(AppPages.REGISTER);
},
color: Colors.redAccent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40)
),
child: Text("サインアップ",style: TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,
// MaterialButton(
// minWidth: double.infinity,
// height:60,
// onPressed: (){
// Get.toNamed(AppPages.REGISTER);
// },
// color: Colors.redAccent,
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(40)
// ),
// child: Text("サインアップ",style: TextStyle(
// fontWeight: FontWeight.w600,fontSize: 16,
),),
),
// ),),
// ),
],
)
],
),
),
),
);
}
}
// ],
// )
// ],
// ),
// ),
// ),
// );
// }
// }

View File

@ -1,178 +1,178 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/routes/app_pages.dart';
// import 'package:flutter/material.dart';
// import 'package:get/get.dart';
// //import 'package:rogapp/pages/index/index_controller.dart';
// import 'package:rogapp/routes/app_pages.dart';
class LoginPage extends StatelessWidget {
// class LoginPage extends StatelessWidget {
final IndexController indexController = Get.find<IndexController>();
// // final IndexController indexController = Get.find<IndexController>();
TextEditingController emailController = TextEditingController();
TextEditingController passwordController = TextEditingController();
// TextEditingController emailController = TextEditingController();
// TextEditingController passwordController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: Colors.white,
appBar: AppBar(
elevation: 0,
brightness: Brightness.light,
backgroundColor: Colors.white,
leading:
IconButton( onPressed: (){
Navigator.pop(context);
},icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
),
body: Container(
height: MediaQuery.of(context).size.height,
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Column(
children: [
Column(
children: [
Text ("ログイン", style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
),),
SizedBox(height: 20,),
Text("お帰りなさい !資格情報を使用してログインします",style: TextStyle(
fontSize: 15,
color: Colors.grey[700],
),),
SizedBox(height: 30,)
],
),
Padding(
padding: EdgeInsets.symmetric(
horizontal: 40
),
child: Column(
children: [
makeInput(label: "Eメール", controller: emailController),
makeInput(label: "パスワード", controller: passwordController, obsureText: true),
],
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 40),
child: Container(
padding: EdgeInsets.only(top: 3,left: 3),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
border: Border(
bottom: BorderSide(color: Colors.black),
top: BorderSide(color: Colors.black),
right: BorderSide(color: Colors.black),
left: BorderSide(color: Colors.black)
)
),
child: Obx((() =>
indexController.is_loading == true ? MaterialButton(
minWidth: double.infinity,
height:60,
onPressed: (){
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// resizeToAvoidBottomInset: false,
// backgroundColor: Colors.white,
// appBar: AppBar(
// elevation: 0,
// brightness: Brightness.light,
// backgroundColor: Colors.white,
// leading:
// IconButton( onPressed: (){
// Navigator.pop(context);
// },icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
// ),
// body: Container(
// height: MediaQuery.of(context).size.height,
// width: double.infinity,
// child: Column(
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// children: [
// Column(
// children: [
// Column(
// children: [
// Text ("ログイン", style: TextStyle(
// fontSize: 30,
// fontWeight: FontWeight.bold,
// ),),
// SizedBox(height: 20,),
// Text("お帰りなさい !資格情報を使用してログインします",style: TextStyle(
// fontSize: 15,
// color: Colors.grey[700],
// ),),
// SizedBox(height: 30,)
// ],
// ),
// Padding(
// padding: EdgeInsets.symmetric(
// horizontal: 40
// ),
// child: Column(
// children: [
// makeInput(label: "Eメール", controller: emailController),
// makeInput(label: "パスワード", controller: passwordController, obsureText: true),
// ],
// ),
// ),
// Padding(
// padding: EdgeInsets.symmetric(horizontal: 40),
// child: Container(
// padding: EdgeInsets.only(top: 3,left: 3),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(40),
// border: Border(
// bottom: BorderSide(color: Colors.black),
// top: BorderSide(color: Colors.black),
// right: BorderSide(color: Colors.black),
// left: BorderSide(color: Colors.black)
// )
// ),
// child: Obx((() =>
// indexController.is_loading == true ? MaterialButton(
// minWidth: double.infinity,
// height:60,
// onPressed: (){
},
color: Colors.grey[400],
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40)
),
child: CircularProgressIndicator(),
) :
MaterialButton(
minWidth: double.infinity,
height:60,
onPressed: (){
if(emailController.text.isEmpty || passwordController.text.isEmpty){
Get.snackbar(
"No values",
"Email and password required",
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
snackPosition: SnackPosition.TOP,
duration: Duration(milliseconds: 800),
backgroundColor: Colors.yellow,
//icon:Image(image:AssetImage("assets/images/dora.png"))
);
return;
}
indexController.is_loading.value = true;
indexController.login(emailController.text, passwordController.text, context);
},
color: Colors.indigoAccent[400],
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40)
),
child: Text("ログイン",style: TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
),
),
)
),
),
)
),
SizedBox(height: 20,),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Flexible(
child: Text("アカウントをお持ちではありませんか?", style: TextStyle(
overflow: TextOverflow.ellipsis,
),),
),
TextButton(
onPressed: (){
Get.toNamed(AppPages.REGISTER);
},
child: Text("サインアップ",style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 18
),),
),
],
)
],
// },
// color: Colors.grey[400],
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(40)
// ),
// child: CircularProgressIndicator(),
// ) :
// MaterialButton(
// minWidth: double.infinity,
// height:60,
// onPressed: (){
// if(emailController.text.isEmpty || passwordController.text.isEmpty){
// Get.snackbar(
// "No values",
// "Email and password required",
// icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
// snackPosition: SnackPosition.TOP,
// duration: Duration(milliseconds: 800),
// backgroundColor: Colors.yellow,
// //icon:Image(image:AssetImage("assets/images/dora.png"))
// );
// return;
// }
// indexController.is_loading.value = true;
// indexController.login(emailController.text, passwordController.text, context);
// },
// color: Colors.indigoAccent[400],
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(40)
// ),
// child: Text("ログイン",style: TextStyle(
// fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
// ),
// ),
// )
// ),
// ),
// )
// ),
// SizedBox(height: 20,),
// Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Flexible(
// child: Text("アカウントをお持ちではありませんか?", style: TextStyle(
// overflow: TextOverflow.ellipsis,
// ),),
// ),
// TextButton(
// onPressed: (){
// Get.toNamed(AppPages.REGISTER);
// },
// child: Text("サインアップ",style: TextStyle(
// fontWeight: FontWeight.w600,
// fontSize: 18
// ),),
// ),
// ],
// )
// ],
),
],
),
),
);
}
}
// ),
// ],
// ),
// ),
// );
// }
// }
Widget makeInput({label, required TextEditingController controller, obsureText = false}){
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(label,style:TextStyle(
fontSize: 15,
fontWeight: FontWeight.w400,
color: Colors.black87
),),
SizedBox(height: 5,),
TextField(
controller: controller,
obscureText: obsureText,
decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: (Colors.grey[400])!,
),
),
border: OutlineInputBorder(
borderSide: BorderSide(color: (Colors.grey[400])!
),
),
),
),
SizedBox(height: 30.0,)
],
);
}
// Widget makeInput({label, required TextEditingController controller, obsureText = false}){
// return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(label,style:TextStyle(
// fontSize: 15,
// fontWeight: FontWeight.w400,
// color: Colors.black87
// ),),
// SizedBox(height: 5,),
// TextField(
// controller: controller,
// obscureText: obsureText,
// decoration: InputDecoration(
// contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
// enabledBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: (Colors.grey[400])!,
// ),
// ),
// border: OutlineInputBorder(
// borderSide: BorderSide(color: (Colors.grey[400])!
// ),
// ),
// ),
// ),
// SizedBox(height: 30.0,)
// ],
// );
// }

View File

@ -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()),
);
},
),
);
}
}

View File

@ -1,79 +1,79 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:rogapp/routes/app_pages.dart';
// import 'package:flutter/material.dart';
// import 'package:get/get.dart';
// import 'package:permission_handler/permission_handler.dart';
// import 'package:rogapp/routes/app_pages.dart';
class PermissionHandlerScreen extends StatefulWidget {
PermissionHandlerScreen({Key? key}) : super(key: key);
// class PermissionHandlerScreen extends StatefulWidget {
// PermissionHandlerScreen({Key? key}) : super(key: key);
@override
State<PermissionHandlerScreen> createState() => _PermissionHandlerScreenState();
}
// @override
// State<PermissionHandlerScreen> createState() => _PermissionHandlerScreenState();
// }
class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
// class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
@override
void initState() {
// TODO: implement initState
super.initState();
permissionServiceCall();
}
// @override
// void initState() {
// // TODO: implement initState
// super.initState();
// permissionServiceCall();
// }
permissionServiceCall() async {
await permissionServices().then(
(value) {
if (value != null) {
if (value[Permission.location]!.isGranted ) {
/* ========= New Screen Added ============= */
// permissionServiceCall() async {
// await permissionServices().then(
// (value) {
// if (value != null) {
// if (value[Permission.location]!.isGranted ) {
// /* ========= New Screen Added ============= */
Get.toNamed(AppPages.TRAVEL);
// Get.toNamed(AppPages.TRAVEL);
// Navigator.pushReplacement(
// context,
// MaterialPageRoute(builder: (context) => SplashScreen()),
// );
}
}
},
);
}
// // Navigator.pushReplacement(
// // context,
// // MaterialPageRoute(builder: (context) => SplashScreen()),
// // );
// }
// }
// },
// );
// }
/*Permission services*/
Future<Map<Permission, PermissionStatus>> permissionServices() async {
// You can request multiple permissions at once.
Map<Permission, PermissionStatus> statuses = await [
Permission.location,
// /*Permission services*/
// Future<Map<Permission, PermissionStatus>> permissionServices() async {
// // You can request multiple permissions at once.
// Map<Permission, PermissionStatus> statuses = await [
// Permission.location,
//add more permission to request here.
].request();
// //add more permission to request here.
// ].request();
if (statuses[Permission.location]!.isPermanentlyDenied) {
await openAppSettings().then(
(value) async {
if (value) {
if (await Permission.location.status.isPermanentlyDenied == true &&
await Permission.location.status.isGranted == false) {
// openAppSettings();
permissionServiceCall(); /* opens app settings until permission is granted */
}
}
},
);
} else {
if (statuses[Permission.location]!.isDenied) {
permissionServiceCall();
}
}
// if (statuses[Permission.location]!.isPermanentlyDenied) {
// await openAppSettings().then(
// (value) async {
// if (value) {
// if (await Permission.location.status.isPermanentlyDenied == true &&
// await Permission.location.status.isGranted == false) {
// // openAppSettings();
// permissionServiceCall(); /* opens app settings until permission is granted */
// }
// }
// },
// );
// } else {
// if (statuses[Permission.location]!.isDenied) {
// permissionServiceCall();
// }
// }
/*{Permission.camera: PermissionStatus.granted, Permission.storage: PermissionStatus.granted}*/
return statuses;
}
// /*{Permission.camera: PermissionStatus.granted, Permission.storage: PermissionStatus.granted}*/
// return statuses;
// }
@override
Widget build(BuildContext context) {
return Container();
}
}
// @override
// Widget build(BuildContext context) {
// return Container();
// }
// }

View File

@ -1,179 +1,179 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/routes/app_pages.dart';
// import 'package:flutter/material.dart';
// import 'package:get/get.dart';
// import 'package:rogapp/pages/index/index_controller.dart';
// import 'package:rogapp/routes/app_pages.dart';
class RegisterPage extends StatelessWidget {
// class RegisterPage extends StatelessWidget {
final IndexController indexController = Get.find<IndexController>();
// final IndexController indexController = Get.find<IndexController>();
TextEditingController emailController = TextEditingController();
TextEditingController passwordController = TextEditingController();
TextEditingController confirmPasswordController = TextEditingController();
// TextEditingController emailController = TextEditingController();
// TextEditingController passwordController = TextEditingController();
// TextEditingController confirmPasswordController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: Colors.white,
appBar: AppBar(
elevation: 0,
brightness: Brightness.light,
backgroundColor: Colors.white,
leading:
IconButton( onPressed: (){
Navigator.pop(context);
},icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
),
body: SafeArea(
child: SingleChildScrollView(
child: Container(
height: MediaQuery.of(context).size.height,
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text ("サインアップ", style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
),),
SizedBox(height: 20,),
Text("アカウントを作成し、無料です",style: TextStyle(
fontSize: 15,
color: Colors.grey[700],
),),
SizedBox(height: 30,)
],
),
Padding(
padding: EdgeInsets.symmetric(
horizontal: 40
),
child: Column(
children: [
makeInput(label: "Eメール", controller: emailController),
makeInput(label: "パスワード", controller: passwordController,obsureText: true),
makeInput(label: "パスワードを認証する", controller: confirmPasswordController,obsureText: true)
],
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 40),
child: Container(
padding: EdgeInsets.only(top: 3,left: 3),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
border: Border(
bottom: BorderSide(color: Colors.black),
top: BorderSide(color: Colors.black),
right: BorderSide(color: Colors.black),
left: BorderSide(color: Colors.black)
)
),
child: MaterialButton(
minWidth: double.infinity,
height:60,
onPressed: (){
if(passwordController.text != confirmPasswordController.text){
Get.snackbar(
"No match",
"Passwords does not match",
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
snackPosition: SnackPosition.TOP,
duration: Duration(milliseconds: 800),
backgroundColor: Colors.yellow,
//icon:Image(image:AssetImage("assets/images/dora.png"))
);
}
if(emailController.text.isEmpty || passwordController.text.isEmpty){
Get.snackbar(
"No values",
"Email and password required",
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
snackPosition: SnackPosition.TOP,
duration: Duration(milliseconds: 800),
backgroundColor: Colors.yellow,
//icon:Image(image:AssetImage("assets/images/dora.png"))
);
return;
}
indexController.is_loading.value = true;
indexController.register(emailController.text, passwordController.text, context);
},
color: Colors.redAccent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40)
),
child: Text("サインアップ",style: TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// resizeToAvoidBottomInset: false,
// backgroundColor: Colors.white,
// appBar: AppBar(
// elevation: 0,
// brightness: Brightness.light,
// backgroundColor: Colors.white,
// leading:
// IconButton( onPressed: (){
// Navigator.pop(context);
// },icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
// ),
// body: SafeArea(
// child: SingleChildScrollView(
// child: Container(
// height: MediaQuery.of(context).size.height,
// width: double.infinity,
// child: Column(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Column(
// children: [
// Column(
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// children: [
// Text ("サインアップ", style: TextStyle(
// fontSize: 30,
// fontWeight: FontWeight.bold,
// ),),
// SizedBox(height: 20,),
// Text("アカウントを作成し、無料です",style: TextStyle(
// fontSize: 15,
// color: Colors.grey[700],
// ),),
// SizedBox(height: 30,)
// ],
// ),
// Padding(
// padding: EdgeInsets.symmetric(
// horizontal: 40
// ),
// child: Column(
// children: [
// makeInput(label: "Eメール", controller: emailController),
// makeInput(label: "パスワード", controller: passwordController,obsureText: true),
// makeInput(label: "パスワードを認証する", controller: confirmPasswordController,obsureText: true)
// ],
// ),
// ),
// Padding(
// padding: EdgeInsets.symmetric(horizontal: 40),
// child: Container(
// padding: EdgeInsets.only(top: 3,left: 3),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(40),
// border: Border(
// bottom: BorderSide(color: Colors.black),
// top: BorderSide(color: Colors.black),
// right: BorderSide(color: Colors.black),
// left: BorderSide(color: Colors.black)
// )
// ),
// child: MaterialButton(
// minWidth: double.infinity,
// height:60,
// onPressed: (){
// if(passwordController.text != confirmPasswordController.text){
// Get.snackbar(
// "No match",
// "Passwords does not match",
// icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
// snackPosition: SnackPosition.TOP,
// duration: Duration(milliseconds: 800),
// backgroundColor: Colors.yellow,
// //icon:Image(image:AssetImage("assets/images/dora.png"))
// );
// }
// if(emailController.text.isEmpty || passwordController.text.isEmpty){
// Get.snackbar(
// "No values",
// "Email and password required",
// icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
// snackPosition: SnackPosition.TOP,
// duration: Duration(milliseconds: 800),
// backgroundColor: Colors.yellow,
// //icon:Image(image:AssetImage("assets/images/dora.png"))
// );
// return;
// }
// indexController.is_loading.value = true;
// indexController.register(emailController.text, passwordController.text, context);
// },
// color: Colors.redAccent,
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(40)
// ),
// child: Text("サインアップ",style: TextStyle(
// fontWeight: FontWeight.w600,fontSize: 16,
),),
),
),
),
SizedBox(height: 20,),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Flexible(child: Text("すでにアカウントをお持ちですか?")),
TextButton(
onPressed: (){
Get.toNamed(AppPages.LOGIN);
},
child: Text("ログイン",style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 18
),),
),
],
)
],
// ),),
// ),
// ),
// ),
// SizedBox(height: 20,),
// Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Flexible(child: Text("すでにアカウントをお持ちですか?")),
// TextButton(
// onPressed: (){
// Get.toNamed(AppPages.LOGIN);
// },
// child: Text("ログイン",style: TextStyle(
// fontWeight: FontWeight.w600,
// fontSize: 18
// ),),
// ),
// ],
// )
// ],
),
],
),
),
),
),
);
}
}
// ),
// ],
// ),
// ),
// ),
// ),
// );
// }
// }
Widget makeInput({label, required TextEditingController controller, obsureText = false}){
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(label,style:TextStyle(
fontSize: 15,
fontWeight: FontWeight.w400,
color: Colors.black87
),),
SizedBox(height: 5,),
TextField(
controller: controller,
obscureText: obsureText,
decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: (Colors.grey[400])!,
),
),
border: OutlineInputBorder(
borderSide: BorderSide(color: (Colors.grey[400])!
),
),
),
),
SizedBox(height: 30,)
// Widget makeInput({label, required TextEditingController controller, obsureText = false}){
// return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(label,style:TextStyle(
// fontSize: 15,
// fontWeight: FontWeight.w400,
// color: Colors.black87
// ),),
// SizedBox(height: 5,),
// TextField(
// controller: controller,
// obscureText: obsureText,
// decoration: InputDecoration(
// contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
// enabledBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: (Colors.grey[400])!,
// ),
// ),
// border: OutlineInputBorder(
// borderSide: BorderSide(color: (Colors.grey[400])!
// ),
// ),
// ),
// ),
// SizedBox(height: 30,)
],
);
}
// ],
// );
// }

View 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());
}
}

View 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;
}
}

View 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"),
);
},
);
}
}

View File

@ -1,9 +1,9 @@
import 'package:get/get.dart';
import 'package:rogapp/pages/search/search_controller.dart';
// import 'package:get/get.dart';
// import 'package:rogapp/pages/search/search_controller.dart';
class SearchBinding extends Bindings {
@override
void dependencies() {
Get.put<SearchController>(SearchController());
}
}
// class SearchBinding extends Bindings {
// @override
// void dependencies() {
// Get.put<SearchController>(SearchController());
// }
// }

View File

@ -1,26 +1,26 @@
import 'package:flutter/material.dart';
import 'package:geojson/geojson.dart';
import 'package:get/get.dart';
import 'package:get/get_state_manager/get_state_manager.dart';
import 'package:rogapp/model/destination.dart';
import 'package:rogapp/pages/index/index_controller.dart';
// import 'package:flutter/material.dart';
// import 'package:geojson/geojson.dart';
// import 'package:get/get.dart';
// import 'package:get/get_state_manager/get_state_manager.dart';
// import 'package:rogapp/model/destination.dart';
// import 'package:rogapp/pages/index/index_controller.dart';
class SearchController extends GetxController {
// class SearchController extends GetxController {
List<GeoJsonFeature> searchResults = <GeoJsonFeature>[].obs;
// List<GeoJsonFeature> searchResults = <GeoJsonFeature>[].obs;
@override
void onInit() {
IndexController indexController = Get.find<IndexController>();
if(indexController.locations.isNotEmpty){
for(int i=0; i<= indexController.locations[0].collection.length - 1; i++){
GeoJsonFeature p = indexController.locations[0].collection[i];
searchResults.add(p);
}
}
super.onInit();
}
// @override
// void onInit() {
// IndexController indexController = Get.find<IndexController>();
// if(indexController.locations.isNotEmpty){
// for(int i=0; i<= indexController.locations[0].collection.length - 1; i++){
// GeoJsonFeature p = indexController.locations[0].collection[i];
// searchResults.add(p);
// }
// }
// super.onInit();
// }
}
// }

View File

@ -1,96 +1,96 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_typeahead/flutter_typeahead.dart';
import 'package:get/get.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/pages/search/search_controller.dart';
import 'package:rogapp/widgets/bottom_sheet_new.dart';
// import 'package:flutter/cupertino.dart';
// import 'package:flutter/material.dart';
// import 'package:flutter_typeahead/flutter_typeahead.dart';
// import 'package:get/get.dart';
// import 'package:rogapp/pages/index/index_controller.dart';
// import 'package:rogapp/pages/search/search_controller.dart';
// import 'package:rogapp/widgets/bottom_sheet_new.dart';
class SearchPage extends StatelessWidget {
SearchPage({Key? key}) : super(key: key);
// class SearchPage extends StatelessWidget {
// SearchPage({Key? key}) : super(key: key);
SearchController searchController = Get.find<SearchController>();
IndexController indexController = Get.find<IndexController>();
// SearchController searchController = Get.find<SearchController>();
// IndexController indexController = Get.find<IndexController>();
Image getImage(int index){
if(searchController.searchResults[index].properties!["photos"] == null || searchController.searchResults[index].properties!["photos"] == ""){
return Image(image: AssetImage('assets/images/empty_image.png'));
}
else{
return Image(
image: NetworkImage(searchController.searchResults[index].properties!["photos"]),
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset("assets/images/empty_image.png");
},
);
}
}
// Image getImage(int index){
// if(searchController.searchResults[index].properties!["photos"] == null || searchController.searchResults[index].properties!["photos"] == ""){
// return Image(image: AssetImage('assets/images/empty_image.png'));
// }
// else{
// return Image(
// image: NetworkImage(searchController.searchResults[index].properties!["photos"]),
// errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
// return Image.asset("assets/images/empty_image.png");
// },
// );
// }
// }
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0,
backgroundColor: Colors.white,
leading: IconButton(
onPressed:(){
Navigator.pop(context);
},
icon: const Icon(Icons.arrow_back_ios_new, color: Colors.black,)),
title: TypeAheadField(
textFieldConfiguration: TextFieldConfiguration(
autofocus: true,
),
suggestionsCallback: (pattern) async{
return searchController.searchResults.where((GeoJsonFeature element) => element.properties!["location_name"].toString().contains(pattern));
//return await
},
itemBuilder: (context, GeoJsonFeature suggestion){
return ListTile(
title: Text(suggestion.properties!["location_name"]),
subtitle: suggestion.properties!["category"] != null ? Text(suggestion.properties!["category"]) : Text(""),
//leading: getImage(index),
);
},
onSuggestionSelected: (GeoJsonFeature suggestion){
indexController.currentFeature.clear();
indexController.currentFeature.add(suggestion);
Get.back();
showModalBottomSheet(
isScrollControlled: true,
context: context,
//builder: (context) => BottomSheetWidget(),
builder:((context) => BottomSheetNew())
);
},
),
//title: const CupertinoSearchTextField(),
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// appBar: AppBar(
// elevation: 0,
// backgroundColor: Colors.white,
// leading: IconButton(
// onPressed:(){
// Navigator.pop(context);
// },
// icon: const Icon(Icons.arrow_back_ios_new, color: Colors.black,)),
// title: TypeAheadField(
// textFieldConfiguration: TextFieldConfiguration(
// autofocus: true,
// ),
// suggestionsCallback: (pattern) async{
// return searchController.searchResults.where((GeoJsonFeature element) => element.properties!["location_name"].toString().contains(pattern));
// //return await
// },
// itemBuilder: (context, GeoJsonFeature suggestion){
// return ListTile(
// title: Text(suggestion.properties!["location_name"]),
// subtitle: suggestion.properties!["category"] != null ? Text(suggestion.properties!["category"]) : Text(""),
// //leading: getImage(index),
// );
// },
// onSuggestionSelected: (GeoJsonFeature suggestion){
// indexController.currentFeature.clear();
// indexController.currentFeature.add(suggestion);
// Get.back();
// showModalBottomSheet(
// isScrollControlled: true,
// context: context,
// //builder: (context) => BottomSheetWidget(),
// builder:((context) => BottomSheetNew())
// );
// },
// ),
// //title: const CupertinoSearchTextField(),
),
//body:
// Obx(() =>
// ListView.builder(
// itemCount: searchController.searchResults.length,
// itemBuilder: (context, index){
// return ListTile(
// title: searchController.searchResults[index].properties!["location_name"] != null ? Text(searchController.searchResults[index].properties!["location_name"]) : Text(""),
// subtitle: searchController.searchResults[index].properties!["category"] != null ? Text(searchController.searchResults[index].properties!["category"]) : Text(""),
// leading: getImage(index),
// onTap: (){
// indexController.currentFeature.clear();
// indexController.currentFeature.add(searchController.searchResults[index]);
// Get.back();
// showModalBottomSheet(
// isScrollControlled: true,
// context: context,
// //builder: (context) => BottomSheetWidget(),
// builder:((context) => BottomSheetNew())
// );
// },
// );
// },
// ),
// )
);
}
}
// ),
// //body:
// // Obx(() =>
// // ListView.builder(
// // itemCount: searchController.searchResults.length,
// // itemBuilder: (context, index){
// // return ListTile(
// // title: searchController.searchResults[index].properties!["location_name"] != null ? Text(searchController.searchResults[index].properties!["location_name"]) : Text(""),
// // subtitle: searchController.searchResults[index].properties!["category"] != null ? Text(searchController.searchResults[index].properties!["category"]) : Text(""),
// // leading: getImage(index),
// // onTap: (){
// // indexController.currentFeature.clear();
// // indexController.currentFeature.add(searchController.searchResults[index]);
// // Get.back();
// // showModalBottomSheet(
// // isScrollControlled: true,
// // context: context,
// // //builder: (context) => BottomSheetWidget(),
// // builder:((context) => BottomSheetNew())
// // );
// // },
// // );
// // },
// // ),
// // )
// );
// }
// }

View 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());
}
}

View File

@ -0,0 +1,5 @@
import 'package:get/get_state_manager/get_state_manager.dart';
class SelectController extends GetxController{
}

View 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();
}
}

View 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(),
)
],
)
)),
),
);
}
}

View File

@ -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()),
);
},
),
);
}
}

View File

@ -2,20 +2,16 @@ import 'package:get/get.dart';
import 'package:get/get_navigation/src/routes/get_route.dart';
import 'package:rogapp/pages/category/category_page.dart';
import 'package:rogapp/pages/city/city_page.dart';
import 'package:rogapp/pages/destination/destination_binding.dart';
import 'package:rogapp/pages/destination/destination_page.dart';
import 'package:rogapp/pages/home/home_binding.dart';
import 'package:rogapp/pages/home/home_page.dart';
import 'package:rogapp/pages/index/index_page.dart';
import 'package:rogapp/pages/landing/landing_page.dart';
import 'package:rogapp/pages/loading/loading_page.dart';
import 'package:rogapp/pages/login/login_page.dart';
import 'package:rogapp/pages/mainperf/mainperf_page.dart';
import 'package:rogapp/pages/permission/permission.dart';
import 'package:rogapp/pages/register/register_page.dart';
import 'package:rogapp/pages/rog/rog_page.dart';
import 'package:rogapp/pages/search/search_binding.dart';
import 'package:rogapp/pages/search/search_page.dart';
import 'package:rogapp/pages/select/select_page.dart';
import 'package:rogapp/pages/subperf/subperf_page.dart';
import 'package:rogapp/spa/spa_binding.dart';
import 'package:rogapp/spa/spa_page.dart';
@ -30,92 +26,25 @@ class AppPages {
// ignore: constant_identifier_names
static const SPA = Routes.SPA;
static const LANDING = Routes.LANDING;
static const LOGIN = Routes.LOGIN;
static const REGISTER = Routes.REGISTER;
static const TRAVEL = Routes.TRAVEL;
static const LOADING = Routes.LOADING;
static const DESTINATION_MAP = Routes.DESTINATION_MAP;
static const HOME = Routes.HOME;
static const PERMISSION = Routes.PERMISSION;
static const SEARCH = Routes.SEARCH;
static const MAINPERF = Routes.MAINPERF;
static const SUBPERF = Routes.SUBPERF;
static const CITY = Routes.CITY;
static const CATEGORY = Routes.CATEOGORY;
static const SELECT = Routes.SELECT;
static const ROG = Routes.ROG;
static final routes = [
// GetPage(
// name: Routes.HOME,
// page: () => HomePage(),
// binding: HomeBinding(),
// ),
// GetPage(
// name: Routes.MAP,
// page: () => MapPage(),
// binding: MapBinding(),
// )
GetPage(
name: Routes.INDEX,
page: () => IndexPage(),
//binding: IndexBinding(),
),
GetPage(
name: Routes.SPA,
page: () => const SpaPage(),
binding: SpaBinding(),
),
GetPage(
name: Routes.LANDING,
page: () => LandingPage(),
//binding: SpaBinding(),
),
GetPage(
name: Routes.LOGIN,
page: () => LoginPage(),
//binding: SpaBinding(),
),
GetPage(
name: Routes.REGISTER,
page: () => RegisterPage(),
//binding: SpaBinding(),
),
GetPage(
name: Routes.TRAVEL,
page: () => DestinationPage(),
binding: DestinationBinding(),
),
GetPage(
name: Routes.LOADING,
page: () => LoadingPage(),
//binding: DestinationBinding(),
),
GetPage(
name: Routes.DESTINATION_MAP,
page: () => DestinationPage(),
//binding: DestinationBinding(),
),
GetPage(
name: Routes.HOME,
page: () => HomePage(),
binding: HomeBinding(),
),
GetPage(
name: Routes.PERMISSION,
page: () => PermissionHandlerScreen(),
),
GetPage(
name: Routes.SEARCH,
page: () => SearchPage(),
binding: SearchBinding(),
),
GetPage(
name: Routes.MAINPERF,
page: () => MainPerfPage(),
),
GetPage(
name: Routes.SUBPERF,
page: () => SubPerfPage(),
),
GetPage(
name: Routes.CITY,
page: () => CityPage(),
@ -123,6 +52,14 @@ class AppPages {
GetPage(
name: Routes.CATEOGORY,
page: () => CategoryPage(),
),
GetPage(
name: Routes.SELECT,
page: () => SelectPage(),
),
GetPage(
name: Routes.ROG,
page: () => RogPage(),
)
];
}

View File

@ -21,4 +21,6 @@ abstract class Routes {
static const SUBPERF = '/subperf';
static const CITY = '/city';
static const CATEOGORY = '/category';
static const SELECT = '/select';
static const ROG = '/rog';
}

View File

@ -1,103 +1,103 @@
import 'dart:convert';
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
//import 'package:google_maps_webservice/directions.dart';
import 'package:http/http.dart' as http;
import 'package:rogapp/model/destination.dart';
// import 'dart:convert';
// import 'package:flutter_polyline_points/flutter_polyline_points.dart';
// //import 'package:google_maps_webservice/directions.dart';
// import 'package:http/http.dart' as http;
// import 'package:rogapp/model/destination.dart';
import '../utils/const.dart';
// import '../utils/const.dart';
class DestinationService{
// class DestinationService{
static Future<List<dynamic>> getDestinations(int user_id) async {
List<dynamic> cats = [];
String server_url = ConstValues.currentServer();
String url = "${server_url}/api/destinations/?user_id=${user_id}";
//String url = "http://localhost:8100/api/destinations/?user_id=${user_id}";
final http.Response response = await http.get(
Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
}
);
// static Future<List<dynamic>> getDestinations(int user_id) async {
// List<dynamic> cats = [];
// String server_url = ConstValues.currentServer();
// String url = "${server_url}/api/destinations/?user_id=${user_id}";
// //String url = "http://localhost:8100/api/destinations/?user_id=${user_id}";
// final http.Response response = await http.get(
// Uri.parse(url),
// headers: <String, String>{
// 'Content-Type': 'application/json; charset=UTF-8',
// }
// );
if (response.statusCode == 200) {
cats = json.decode(utf8.decode(response.bodyBytes));
}
return cats;
}
// if (response.statusCode == 200) {
// cats = json.decode(utf8.decode(response.bodyBytes));
// }
// return cats;
// }
static Future<Map<String, dynamic>> deleteDestination(int dest_id) async {
Map<String, dynamic> cats = {};
String server_url = ConstValues.currentServer();
String url = "${server_url}/api/delete_destination/?dest_id=${dest_id}";
//String url = "http://localhost:8100/api/delete_destination/?dest_id=${dest_id}";
final http.Response response = await http.get(
Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
}
);
// static Future<Map<String, dynamic>> deleteDestination(int dest_id) async {
// Map<String, dynamic> cats = {};
// String server_url = ConstValues.currentServer();
// String url = "${server_url}/api/delete_destination/?dest_id=${dest_id}";
// //String url = "http://localhost:8100/api/delete_destination/?dest_id=${dest_id}";
// final http.Response response = await http.get(
// Uri.parse(url),
// headers: <String, String>{
// 'Content-Type': 'application/json; charset=UTF-8',
// }
// );
if (response.statusCode == 200) {
cats = json.decode(utf8.decode(response.bodyBytes));
}
print("####### ---- ${cats}");
return cats;
}
// if (response.statusCode == 200) {
// cats = json.decode(utf8.decode(response.bodyBytes));
// }
// print("####### ---- ${cats}");
// return cats;
// }
static Future<int> updateOrder(int action_id, int order, String dir) async {
int cats = 0;
String server_url = ConstValues.currentServer();
String url = "${server_url}/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
print("---- url is ${url} -----");
//String url = "http://localhost:8100/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
final http.Response response = await http.get(
Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
}
);
// static Future<int> updateOrder(int action_id, int order, String dir) async {
// int cats = 0;
// String server_url = ConstValues.currentServer();
// String url = "${server_url}/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
// print("---- url is ${url} -----");
// //String url = "http://localhost:8100/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
// final http.Response response = await http.get(
// Uri.parse(url),
// headers: <String, String>{
// 'Content-Type': 'application/json; charset=UTF-8',
// }
// );
if (response.statusCode == 200) {
cats = json.decode(utf8.decode(response.bodyBytes));
}
return cats;
}
// if (response.statusCode == 200) {
// cats = json.decode(utf8.decode(response.bodyBytes));
// }
// return cats;
// }
static Future<List<PointLatLng>>? getDestinationLine(List<Destination> destinations) async{
PolylinePoints polylinePoints = PolylinePoints();
// static Future<List<PointLatLng>>? getDestinationLine(List<Destination> destinations) async{
// PolylinePoints polylinePoints = PolylinePoints();
if(destinations.length <= 0){
return [];
}
// if(destinations.length <= 0){
// return [];
// }
//print("##### @@@@@ ${destinations[0].lat}");
PointLatLng origin = PointLatLng(destinations[0].lat!, destinations[0].lon!);
PointLatLng dest = PointLatLng(destinations[destinations.length -1].lat!, destinations[destinations.length -1].lon!);
// //print("##### @@@@@ ${destinations[0].lat}");
// PointLatLng origin = PointLatLng(destinations[0].lat!, destinations[0].lon!);
// PointLatLng dest = PointLatLng(destinations[destinations.length -1].lat!, destinations[destinations.length -1].lon!);
List<PolylineWayPoint> wayPoints = [];
int i=0;
for(dynamic d in destinations){
if(i == 0 || i == (destinations.length -1)){
i+=1;
continue;
}
double la = d.lat;
double ln = d.lon;
PolylineWayPoint pwp = PolylineWayPoint(location: "${la},${ln}", stopOver: true);
//print("----- UUUUUU ${pwp}");
//PointLatLng wp = PointLatLng(d["Location"]["geometry"][0][1], d["Location"]["geometry"][0][0]);
wayPoints.add(pwp);
i+=1;
}
//PolylineResult result = await polylinePoints.getRouteBetweenCoordinates("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE", PointLatLng(35.389282, 136.498027), PointLatLng(36.285848, 137.575186));
PolylineResult result = await polylinePoints.getRouteBetweenCoordinates("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE", origin,dest, travelMode: TravelMode.driving, wayPoints: wayPoints);
//print("#####@@@@@ ${result.points}");
return result.points;
}
// List<PolylineWayPoint> wayPoints = [];
// int i=0;
// for(dynamic d in destinations){
// if(i == 0 || i == (destinations.length -1)){
// i+=1;
// continue;
// }
// double la = d.lat;
// double ln = d.lon;
// PolylineWayPoint pwp = PolylineWayPoint(location: "${la},${ln}", stopOver: true);
// //print("----- UUUUUU ${pwp}");
// //PointLatLng wp = PointLatLng(d["Location"]["geometry"][0][1], d["Location"]["geometry"][0][0]);
// wayPoints.add(pwp);
// i+=1;
// }
// //PolylineResult result = await polylinePoints.getRouteBetweenCoordinates("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE", PointLatLng(35.389282, 136.498027), PointLatLng(36.285848, 137.575186));
// PolylineResult result = await polylinePoints.getRouteBetweenCoordinates("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE", origin,dest, travelMode: TravelMode.driving, wayPoints: wayPoints);
// //print("#####@@@@@ ${result.points}");
// return result.points;
// }
}
// }

View File

@ -1,47 +1,47 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:rogapp/model/destination.dart';
// import 'dart:convert';
// import 'package:http/http.dart' as http;
// import 'package:rogapp/model/destination.dart';
class MatrixService{
// class MatrixService{
static Future<Map<String, dynamic>> getDestinations(List<Destination> destinations) async {
// static Future<Map<String, dynamic>> getDestinations(List<Destination> destinations) async {
String locs = "";
String origin = "";
int i = 0;
for(Destination d in destinations){
// String locs = "";
// String origin = "";
// int i = 0;
// for(Destination d in destinations){
print("---- getting matrix for ${d} ------------");
// print("---- getting matrix for ${d} ------------");
if(i==0){
origin = "${d.lat}, ${d.lon}";
}
// if(i==0){
// origin = "${d.lat}, ${d.lon}";
// }
print("lat is ${d.lat}, long is ${d.lon}");
locs += "${d.lat}, ${d.lon}|";
i++;
}
// print("lat is ${d.lat}, long is ${d.lon}");
// locs += "${d.lat}, ${d.lon}|";
// i++;
// }
//print(locs);
// //print(locs);
Map<String, dynamic> cats = {};
String url = "https://maps.googleapis.com/maps/api/distancematrix/json?destinations=${locs}&origins=${origin}&key=AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE";
print(url);
final http.Response response = await http.get(
Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
}
);
// Map<String, dynamic> cats = {};
// String url = "https://maps.googleapis.com/maps/api/distancematrix/json?destinations=${locs}&origins=${origin}&key=AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE";
// print(url);
// final http.Response response = await http.get(
// Uri.parse(url),
// headers: <String, String>{
// 'Content-Type': 'application/json; charset=UTF-8',
// }
// );
if (response.statusCode == 200) {
cats = json.decode(utf8.decode(response.bodyBytes));
}
return cats;
}
// if (response.statusCode == 200) {
// cats = json.decode(utf8.decode(response.bodyBytes));
// }
// return cats;
// }
}
// }

View 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());
}
}

View File

@ -0,0 +1,6 @@
import 'package:get/get_state_manager/get_state_manager.dart';
class AppController extends GetxController{
}

View File

@ -1,22 +1,22 @@
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
// import 'package:flutter/material.dart';
// import 'package:flutter_map/flutter_map.dart';
class BaseLayer extends StatelessWidget {
const BaseLayer({Key? key}) : super(key: key);
// class BaseLayer extends StatelessWidget {
// const BaseLayer({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return TileLayerWidget(
options: TileLayerOptions(
backgroundColor: Colors.transparent,
urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
//urlTemplate: 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
subdomains: ['a', 'b', 'c'],
),
);
}
}
// @override
// Widget build(BuildContext context) {
// return TileLayerWidget(
// options: TileLayerOptions(
// backgroundColor: Colors.transparent,
// urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
// //urlTemplate: 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
// subdomains: ['a', 'b', 'c'],
// ),
// );
// }
// }
// var Esri_WorldImagery = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
// attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
// });
// // var Esri_WorldImagery = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
// // attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
// // });

View File

@ -1,11 +1,11 @@
import 'package:geojson/geojson.dart';
import 'package:get/get_state_manager/get_state_manager.dart';
// import 'package:geojson/geojson.dart';
// import 'package:get/get_state_manager/get_state_manager.dart';
class BottomSheetController extends GetxController{
// class BottomSheetController extends GetxController{
List<GeoJsonFeature>? currentFeature = <GeoJsonFeature>[];
// List<GeoJsonFeature>? currentFeature = <GeoJsonFeature>[];
BottomSheetController({this.currentFeature});
}
// BottomSheetController({this.currentFeature});
// }

File diff suppressed because it is too large Load Diff

View File

@ -1,380 +1,380 @@
import 'dart:io';
// import 'dart:io';
import 'package:flutter/material.dart';
import 'package:geojson/geojson.dart';
import 'package:get/get.dart';
import 'package:image_picker/image_picker.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/routes/app_pages.dart';
import 'package:url_launcher/url_launcher.dart';
// import 'package:flutter/material.dart';
// import 'package:geojson/geojson.dart';
// import 'package:get/get.dart';
// import 'package:image_picker/image_picker.dart';
// import 'package:rogapp/pages/index/index_controller.dart';
// import 'package:rogapp/routes/app_pages.dart';
// import 'package:url_launcher/url_launcher.dart';
class BottomSheetWidget extends StatelessWidget {
//const BottomSheetWidget({ Key? key }, GeoJsonFeature? pt) : super(key: key);
// class BottomSheetWidget extends StatelessWidget {
// //const BottomSheetWidget({ Key? key }, GeoJsonFeature? pt) : super(key: key);
final IndexController indexController = Get.find<IndexController>();
// final IndexController indexController = Get.find<IndexController>();
Image getImage(GeoJsonFeature? gf){
if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){
return Image(image: AssetImage('assets/images/empty_image.png'));
}
else{
return Image(image: NetworkImage(
gf.properties!["photos"],
),
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset("assets/images/empty_image.png");
},
);
}
}
// Image getImage(GeoJsonFeature? gf){
// if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){
// return Image(image: AssetImage('assets/images/empty_image.png'));
// }
// else{
// return Image(image: NetworkImage(
// gf.properties!["photos"],
// ),
// errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
// return Image.asset("assets/images/empty_image.png");
// },
// );
// }
// }
void _launchURL(url) async {
if (!await launch(url)) throw 'Could not launch $url';
}
// void _launchURL(url) async {
// if (!await launch(url)) throw 'Could not launch $url';
// }
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Column(
children: [
SizedBox(height: 5.0,),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
MaterialButton(
onPressed: () {
indexController.makePrevious(indexController.currentFeature[0]);
},
color: Colors.blue,
textColor: Colors.white,
child: Icon(
Icons.arrow_back_ios,
size: 14,
),
padding: EdgeInsets.all(14),
shape: CircleBorder(),
),
Expanded(
child: Container(
alignment: Alignment.center,
child: Obx(() =>
Text(indexController.currentFeature[0].properties!["location_name"], style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
)
),
),
),
MaterialButton(
onPressed: () {
indexController.makeNext(indexController.currentFeature[0]);
},
color: Colors.blue,
textColor: Colors.white,
child: Icon(
Icons.arrow_forward_ios,
size: 14,
),
padding: EdgeInsets.all(14),
shape: CircleBorder(),
),
],
),
Row(
children: [
Expanded(
child: SizedBox(
height: 260.0,
child: Obx(() => getImage(indexController.currentFeature[0])),
)
),
],
),
Row(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Column(
children: [
indexController.currentFeature[0].properties!["address"] != null ?
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: Container(
alignment: Alignment.topRight,
child: Text("address".tr, style: TextStyle(fontWeight: FontWeight.bold),)),
),
SizedBox(width: 12.0,),
Expanded(
child: Container(
alignment: Alignment.topLeft,
child: Obx(() => Text(indexController.currentFeature[0].properties!["address"] ?? '',
style: TextStyle(color: Colors.blue,),
softWrap: true,
overflow: TextOverflow.ellipsis,)
),
),
)
],
): Container(width: 0.0, height: 0,),
indexController.currentFeature[0].properties!["phone"] != null ?
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(child: Container(
alignment: Alignment.topRight,
child: Text("telephone".tr, style: TextStyle(fontWeight: FontWeight.bold),))),
SizedBox(width: 12.0,),
Expanded(
child: Container(
alignment: Alignment.topLeft,
child: Obx(() => Text(indexController.currentFeature[0].properties!["phone"] ?? '',
style: TextStyle(color: Colors.blue,),
overflow: TextOverflow.ellipsis,)
),
),
)
],
): Container(width: 0, height: 0,),
indexController.currentFeature[0].properties!["email"] != null ?
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(child: Container(
alignment: Alignment.topRight,
child: Text("email".tr, style: TextStyle(fontWeight: FontWeight.bold),))),
SizedBox(width: 12.0,),
Expanded(
child: Container(
alignment: Alignment.topLeft,
child: Obx(() => Text(indexController.currentFeature[0].properties!["email"] ?? '',
style: TextStyle(color: Colors.blue,),
overflow: TextOverflow.ellipsis,)
),
),
)
],
): Container(width: 0, height: 0,),
indexController.currentFeature[0].properties!["webcontents"] != null ?
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(child: Container(
alignment: Alignment.topRight,
child: Text(
"web".tr, style: TextStyle(fontWeight: FontWeight.bold)))),
SizedBox(width: 12.0,),
Expanded(
child: Container(
alignment: Alignment.topLeft,
child: Obx(() => InkWell(
onTap: (){
_launchURL(indexController.currentFeature[0].properties!["webcontents"]);
},
child: Text(indexController.currentFeature[0].properties!["webcontents"] ?? '',
style: TextStyle(color: Colors.blue,),
softWrap: false,
overflow: TextOverflow.fade,),
)),
),
)
],
): Container(width: 0.0, height: 0.0,),
indexController.currentFeature[0].properties!["videos"] != null ?
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(child: Container(
alignment: Alignment.topRight,
child: Text("video".tr, style: TextStyle(fontWeight: FontWeight.bold)))),
SizedBox(width: 12.0,),
Expanded(
child: Container(
alignment: Alignment.topLeft,
child: Obx(() => Text(indexController.currentFeature[0].properties!["videos"] ?? '',
style: TextStyle(color: Colors.blue,),
overflow: TextOverflow.ellipsis,)
),
),
)
],
): Container(width: 0.0, height: 0.0,),
],
),
),
),
],
),
SizedBox(height: 20.0,),
Obx(() =>
indexController.currentAction.isNotEmpty ?
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
indexController.rog_mode.value == 0 ?
// @override
// Widget build(BuildContext context) {
// return SingleChildScrollView(
// child: Column(
// children: [
// SizedBox(height: 5.0,),
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// MaterialButton(
// onPressed: () {
// indexController.makePrevious(indexController.currentFeature[0]);
// },
// color: Colors.blue,
// textColor: Colors.white,
// child: Icon(
// Icons.arrow_back_ios,
// size: 14,
// ),
// padding: EdgeInsets.all(14),
// shape: CircleBorder(),
// ),
// Expanded(
// child: Container(
// alignment: Alignment.center,
// child: Obx(() =>
// Text(indexController.currentFeature[0].properties!["location_name"], style: TextStyle(
// fontSize: 15.0,
// fontWeight: FontWeight.bold,
// ),
// )
// ),
// ),
// ),
// MaterialButton(
// onPressed: () {
// indexController.makeNext(indexController.currentFeature[0]);
// },
// color: Colors.blue,
// textColor: Colors.white,
// child: Icon(
// Icons.arrow_forward_ios,
// size: 14,
// ),
// padding: EdgeInsets.all(14),
// shape: CircleBorder(),
// ),
// ],
// ),
// Row(
// children: [
// Expanded(
// child: SizedBox(
// height: 260.0,
// child: Obx(() => getImage(indexController.currentFeature[0])),
// )
// ),
// ],
// ),
// Row(
// children: [
// Expanded(
// child: Padding(
// padding: const EdgeInsets.symmetric(horizontal: 10.0),
// child: Column(
// children: [
// indexController.currentFeature[0].properties!["address"] != null ?
// Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Expanded(
// child: Container(
// alignment: Alignment.topRight,
// child: Text("address".tr, style: TextStyle(fontWeight: FontWeight.bold),)),
// ),
// SizedBox(width: 12.0,),
// Expanded(
// child: Container(
// alignment: Alignment.topLeft,
// child: Obx(() => Text(indexController.currentFeature[0].properties!["address"] ?? '',
// style: TextStyle(color: Colors.blue,),
// softWrap: true,
// overflow: TextOverflow.ellipsis,)
// ),
// ),
// )
// ],
// ): Container(width: 0.0, height: 0,),
// indexController.currentFeature[0].properties!["phone"] != null ?
// Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Expanded(child: Container(
// alignment: Alignment.topRight,
// child: Text("telephone".tr, style: TextStyle(fontWeight: FontWeight.bold),))),
// SizedBox(width: 12.0,),
// Expanded(
// child: Container(
// alignment: Alignment.topLeft,
// child: Obx(() => Text(indexController.currentFeature[0].properties!["phone"] ?? '',
// style: TextStyle(color: Colors.blue,),
// overflow: TextOverflow.ellipsis,)
// ),
// ),
// )
// ],
// ): Container(width: 0, height: 0,),
// indexController.currentFeature[0].properties!["email"] != null ?
// Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Expanded(child: Container(
// alignment: Alignment.topRight,
// child: Text("email".tr, style: TextStyle(fontWeight: FontWeight.bold),))),
// SizedBox(width: 12.0,),
// Expanded(
// child: Container(
// alignment: Alignment.topLeft,
// child: Obx(() => Text(indexController.currentFeature[0].properties!["email"] ?? '',
// style: TextStyle(color: Colors.blue,),
// overflow: TextOverflow.ellipsis,)
// ),
// ),
// )
// ],
// ): Container(width: 0, height: 0,),
// indexController.currentFeature[0].properties!["webcontents"] != null ?
// Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Expanded(child: Container(
// alignment: Alignment.topRight,
// child: Text(
// "web".tr, style: TextStyle(fontWeight: FontWeight.bold)))),
// SizedBox(width: 12.0,),
// Expanded(
// child: Container(
// alignment: Alignment.topLeft,
// child: Obx(() => InkWell(
// onTap: (){
// _launchURL(indexController.currentFeature[0].properties!["webcontents"]);
// },
// child: Text(indexController.currentFeature[0].properties!["webcontents"] ?? '',
// style: TextStyle(color: Colors.blue,),
// softWrap: false,
// overflow: TextOverflow.fade,),
// )),
// ),
// )
// ],
// ): Container(width: 0.0, height: 0.0,),
// indexController.currentFeature[0].properties!["videos"] != null ?
// Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Expanded(child: Container(
// alignment: Alignment.topRight,
// child: Text("video".tr, style: TextStyle(fontWeight: FontWeight.bold)))),
// SizedBox(width: 12.0,),
// Expanded(
// child: Container(
// alignment: Alignment.topLeft,
// child: Obx(() => Text(indexController.currentFeature[0].properties!["videos"] ?? '',
// style: TextStyle(color: Colors.blue,),
// overflow: TextOverflow.ellipsis,)
// ),
// ),
// )
// ],
// ): Container(width: 0.0, height: 0.0,),
// ],
// ),
// ),
// ),
// ],
// ),
// SizedBox(height: 20.0,),
// Obx(() =>
// indexController.currentAction.isNotEmpty ?
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
// children: [
// indexController.rog_mode.value == 0 ?
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end,
children: [
indexController.currentAction[0][0]["wanttogo"] == false ?
ElevatedButton(
onPressed: (){
if(indexController.currentAction.isNotEmpty){
print(indexController.currentAction[0]);
indexController.currentAction[0][0]["wanttogo"] = true;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
print("---temp---${temp}");
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
},
child: Text("want_to_go".tr)
) :
ElevatedButton(
onPressed: (){
if(indexController.currentAction.isNotEmpty){
print(indexController.currentAction[0]);
indexController.currentAction[0][0]["wanttogo"] = false;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
print("---temp---${temp}");
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
},
// Row(
// mainAxisSize: MainAxisSize.max,
// mainAxisAlignment: MainAxisAlignment.end,
// children: [
// indexController.currentAction[0][0]["wanttogo"] == false ?
// ElevatedButton(
// onPressed: (){
// if(indexController.currentAction.isNotEmpty){
// print(indexController.currentAction[0]);
// indexController.currentAction[0][0]["wanttogo"] = true;
// Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
// indexController.currentAction.clear();
// print("---temp---${temp}");
// indexController.currentAction.add([temp]);
// }
// indexController.makeAction(context);
// },
// child: Text("want_to_go".tr)
// ) :
// ElevatedButton(
// onPressed: (){
// if(indexController.currentAction.isNotEmpty){
// print(indexController.currentAction[0]);
// indexController.currentAction[0][0]["wanttogo"] = false;
// Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
// indexController.currentAction.clear();
// print("---temp---${temp}");
// indexController.currentAction.add([temp]);
// }
// indexController.makeAction(context);
// },
child: IconButton(
icon: Icon(Icons.favorite, color: Colors.red, semanticLabel: "want_to_go".tr,), onPressed: () {
// child: IconButton(
// icon: Icon(Icons.favorite, color: Colors.red, semanticLabel: "want_to_go".tr,), onPressed: () {
},
// },
)
),
indexController.currentAction[0][0]["like"] == false ?
ElevatedButton(
onPressed: (){
if(indexController.currentAction.isNotEmpty){
print(indexController.currentAction[0]);
indexController.currentAction[0][0]["like"] = true;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
print("---temp---${temp}");
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
},
child: Text("like".tr)
) :
ElevatedButton(
onPressed: (){
if(indexController.currentAction.isNotEmpty){
print(indexController.currentAction[0]);
indexController.currentAction[0][0]["like"] = false;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
print("---temp---${temp}");
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
},
// )
// ),
// indexController.currentAction[0][0]["like"] == false ?
// ElevatedButton(
// onPressed: (){
// if(indexController.currentAction.isNotEmpty){
// print(indexController.currentAction[0]);
// indexController.currentAction[0][0]["like"] = true;
// Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
// indexController.currentAction.clear();
// print("---temp---${temp}");
// indexController.currentAction.add([temp]);
// }
// indexController.makeAction(context);
// },
// child: Text("like".tr)
// ) :
// ElevatedButton(
// onPressed: (){
// if(indexController.currentAction.isNotEmpty){
// print(indexController.currentAction[0]);
// indexController.currentAction[0][0]["like"] = false;
// Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
// indexController.currentAction.clear();
// print("---temp---${temp}");
// indexController.currentAction.add([temp]);
// }
// indexController.makeAction(context);
// },
child: IconButton(
icon: Icon(Icons.favorite, color: Colors.red, semanticLabel: "like".tr,), onPressed: () {
// child: IconButton(
// icon: Icon(Icons.favorite, color: Colors.red, semanticLabel: "like".tr,), onPressed: () {
},
// },
)
),
],
)
// )
// ),
// ],
// )
:
Container(width: 0, height: 0,),
indexController.rog_mode.value == 1 ?
indexController.currentAction[0][0]["checkin"] == false ?
Column(
children: [
Row(
mainAxisSize: MainAxisSize.max,
children: [
ElevatedButton(
child: Text("Image"), onPressed: (){
final ImagePicker _picker = ImagePicker();
_picker.pickImage(source: ImageSource.camera).then((value){
print("----- image---- ${value!.path}");
});
},
)
],
),
ElevatedButton(
onPressed: (){
if(indexController.currentAction.isNotEmpty){
print(indexController.currentAction[0]);
indexController.currentAction[0][0]["checkin"] = true;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
print("---temp---${temp}");
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
},
child: Text("checkin".tr)
)
],
)
:
ElevatedButton(
onPressed: (){
if(indexController.currentAction.isNotEmpty){
print(indexController.currentAction[0]);
indexController.currentAction[0][0]["checkin"] = false;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
print("---temp---${temp}");
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
},
// :
// Container(width: 0, height: 0,),
// indexController.rog_mode.value == 1 ?
// indexController.currentAction[0][0]["checkin"] == false ?
// Column(
// children: [
// Row(
// mainAxisSize: MainAxisSize.max,
// children: [
// ElevatedButton(
// child: Text("Image"), onPressed: (){
// final ImagePicker _picker = ImagePicker();
// _picker.pickImage(source: ImageSource.camera).then((value){
// print("----- image---- ${value!.path}");
// });
// },
// )
// ],
// ),
// ElevatedButton(
// onPressed: (){
// if(indexController.currentAction.isNotEmpty){
// print(indexController.currentAction[0]);
// indexController.currentAction[0][0]["checkin"] = true;
// Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
// indexController.currentAction.clear();
// print("---temp---${temp}");
// indexController.currentAction.add([temp]);
// }
// indexController.makeAction(context);
// },
// child: Text("checkin".tr)
// )
// ],
// )
// :
// ElevatedButton(
// onPressed: (){
// if(indexController.currentAction.isNotEmpty){
// print(indexController.currentAction[0]);
// indexController.currentAction[0][0]["checkin"] = false;
// Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
// indexController.currentAction.clear();
// print("---temp---${temp}");
// indexController.currentAction.add([temp]);
// }
// indexController.makeAction(context);
// },
child: Icon(
Icons.favorite, color: Colors.red)
// child: Icon(
// Icons.favorite, color: Colors.red)
,
):
Container(width: 0, height: 0,),
],
): Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextButton(
onPressed: (){
Get.toNamed(AppPages.LOGIN);
},
child: Flexible(child: Text("その他のオプションについてはログインしてください")))
],
),
),
Row(
children: [
SizedBox(height: 60.0,),
],
)
],
),
);
}
}
// ,
// ):
// Container(width: 0, height: 0,),
// ],
// ): Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// TextButton(
// onPressed: (){
// Get.toNamed(AppPages.LOGIN);
// },
// child: Flexible(child: Text("その他のオプションについてはログインしてください")))
// ],
// ),
// ),
// Row(
// children: [
// SizedBox(height: 60.0,),
// ],
// )
// ],
// ),
// );
// }
// }

View File

@ -1,34 +1,34 @@
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:get/get.dart';
import 'package:flutter_breadcrumb/flutter_breadcrumb.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/widgets/perfecture_widget.dart';
// import 'package:flutter/material.dart';
// import 'package:flutter_map/flutter_map.dart';
// import 'package:get/get.dart';
// import 'package:flutter_breadcrumb/flutter_breadcrumb.dart';
// import 'package:rogapp/pages/index/index_controller.dart';
// import 'package:rogapp/widgets/perfecture_widget.dart';
class BreadCrumbWidget extends StatelessWidget {
BreadCrumbWidget({Key? key, this.mapController}) : super(key: key);
// class BreadCrumbWidget extends StatelessWidget {
// BreadCrumbWidget({Key? key, this.mapController}) : super(key: key);
final MapController? mapController;
// final MapController? mapController;
final IndexController indexController = Get.find<IndexController>();
// final IndexController indexController = Get.find<IndexController>();
@override
Widget build(BuildContext context) {
print("------ map controller is ${mapController}------------");
return
Obx(()=>
indexController.perfectures.isNotEmpty && mapController != null ?
BreadCrumb.builder(
itemCount: indexController.perfectures.length,
builder: (index){
return
BreadCrumbItem(
content: PerfectureWidget(indexController: indexController, mapController: mapController!) //Text('Item$index')
);
}
):
const Text("Empty")
);
}
}
// @override
// Widget build(BuildContext context) {
// print("------ map controller is ${mapController}------------");
// return
// Obx(()=>
// indexController.perfectures.isNotEmpty && mapController != null ?
// BreadCrumb.builder(
// itemCount: indexController.perfectures.length,
// builder: (index){
// return
// BreadCrumbItem(
// content: PerfectureWidget(indexController: indexController, mapController: mapController!) //Text('Item$index')
// );
// }
// ):
// const Text("Empty")
// );
// }
// }

View File

@ -1,50 +1,50 @@
import 'package:flutter/material.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/services/location_service.dart';
// import 'package:flutter/material.dart';
// import 'package:rogapp/pages/index/index_controller.dart';
// import 'package:rogapp/services/location_service.dart';
class CatWidget extends StatefulWidget {
CatWidget({ Key? key, required this.indexController, }) : super(key: key);
// class CatWidget extends StatefulWidget {
// CatWidget({ Key? key, required this.indexController, }) : super(key: key);
IndexController indexController;
// IndexController indexController;
@override
State<CatWidget> createState() => _CatWidgetState();
}
// @override
// State<CatWidget> createState() => _CatWidgetState();
// }
class _CatWidgetState extends State<CatWidget> {
String defaultValue = "---";
// class _CatWidgetState extends State<CatWidget> {
// String defaultValue = "---";
@override
Widget build(BuildContext context) {
return
PopupMenuButton(
onSelected: (value) {
widget.indexController.currentCat.clear();
widget.indexController.currentCat.add(value.toString());
widget.indexController.refreshLocationForCat();
setState(() {
print(value);
//widget.indexController.is_loading.value = true;
defaultValue = value.toString();
});
},
itemBuilder: (BuildContext context){
List<PopupMenuItem> itms = <PopupMenuItem>[];
for(dynamic d in widget.indexController.cats[0]){
PopupMenuItem itm = PopupMenuItem(child: Text(d['category'].toString()), value: d['category'].toString());
itms.add(itm);
}
return itms;
}
// @override
// Widget build(BuildContext context) {
// return
// PopupMenuButton(
// onSelected: (value) {
// widget.indexController.currentCat.clear();
// widget.indexController.currentCat.add(value.toString());
// widget.indexController.refreshLocationForCat();
// setState(() {
// print(value);
// //widget.indexController.is_loading.value = true;
// defaultValue = value.toString();
// });
// },
// itemBuilder: (BuildContext context){
// List<PopupMenuItem> itms = <PopupMenuItem>[];
// for(dynamic d in widget.indexController.cats[0]){
// PopupMenuItem itm = PopupMenuItem(child: Text(d['category'].toString()), value: d['category'].toString());
// itms.add(itm);
// }
// return itms;
// }
);
}
}
// );
// }
// }
// widget.indexController.cats.map((e) =>
// PopupMenuItem(
// value: defaultValue,
// child: Text(e[0]['category'].toString()),
// )
// ).toList(),
// // widget.indexController.cats.map((e) =>
// // PopupMenuItem(
// // value: defaultValue,
// // child: Text(e[0]['category'].toString()),
// // )
// // ).toList(),

View 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,)),
],
),
)
],
),
);
}
}

View File

@ -1,219 +1,219 @@
import 'dart:ffi';
// import 'dart:ffi';
import 'package:flutter/material.dart';
import 'package:geojson/geojson.dart';
import 'package:get/get.dart';
import 'package:rogapp/model/destination.dart';
import 'package:rogapp/pages/destination/destination_controller.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/widgets/bottom_sheet_new.dart';
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
import 'package:timeline_tile/timeline_tile.dart';
// import 'package:flutter/material.dart';
// import 'package:geojson/geojson.dart';
// import 'package:get/get.dart';
// import 'package:rogapp/model/destination.dart';
// import 'package:rogapp/pages/destination/destination_controller.dart';
// import 'package:rogapp/pages/index/index_controller.dart';
// import 'package:rogapp/widgets/bottom_sheet_new.dart';
// import 'package:rogapp/widgets/bottom_sheet_widget.dart';
// import 'package:timeline_tile/timeline_tile.dart';
class DestinationWidget extends StatelessWidget {
DestinationWidget({ Key? key }) : super(key: key);
// class DestinationWidget extends StatelessWidget {
// DestinationWidget({ Key? key }) : super(key: key);
final DestinationController destinationController = Get.find<DestinationController>();
// final DestinationController destinationController = Get.find<DestinationController>();
final IndexController indexController = Get.find<IndexController>();
// final IndexController indexController = Get.find<IndexController>();
final List<int> _items = List<int>.generate(50, (int index) => index);
// final List<int> _items = List<int>.generate(50, (int index) => index);
Image getImage(int index){
if(destinationController.destinations[index].photos== null || destinationController.destinations[index].photos == ""){
return Image(image: AssetImage('assets/images/empty_image.png'));
}
else{
print("------- image is ${destinationController.destinations[index].photos!}------");
return Image(image: NetworkImage(
destinationController.destinations[index].photos!),
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset("assets/images/empty_image.png");
},
);
}
}
// Image getImage(int index){
// if(destinationController.destinations[index].photos== null || destinationController.destinations[index].photos == ""){
// return Image(image: AssetImage('assets/images/empty_image.png'));
// }
// else{
// print("------- image is ${destinationController.destinations[index].photos!}------");
// return Image(image: NetworkImage(
// destinationController.destinations[index].photos!),
// errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
// return Image.asset("assets/images/empty_image.png");
// },
// );
// }
// }
bool getSelection(int index){
bool ret = false;
destinationController.destination_index_data.forEach((element) {
if(index == element["index"]){
if(element["selected"] == true){
ret = true;
return;
}
}
});
return ret;
}
// bool getSelection(int index){
// bool ret = false;
// destinationController.destination_index_data.forEach((element) {
// if(index == element["index"]){
// if(element["selected"] == true){
// ret = true;
// return;
// }
// }
// });
// return ret;
// }
void doDelete() {
destinationController.currentSelectedDestinations.forEach((element) {
destinationController.deleteDestination(element);
});
// destinationController.destination_index_data.forEach((element) {
// //print(element["index"]);
// destinationController.deleteDestination(element["index"]);
// });
// destinationController.destination_index_data.clear();
}
// void doDelete() {
// destinationController.currentSelectedDestinations.forEach((element) {
// destinationController.deleteDestination(element);
// });
// // destinationController.destination_index_data.forEach((element) {
// // //print(element["index"]);
// // destinationController.deleteDestination(element["index"]);
// // });
// // destinationController.destination_index_data.clear();
// }
void moveUp() {
destinationController.destination_index_data.forEach((element) {
//print(element["index"]);
//int action_id = destinationController.destinations[element["index"]]["id"] as int;
//destinationController.makeOrder(action_id, (element["index"] as int) - 1, "up");
});
}
// void moveUp() {
// destinationController.destination_index_data.forEach((element) {
// //print(element["index"]);
// //int action_id = destinationController.destinations[element["index"]]["id"] as int;
// //destinationController.makeOrder(action_id, (element["index"] as int) - 1, "up");
// });
// }
void moveDown() {
destinationController.destination_index_data.forEach((element) {
//print(element["index"]);
//int action_id = destinationController.destinations[element["index"]]["id"] as int;
//destinationController.makeOrder(action_id, (element["index"] as int) + 1, "up");
});
}
// void moveDown() {
// destinationController.destination_index_data.forEach((element) {
// //print(element["index"]);
// //int action_id = destinationController.destinations[element["index"]]["id"] as int;
// //destinationController.makeOrder(action_id, (element["index"] as int) + 1, "up");
// });
// }
void interChange() {
// int first_index = -1;
// destinationController.destination_index_data.forEach((element) {
// //print(element["index"]);
// int action_id = destinationController.destinations[element["index"]]["id"] as int;
// destinationController.makeOrder(action_id, (element["index"] as int) + 1, "up");
// void interChange() {
// // int first_index = -1;
// // destinationController.destination_index_data.forEach((element) {
// // //print(element["index"]);
// // int action_id = destinationController.destinations[element["index"]]["id"] as int;
// // destinationController.makeOrder(action_id, (element["index"] as int) + 1, "up");
// });
}
// // });
// }
@override
Widget build(BuildContext context) {
// @override
// Widget build(BuildContext context) {
print("------ destination widget------ ${destinationController.destinationCount.value} ----------");
// print("------ destination widget------ ${destinationController.destinationCount.value} ----------");
return
Obx(() =>
Stack(
children: [
Padding(
padding: const EdgeInsets.only(top:45.0),
child: ListView.builder(
itemCount: destinationController.destinationCount.value,
// return
// Obx(() =>
// Stack(
// children: [
// Padding(
// padding: const EdgeInsets.only(top:45.0),
// child: ListView.builder(
// itemCount: destinationController.destinationCount.value,
itemBuilder: (BuildContext context, int index) {
return
TimelineTile(
alignment: TimelineAlign.manual,
lineXY: 0.2,
isFirst: index == 0 ? true : false,
indicatorStyle: IndicatorStyle(
color: index == 0 ? (Colors.red) : (Colors.grey[400])!
),
key: Key(index.toString()),
endChild: Card(
child: Container(
constraints: const BoxConstraints(
minHeight: 80,
),
child: ListTile(
onTap: () async {
{
Destination? fs = destinationController.destinations[index];
print("----fsf-----${fs}");
if(fs != null){
// itemBuilder: (BuildContext context, int index) {
// return
// TimelineTile(
// alignment: TimelineAlign.manual,
// lineXY: 0.2,
// isFirst: index == 0 ? true : false,
// indicatorStyle: IndicatorStyle(
// color: index == 0 ? (Colors.red) : (Colors.grey[400])!
// ),
// key: Key(index.toString()),
// endChild: Card(
// child: Container(
// constraints: const BoxConstraints(
// minHeight: 80,
// ),
// child: ListTile(
// onTap: () async {
// {
// Destination? fs = destinationController.destinations[index];
// print("----fsf-----${fs}");
// if(fs != null){
if(indexController.currentDestinationFeature.length > 0) {
indexController.currentDestinationFeature.clear();
}
indexController.currentDestinationFeature.add(fs);
//indexController.getAction();
// if(indexController.currentDestinationFeature.length > 0) {
// indexController.currentDestinationFeature.clear();
// }
// indexController.currentDestinationFeature.add(fs);
// //indexController.getAction();
showModalBottomSheet(context: context, isScrollControlled: true,
//builder:((context) => BottomSheetWidget())
builder:((context) => BottomSheetNew())
);
}
};
},
onLongPress: (){
// showModalBottomSheet(context: context, isScrollControlled: true,
// //builder:((context) => BottomSheetWidget())
// builder:((context) => BottomSheetNew())
// );
// }
// };
// },
// onLongPress: (){
Destination? match_element = null;
destinationController.currentSelectedDestinations.forEach((element) {
if(element.location_id == destinationController.destinations[index].location_id){
match_element = element;
return;
}
});
// Destination? match_element = null;
// destinationController.currentSelectedDestinations.forEach((element) {
// if(element.location_id == destinationController.destinations[index].location_id){
// match_element = element;
// return;
// }
// });
if(match_element != null){
destinationController.currentSelectedDestinations.remove(destinationController.destinations[index]);
}
// if(match_element != null){
// destinationController.currentSelectedDestinations.remove(destinationController.destinations[index]);
// }
destinationController.currentSelectedDestinations.add(destinationController.destinations[index]);
// destinationController.currentSelectedDestinations.add(destinationController.destinations[index]);
destinationController.PopulateDestinations();
// destinationController.PopulateDestinations();
},
selectedTileColor: Colors.amberAccent,
selected:destinationController.destinations[index].selected!,
leading: getImage(index),
title: Text(destinationController.destinations[index].name!),
subtitle: Text(destinationController.destinations[index].category!),
),
),
),
startChild:
destinationController.matrix["rows"][0]["elements"] != null ?
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
//Text(destinationController.matrix["rows"][0]["elements"][index]["distance"]["text"].toString()),
//Text(destinationController.matrix["rows"][0]["elements"][index]["duration"]["text"].toString())
],
):
Container()
,
);
// },
// selectedTileColor: Colors.amberAccent,
// selected:destinationController.destinations[index].selected!,
// leading: getImage(index),
// title: Text(destinationController.destinations[index].name!),
// subtitle: Text(destinationController.destinations[index].category!),
// ),
// ),
// ),
// startChild:
// destinationController.matrix["rows"][0]["elements"] != null ?
// Column(
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// children: [
// //Text(destinationController.matrix["rows"][0]["elements"][index]["distance"]["text"].toString()),
// //Text(destinationController.matrix["rows"][0]["elements"][index]["duration"]["text"].toString())
// ],
// ):
// Container()
// ,
// );
}
),
),
Container(
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.3),
spreadRadius: 5,
blurRadius: 3,
offset: Offset(0, 7), // changes position of shadow
),
],
),
height: 44.0,
width: MediaQuery.of(context).size.width,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
icon:Icon(Icons.cancel),
//onPressed: (){doDelete();},
onPressed: destinationController.currentSelectedDestinations.length > 0 ? doDelete : null,
),
IconButton(
icon:Icon(Icons.move_up),
onPressed: destinationController.destination_index_data.length > 0 ? moveUp : null,
),
IconButton(
icon:Icon(Icons.move_down),
onPressed: destinationController.destination_index_data.length > 0 ? moveDown : null,
),
IconButton(
icon:Icon(Icons.sync),
onPressed: destinationController.destination_index_data.length == 2 ? interChange : null,
),
],
),
)
],
)
);
}
}
// }
// ),
// ),
// Container(
// decoration: BoxDecoration(
// boxShadow: [
// BoxShadow(
// color: Colors.grey.withOpacity(0.3),
// spreadRadius: 5,
// blurRadius: 3,
// offset: Offset(0, 7), // changes position of shadow
// ),
// ],
// ),
// height: 44.0,
// width: MediaQuery.of(context).size.width,
// child: Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// IconButton(
// icon:Icon(Icons.cancel),
// //onPressed: (){doDelete();},
// onPressed: destinationController.currentSelectedDestinations.length > 0 ? doDelete : null,
// ),
// IconButton(
// icon:Icon(Icons.move_up),
// onPressed: destinationController.destination_index_data.length > 0 ? moveUp : null,
// ),
// IconButton(
// icon:Icon(Icons.move_down),
// onPressed: destinationController.destination_index_data.length > 0 ? moveDown : null,
// ),
// IconButton(
// icon:Icon(Icons.sync),
// onPressed: destinationController.destination_index_data.length == 2 ? interChange : null,
// ),
// ],
// ),
// )
// ],
// )
// );
// }
// }

View File

@ -1,45 +1,45 @@
import 'package:flutter/material.dart';
import 'package:rogapp/pages/search/search_page.dart';
// import 'package:flutter/material.dart';
// import 'package:rogapp/pages/search/search_page.dart';
class FakeSearch extends StatelessWidget {
const FakeSearch({
Key? key,
}) : super(key: key);
// class FakeSearch extends StatelessWidget {
// const FakeSearch({
// Key? key,
// }) : super(key: key);
@override
Widget build(BuildContext context) {
return InkWell(
onTap: (){
Navigator.push(context, MaterialPageRoute(builder: (context) => SearchPage()));
},
child: Container(
height: 35,
decoration: BoxDecoration(
border: Border.all(color:Colors.blue, width: 1.4),
borderRadius: BorderRadius.circular(25)
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0),
child: Icon(Icons.search, color: Colors.grey,),
),
const Text("What are you looking for", style: TextStyle(fontSize: 16, color: Colors.grey),),
Container(
height: 32,
width: 75,
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(25),
// @override
// Widget build(BuildContext context) {
// return InkWell(
// onTap: (){
// Navigator.push(context, MaterialPageRoute(builder: (context) => SearchPage()));
// },
// child: Container(
// height: 35,
// decoration: BoxDecoration(
// border: Border.all(color:Colors.blue, width: 1.4),
// borderRadius: BorderRadius.circular(25)
// ),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// const Padding(
// padding: EdgeInsets.symmetric(horizontal: 8.0),
// child: Icon(Icons.search, color: Colors.grey,),
// ),
// const Text("What are you looking for", style: TextStyle(fontSize: 16, color: Colors.grey),),
// Container(
// height: 32,
// width: 75,
// decoration: BoxDecoration(
// color: Colors.blue,
// borderRadius: BorderRadius.circular(25),
),
child: const Center(child: Text("Search", style: TextStyle(fontSize: 16, color: Colors.white),)),
)
// ),
// child: const Center(child: Text("Search", style: TextStyle(fontSize: 16, color: Colors.white),)),
// )
],
),
),
);
}
}
// ],
// ),
// ),
// );
// }
// }

View File

@ -1,63 +1,63 @@
import 'package:flutter/material.dart';
import 'package:geojson/geojson.dart';
import 'package:get/get.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/widgets/bottom_sheet_new.dart';
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
// import 'package:flutter/material.dart';
// import 'package:geojson/geojson.dart';
// import 'package:get/get.dart';
// import 'package:rogapp/pages/index/index_controller.dart';
// import 'package:rogapp/widgets/bottom_sheet_new.dart';
// import 'package:rogapp/widgets/bottom_sheet_widget.dart';
class ListWidget extends StatelessWidget {
ListWidget({ Key? key }) : super(key: key);
// class ListWidget extends StatelessWidget {
// ListWidget({ Key? key }) : super(key: key);
final IndexController indexController = Get.find<IndexController>();
// final IndexController indexController = Get.find<IndexController>();
Image getImage(int index){
if(indexController.locations[0].collection[index].properties!["photos"] == null || indexController.locations[0].collection[index].properties!["photos"] == ""){
return Image(image: AssetImage('assets/images/empty_image.png'));
}
else{
return Image(
image: NetworkImage(indexController.locations[0].collection[index].properties!["photos"]),
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset("assets/images/empty_image.png");
},
);
}
}
// Image getImage(int index){
// if(indexController.locations[0].collection[index].properties!["photos"] == null || indexController.locations[0].collection[index].properties!["photos"] == ""){
// return Image(image: AssetImage('assets/images/empty_image.png'));
// }
// else{
// return Image(
// image: NetworkImage(indexController.locations[0].collection[index].properties!["photos"]),
// errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
// return Image.asset("assets/images/empty_image.png");
// },
// );
// }
// }
void changeCurrentFeature(GeoJsonFeature fs){
if(indexController.currentFeature.length > 0){
indexController.currentFeature.clear();
}
indexController.currentFeature.add(fs);
}
// void changeCurrentFeature(GeoJsonFeature fs){
// if(indexController.currentFeature.length > 0){
// indexController.currentFeature.clear();
// }
// indexController.currentFeature.add(fs);
// }
@override
Widget build(BuildContext context) {
return Obx(() =>
indexController.locations.length > 0 ?
ListView.builder(
itemCount: indexController.locations[0].collection.length,
shrinkWrap: true,
itemBuilder: (_, index){
return Card(
child: ListTile(
onTap: (){
GeoJsonFeature gf = indexController.locations[0].collection[index];
changeCurrentFeature(gf);
showModalBottomSheet(
isScrollControlled: true,
context: context,
//builder: (context) => BottomSheetWidget(),
builder:((context) => BottomSheetNew())
);
},
leading: getImage(index),
title: indexController.locations[0].collection[index].properties!['location_name'] != null ? Text(indexController.locations[0].collection[index].properties!['location_name'].toString()) : Text(""),
subtitle: indexController.locations[0].collection[index].properties!['category'] != null ? Text(indexController.locations[0].collection[index].properties!['category']) : Text(""),
),
);
},
) : Container(width: 0, height: 0,),
);
}
}
// @override
// Widget build(BuildContext context) {
// return Obx(() =>
// indexController.locations.length > 0 ?
// ListView.builder(
// itemCount: indexController.locations[0].collection.length,
// shrinkWrap: true,
// itemBuilder: (_, index){
// return Card(
// child: ListTile(
// onTap: (){
// GeoJsonFeature gf = indexController.locations[0].collection[index];
// changeCurrentFeature(gf);
// showModalBottomSheet(
// isScrollControlled: true,
// context: context,
// //builder: (context) => BottomSheetWidget(),
// builder:((context) => BottomSheetNew())
// );
// },
// leading: getImage(index),
// title: indexController.locations[0].collection[index].properties!['location_name'] != null ? Text(indexController.locations[0].collection[index].properties!['location_name'].toString()) : Text(""),
// subtitle: indexController.locations[0].collection[index].properties!['category'] != null ? Text(indexController.locations[0].collection[index].properties!['category']) : Text(""),
// ),
// );
// },
// ) : Container(width: 0, height: 0,),
// );
// }
// }

View File

@ -1,150 +1,150 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_map/plugin_api.dart';
import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
import 'package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart';2
import 'package:get/get.dart';
import 'package:get/get_state_manager/get_state_manager.dart';
import 'package:latlong2/latlong.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/widgets/base_layer_widget.dart';
import 'package:rogapp/widgets/bottom_sheet_new.dart';
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
// import 'dart:async';
// import 'package:flutter/material.dart';
// import 'package:flutter_map/plugin_api.dart';
// import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
// import 'package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart';2
// import 'package:get/get.dart';
// import 'package:get/get_state_manager/get_state_manager.dart';
// import 'package:latlong2/latlong.dart';
// import 'package:rogapp/pages/index/index_controller.dart';
// import 'package:rogapp/widgets/base_layer_widget.dart';
// import 'package:rogapp/widgets/bottom_sheet_new.dart';
// import 'package:rogapp/widgets/bottom_sheet_widget.dart';
class MapWidget extends StatelessWidget {
// class MapWidget extends StatelessWidget {
final IndexController indexController = Get.find<IndexController>();
// final IndexController indexController = Get.find<IndexController>();
MapWidget({ Key? key}) : super(key: key);
// MapWidget({ Key? key}) : super(key: key);
StreamSubscription? subscription;
// StreamSubscription? subscription;
@override
Widget build(BuildContext context) {
// @override
// Widget build(BuildContext context) {
print("---------- rog mode is ${indexController.rog_mode.value.toString()}----------");
// print("---------- rog mode is ${indexController.rog_mode.value.toString()}----------");
final PopupController _popupController = PopupController();
return Stack(
children: [
Obx(() =>
indexController.is_loading == true ? Padding(
padding: const EdgeInsets.only(top: 60.0),
child: CircularProgressIndicator(),
):
FlutterMap(
//mapController: mapController,
options: MapOptions(
onMapCreated: (c){
indexController.mapController = c;
// final PopupController _popupController = PopupController();
// return Stack(
// children: [
// Obx(() =>
// indexController.is_loading == true ? Padding(
// padding: const EdgeInsets.only(top: 60.0),
// child: CircularProgressIndicator(),
// ):
// FlutterMap(
// //mapController: mapController,
// options: MapOptions(
// onMapCreated: (c){
// indexController.mapController = c;
indexController.mapController!.onReady.then((_) {
indexController.is_mapController_loaded.value = true;
subscription = indexController.mapController!.mapEventStream.listen((MapEvent mapEvent) {
if (mapEvent is MapEventMoveStart) {
//print(DateTime.now().toString() + ' [MapEventMoveStart] START');
// do something
}
if (mapEvent is MapEventMoveEnd) {
//print(DateTime.now().toString() + ' [MapEventMoveStart] END');
indexController.loadLocationsBound();
}
});
});
// indexController.mapController!.onReady.then((_) {
// indexController.is_mapController_loaded.value = true;
// subscription = indexController.mapController!.mapEventStream.listen((MapEvent mapEvent) {
// if (mapEvent is MapEventMoveStart) {
// //print(DateTime.now().toString() + ' [MapEventMoveStart] START');
// // do something
// }
// if (mapEvent is MapEventMoveEnd) {
// //print(DateTime.now().toString() + ' [MapEventMoveStart] END');
// indexController.loadLocationsBound();
// }
// });
// });
},
//center: LatLng(37.15319600454702, 139.58765950528198),
bounds: indexController.currentBound.length > 0 ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]),
zoom: 1,
maxZoom: 24,
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
plugins: [
MarkerClusterPlugin(),
],
// },
// //center: LatLng(37.15319600454702, 139.58765950528198),
// bounds: indexController.currentBound.length > 0 ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]),
// zoom: 1,
// maxZoom: 24,
// interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
// plugins: [
// MarkerClusterPlugin(),
// ],
onPositionChanged: (MapPosition pos, isvalue){
},
onTap: (_, __) =>
_popupController
.hideAllPopups(), // Hide popup when the map is tapped.
),
children: [
BaseLayer(),
LocationMarkerLayerWidget(),
// onPositionChanged: (MapPosition pos, isvalue){
// },
// onTap: (_, __) =>
// _popupController
// .hideAllPopups(), // Hide popup when the map is tapped.
// ),
// children: [
// BaseLayer(),
// LocationMarkerLayerWidget(),
indexController.locations.length > 0 ?
MarkerClusterLayerWidget(
options: MarkerClusterLayerOptions(
spiderfyCircleRadius: 0,
spiderfySpiralDistanceMultiplier: 2,
circleSpiralSwitchover: 12,
maxClusterRadius: 0,
rotate: true,
onMarkerTap: (marker){
GeoJsonFeature? fs = indexController.getFeatureForLatLong(marker.point.latitude, marker.point.longitude);
//print("------- fs ${fs}------");
if(fs != null){
indexController.currentFeature.clear();
indexController.currentFeature.add(fs);
//print("----- fs is ${fs.properties!['photos']}");
indexController.getAction();
// indexController.locations.length > 0 ?
// MarkerClusterLayerWidget(
// options: MarkerClusterLayerOptions(
// spiderfyCircleRadius: 0,
// spiderfySpiralDistanceMultiplier: 2,
// circleSpiralSwitchover: 12,
// maxClusterRadius: 0,
// rotate: true,
// onMarkerTap: (marker){
// GeoJsonFeature? fs = indexController.getFeatureForLatLong(marker.point.latitude, marker.point.longitude);
// //print("------- fs ${fs}------");
// if(fs != null){
// indexController.currentFeature.clear();
// indexController.currentFeature.add(fs);
// //print("----- fs is ${fs.properties!['photos']}");
// indexController.getAction();
showModalBottomSheet(
context: context,
isScrollControlled: true,
isDismissible: true,
builder:((context) => BottomSheetNew())
//builder:((context) => BottomSheetWidget())
);
}
// showModalBottomSheet(
// context: context,
// isScrollControlled: true,
// isDismissible: true,
// builder:((context) => BottomSheetNew())
// //builder:((context) => BottomSheetWidget())
// );
// }
},
// },
size: Size(40, 40),
anchor: AnchorPos.align(AnchorAlign.center),
fitBoundsOptions: const FitBoundsOptions(
padding: EdgeInsets.all(50),
maxZoom: 265,
),
markers:indexController.locations[0].collection.map((i) {
print("i si ${i.properties!['location_id']}");
GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
print("lat is ${p.geoSerie!.geoPoints[0].latitude} and lon is ${p.geoSerie!.geoPoints[0].longitude}");
return Marker(
anchorPos: AnchorPos.align(AnchorAlign.center),
height: 22.0,
width: 22.0,
point: LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude),
builder: (ctx) => Icon(Icons.pin_drop),
// builder: (ctx) => i.properties!["category"] != null ?
// ImageIcon(
// AssetImage("assets/images/${i.properties!["category"]}.png"),
// color: Color(0xFF3A5A98),
// size:12.0,
// )
// : Icon(Icons.pin_drop),
// size: Size(40, 40),
// anchor: AnchorPos.align(AnchorAlign.center),
// fitBoundsOptions: const FitBoundsOptions(
// padding: EdgeInsets.all(50),
// maxZoom: 265,
// ),
// markers:indexController.locations[0].collection.map((i) {
// print("i si ${i.properties!['location_id']}");
// GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
// print("lat is ${p.geoSerie!.geoPoints[0].latitude} and lon is ${p.geoSerie!.geoPoints[0].longitude}");
// return Marker(
// anchorPos: AnchorPos.align(AnchorAlign.center),
// height: 22.0,
// width: 22.0,
// point: LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude),
// builder: (ctx) => Icon(Icons.pin_drop),
// // builder: (ctx) => i.properties!["category"] != null ?
// // ImageIcon(
// // AssetImage("assets/images/${i.properties!["category"]}.png"),
// // color: Color(0xFF3A5A98),
// // size:12.0,
// // )
// // : Icon(Icons.pin_drop),
);
}).toList(),
builder: (context, markers) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20.0),
color: Colors.blue),
child: Center(
child: Text(
markers.length.toString(),
style: TextStyle(color: Colors.white),
),
),
);
},
),
): Container(height:0,width: 0),
],
)
)
],
);
}
}
// );
// }).toList(),
// builder: (context, markers) {
// return Container(
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(20.0),
// color: Colors.blue),
// child: Center(
// child: Text(
// markers.length.toString(),
// style: TextStyle(color: Colors.white),
// ),
// ),
// );
// },
// ),
// ): Container(height:0,width: 0),
// ],
// )
// )
// ],
// );
// }
// }

View File

@ -1,265 +1,44 @@
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:get/get.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/widgets/cat_widget.dart';
// import 'package:flutter/material.dart';
// import 'package:flutter_map/flutter_map.dart';
// import 'package:get/get.dart';
// import 'package:rogapp/pages/index/index_controller.dart';
// import 'package:rogapp/widgets/cat_widget.dart';
class PerfectureWidget extends StatefulWidget {
// class PerfectureWidget extends StatefulWidget {
IndexController indexController;
MapController mapController;
PerfectureWidget({Key? key, required this.indexController, required this.mapController}) : super(key: key){
//indexController.zoomtoMainPerf("9", mapController);
}
@override
State<PerfectureWidget> createState() => _PerfectureWidgetState();
}
class _PerfectureWidgetState extends State<PerfectureWidget> {
@override
void initState() {
super.initState();
}
bool isNumeric(String s) {
if (s == null) {
return false;
}
return double.tryParse(s) != null;
}
List<DropdownMenuItem<String>> getDropdownItems() {
List<DropdownMenuItem<String>> dropDownItems = [];
for (Map<String, dynamic> currency in widget.indexController.perfectures[0]) {
//print(currency["id"].toString());
var newDropdown = DropdownMenuItem(
child: Text(currency["adm1_ja"].toString()),
value: currency["id"].toString(),
);
dropDownItems.add(newDropdown);
}
return dropDownItems;
}
List<DropdownMenuItem<String>> getSubDropdownItems() {
List<DropdownMenuItem<String>> dropDownItems = [];
if(widget.indexController.subPerfs.isNotEmpty){
for (Map<String, dynamic> currency in widget.indexController.subPerfs[0]) {
var newDropdown = DropdownMenuItem(
child: Text(currency["adm2_ja"].toString()),
value: currency["id"].toString(),
);
dropDownItems.add(newDropdown);
}
}
return dropDownItems;
}
List<DropdownMenuItem<String>> getCustomArea(){
List<DropdownMenuItem<String>> dropDownItems = [];
if(widget.indexController.areas.isNotEmpty){
for (Map<String, dynamic> currency in widget.indexController.areas[0]) {
var newDropdown = DropdownMenuItem(
child: Text(currency["area_nm"].toString()),
value: currency["id"].toString(),
);
dropDownItems.add(newDropdown);
}
}
if(widget.indexController.customAreas.isNotEmpty){
for (Map<String, dynamic> currency in widget.indexController.customAreas[0]) {
var newDropdown = DropdownMenuItem(
child: Text(currency["event_name"].toString()),
value: currency["event_name"].toString(),
);
dropDownItems.add(newDropdown);
}
}
return dropDownItems;
}
List<DropdownMenuItem<String>> getCategory(){
List<DropdownMenuItem<String>> dropDownItems = [];
dropDownItems.clear();
//print("--------cats ------############### ${widget.indexController.cats.toString()} -------------");
for(dynamic d in widget.indexController.cats){
//print("-------- ddd ------############### ${d} --------dddd-----");
var newDropdown = DropdownMenuItem(child: Text(d['category'].toString()), value: d['category'].toString());
//print("--------cats ------############### ${d['category'].toString()} -------------");
dropDownItems.add(newDropdown);
}
//return [];
return dropDownItems;
}
@override
Widget build(BuildContext context) {
return Obx(() =>
Row(
children: [
DropdownButton<String>(
value: widget.indexController.dropdownValue,
icon: const Icon(Icons.arrow_downward),
elevation: 16,
style: const TextStyle(color: Colors.deepPurple),
underline: Container(
height: 2,
color: Colors.deepPurpleAccent,
),
onChanged: (String? newValue) {
//setState(() {
if(newValue != null){
widget.indexController.is_loading.value = true;
widget.indexController.dropdownValue = newValue;
widget.indexController.populateForPerf(newValue, widget.mapController);
}
//});
},
items: getDropdownItems()
),
// Gifu areas
widget.indexController.areas.isNotEmpty ?
DropdownButton<String>(
value: widget.indexController.areaDropdownValue,
icon: const Icon(Icons.arrow_downward),
elevation: 16,
style: const TextStyle(color: Colors.deepPurple),
hint: const Text("select"),
underline: Container(
height: 2,
color: Colors.deepPurpleAccent,
),
onChanged: (String? newValue) {
if (isNumeric(newValue!)){
widget.indexController.is_custom_area_selected.value = false;
}
else{
widget.indexController.loadCustomLocation(newValue);
widget.indexController.is_custom_area_selected.value = true;
widget.indexController.subPerfs.clear();
widget.indexController.cats.clear();
}
setState(() {
widget.indexController.locations.clear();
if(newValue != null){
widget.indexController.is_loading.value = true;
widget.indexController.areaDropdownValue = newValue;
widget.indexController.populateSubPerForArea(newValue, widget.mapController);
}
});
},
items: getCustomArea(),
): const Text(""),
widget.indexController.subPerfs.isNotEmpty ?
DropdownButton<String>(
value: widget.indexController.subDropdownValue,
icon: const Icon(Icons.arrow_downward),
elevation: 16,
style: const TextStyle(color: Colors.deepPurple),
hint: const Text("select"),
underline: Container(
height: 2,
color: Colors.deepPurpleAccent,
),
onChanged: (String? newValue) {
setState(() {
if(newValue != null){
//widget.indexController.is_loading.value = true;
//widget.indexController.populateForSubPerf(newValue, widget.mapController);
//widget.indexController.loadLocationforSubPerf(newValue, widget.mapController);
widget.indexController.subDropdownValue = newValue;
widget.indexController.loadCatForCity(newValue);
}
});
},
items:
getSubDropdownItems()
) :
const Text(""),
//CatWidget(indexController: widget.indexController,),
widget.indexController.cats.length > 0 ?
DropdownButton<String>(
value: widget.indexController.cateogory,
icon: const Icon(Icons.arrow_downward),
elevation: 16,
style: const TextStyle(color: Colors.deepPurple),
hint: const Text("select"),
underline: Container(
height: 2,
color: Colors.deepPurpleAccent,
),
onChanged: (String? newValue) {
setState(() {
if(newValue != null){
widget.indexController.is_loading.value = true;
widget.indexController.cateogory = newValue;
widget.indexController.currentCat.clear();
widget.indexController.currentCat.add(newValue);
widget.indexController.populateForSubPerf(widget.indexController.subDropdownValue, widget.mapController);
//widget.indexController.loadLocationforSubPerf(newValue, widget.mapController);
//widget.indexController.subDropdownValue = newValue;
}
});
},
items:
getCategory(),
)
:
Container(),
],
),
);
}
}
// class PerfectureWidget extends StatefulWidget {
// HomeController homeController;
// IndexController indexController;
// MapController mapController;
// PerfectureWidget({required this.homeController, required this.mapController});
// PerfectureWidget({Key? key, required this.indexController, required this.mapController}) : super(key: key){
// //indexController.zoomtoMainPerf("9", mapController);
// }
// @override
// State<PerfectureWidget> createState() => _PerfectureWidgetState();
// }
// class _PerfectureWidgetState extends State<PerfectureWidget> {
// String dropdownValue = "9";
// @override
// void initState() {
// super.initState();
// }
// bool isNumeric(String s) {
// if (s == null) {
// return false;
// }
// return double.tryParse(s) != null;
// }
// List<DropdownMenuItem<String>> getDropdownItems() {
// List<DropdownMenuItem<String>> dropDownItems = [];
// for (Map<String, dynamic> currency in widget.homeController.perfectures[0]) {
// for (Map<String, dynamic> currency in widget.indexController.perfectures[0]) {
// //print(currency["id"].toString());
// var newDropdown = DropdownMenuItem(
// child: Text(currency["adm1_ja"].toString()),
@ -274,9 +53,9 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
// List<DropdownMenuItem<String>> getSubDropdownItems() {
// List<DropdownMenuItem<String>> dropDownItems = [];
// if(widget.homeController.subPerfs.length > 0){
// if(widget.indexController.subPerfs.isNotEmpty){
// for (Map<String, dynamic> currency in widget.homeController.subPerfs[0]) {
// for (Map<String, dynamic> currency in widget.indexController.subPerfs[0]) {
// var newDropdown = DropdownMenuItem(
// child: Text(currency["adm2_ja"].toString()),
// value: currency["id"].toString(),
@ -288,11 +67,53 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
// return dropDownItems;
// }
// @override
// void initState() {
// super.initState();
// widget.homeController.loadSubPerfFor("9");
// widget.homeController.zoomtoMainPerf("9", widget.mapController);
// List<DropdownMenuItem<String>> getCustomArea(){
// List<DropdownMenuItem<String>> dropDownItems = [];
// if(widget.indexController.areas.isNotEmpty){
// for (Map<String, dynamic> currency in widget.indexController.areas[0]) {
// var newDropdown = DropdownMenuItem(
// child: Text(currency["area_nm"].toString()),
// value: currency["id"].toString(),
// );
// dropDownItems.add(newDropdown);
// }
// }
// if(widget.indexController.customAreas.isNotEmpty){
// for (Map<String, dynamic> currency in widget.indexController.customAreas[0]) {
// var newDropdown = DropdownMenuItem(
// child: Text(currency["event_name"].toString()),
// value: currency["event_name"].toString(),
// );
// dropDownItems.add(newDropdown);
// }
// }
// return dropDownItems;
// }
// List<DropdownMenuItem<String>> getCategory(){
// List<DropdownMenuItem<String>> dropDownItems = [];
// dropDownItems.clear();
// //print("--------cats ------############### ${widget.indexController.cats.toString()} -------------");
// for(dynamic d in widget.indexController.cats){
// //print("-------- ddd ------############### ${d} --------dddd-----");
// var newDropdown = DropdownMenuItem(child: Text(d['category'].toString()), value: d['category'].toString());
// //print("--------cats ------############### ${d['category'].toString()} -------------");
// dropDownItems.add(newDropdown);
// }
// //return [];
// return dropDownItems;
// }
// @override
@ -302,7 +123,7 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
// Row(
// children: [
// DropdownButton<String>(
// value: dropdownValue,
// value: widget.indexController.dropdownValue,
// icon: const Icon(Icons.arrow_downward),
// elevation: 16,
// style: const TextStyle(color: Colors.deepPurple),
@ -313,45 +134,105 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
// onChanged: (String? newValue) {
// //setState(() {
// if(newValue != null){
// dropdownValue = newValue;
// widget.homeController.loadLocationforPerf(newValue, widget.mapController);
// widget.homeController.loadSubPerfFor(newValue);
// //SubDropdownValue = widget.homeController.getSubInitialVal();
// //widget.mapController.fitBounds(widget.homeController.currentBound[0]);
// widget.homeController.zoomtoMainPerf(newValue, widget.mapController);
// widget.indexController.is_loading.value = true;
// widget.indexController.dropdownValue = newValue;
// widget.indexController.populateForPerf(newValue, widget.mapController);
// }
// //});
// },
// items: getDropdownItems()
// ),
// widget.homeController.subPerfs.length > 0 ?
// // Gifu areas
// widget.indexController.areas.isNotEmpty ?
// DropdownButton<String>(
// value: widget.homeController.SubDropdownValue,
// value: widget.indexController.areaDropdownValue,
// icon: const Icon(Icons.arrow_downward),
// elevation: 16,
// style: const TextStyle(color: Colors.deepPurple),
// hint: const Text("select"),
// underline: Container(
// height: 2,
// color: Colors.deepPurpleAccent,
// ),
// onChanged: (String? newValue) {
// if (isNumeric(newValue!)){
// widget.indexController.is_custom_area_selected.value = false;
// }
// else{
// widget.indexController.loadCustomLocation(newValue);
// widget.indexController.is_custom_area_selected.value = true;
// widget.indexController.subPerfs.clear();
// widget.indexController.cats.clear();
// }
// setState(() {
// widget.indexController.locations.clear();
// if(newValue != null){
// widget.indexController.is_loading.value = true;
// widget.indexController.areaDropdownValue = newValue;
// widget.indexController.populateSubPerForArea(newValue, widget.mapController);
// }
// });
// },
// items: getCustomArea(),
// ): const Text(""),
// widget.indexController.subPerfs.isNotEmpty ?
// DropdownButton<String>(
// value: widget.indexController.subDropdownValue,
// icon: const Icon(Icons.arrow_downward),
// elevation: 16,
// style: const TextStyle(color: Colors.deepPurple),
// hint: Container(
// child: Text("select"),
// ),
// hint: const Text("select"),
// underline: Container(
// height: 2,
// color: Colors.deepPurpleAccent,
// ),
// onChanged: (String? newValue) {
// //setState(() {
// setState(() {
// if(newValue != null){
// widget.homeController.loadLocationforSubPerf(newValue, widget.mapController);
// widget.homeController.SubDropdownValue = newValue;
// widget.homeController.zoomtoSubPerf(newValue, widget.mapController);
// //widget.indexController.is_loading.value = true;
// //widget.indexController.populateForSubPerf(newValue, widget.mapController);
// //widget.indexController.loadLocationforSubPerf(newValue, widget.mapController);
// widget.indexController.subDropdownValue = newValue;
// widget.indexController.loadCatForCity(newValue);
// }
// //});
// });
// },
// items:
// getSubDropdownItems()
// ) :
// Text("")
// const Text(""),
// //CatWidget(indexController: widget.indexController,),
// widget.indexController.cats.length > 0 ?
// DropdownButton<String>(
// value: widget.indexController.cateogory,
// icon: const Icon(Icons.arrow_downward),
// elevation: 16,
// style: const TextStyle(color: Colors.deepPurple),
// hint: const Text("select"),
// underline: Container(
// height: 2,
// color: Colors.deepPurpleAccent,
// ),
// onChanged: (String? newValue) {
// setState(() {
// if(newValue != null){
// widget.indexController.is_loading.value = true;
// widget.indexController.cateogory = newValue;
// widget.indexController.currentCat.clear();
// widget.indexController.currentCat.add(newValue);
// widget.indexController.populateForSubPerf(widget.indexController.subDropdownValue, widget.mapController);
// //widget.indexController.loadLocationforSubPerf(newValue, widget.mapController);
// //widget.indexController.subDropdownValue = newValue;
// }
// });
// },
// items:
// getCategory(),
// )
// :
// Container(),
// ],
// ),
@ -359,3 +240,122 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
// }
// }
// // class PerfectureWidget extends StatefulWidget {
// // HomeController homeController;
// // MapController mapController;
// // PerfectureWidget({required this.homeController, required this.mapController});
// // @override
// // State<PerfectureWidget> createState() => _PerfectureWidgetState();
// // }
// // class _PerfectureWidgetState extends State<PerfectureWidget> {
// // String dropdownValue = "9";
// // List<DropdownMenuItem<String>> getDropdownItems() {
// // List<DropdownMenuItem<String>> dropDownItems = [];
// // for (Map<String, dynamic> currency in widget.homeController.perfectures[0]) {
// // //print(currency["id"].toString());
// // var newDropdown = DropdownMenuItem(
// // child: Text(currency["adm1_ja"].toString()),
// // value: currency["id"].toString(),
// // );
// // dropDownItems.add(newDropdown);
// // }
// // return dropDownItems;
// // }
// // List<DropdownMenuItem<String>> getSubDropdownItems() {
// // List<DropdownMenuItem<String>> dropDownItems = [];
// // if(widget.homeController.subPerfs.length > 0){
// // for (Map<String, dynamic> currency in widget.homeController.subPerfs[0]) {
// // var newDropdown = DropdownMenuItem(
// // child: Text(currency["adm2_ja"].toString()),
// // value: currency["id"].toString(),
// // );
// // dropDownItems.add(newDropdown);
// // }
// // }
// // return dropDownItems;
// // }
// // @override
// // void initState() {
// // super.initState();
// // widget.homeController.loadSubPerfFor("9");
// // widget.homeController.zoomtoMainPerf("9", widget.mapController);
// // }
// // @override
// // Widget build(BuildContext context) {
// // return Obx(() =>
// // Row(
// // children: [
// // DropdownButton<String>(
// // value: dropdownValue,
// // icon: const Icon(Icons.arrow_downward),
// // elevation: 16,
// // style: const TextStyle(color: Colors.deepPurple),
// // underline: Container(
// // height: 2,
// // color: Colors.deepPurpleAccent,
// // ),
// // onChanged: (String? newValue) {
// // //setState(() {
// // if(newValue != null){
// // dropdownValue = newValue;
// // widget.homeController.loadLocationforPerf(newValue, widget.mapController);
// // widget.homeController.loadSubPerfFor(newValue);
// // //SubDropdownValue = widget.homeController.getSubInitialVal();
// // //widget.mapController.fitBounds(widget.homeController.currentBound[0]);
// // widget.homeController.zoomtoMainPerf(newValue, widget.mapController);
// // }
// // //});
// // },
// // items: getDropdownItems()
// // ),
// // widget.homeController.subPerfs.length > 0 ?
// // DropdownButton<String>(
// // value: widget.homeController.SubDropdownValue,
// // icon: const Icon(Icons.arrow_downward),
// // elevation: 16,
// // style: const TextStyle(color: Colors.deepPurple),
// // hint: Container(
// // child: Text("select"),
// // ),
// // underline: Container(
// // height: 2,
// // color: Colors.deepPurpleAccent,
// // ),
// // onChanged: (String? newValue) {
// // //setState(() {
// // if(newValue != null){
// // widget.homeController.loadLocationforSubPerf(newValue, widget.mapController);
// // widget.homeController.SubDropdownValue = newValue;
// // widget.homeController.zoomtoSubPerf(newValue, widget.mapController);
// // }
// // //});
// // },
// // items:
// // getSubDropdownItems()
// // ) :
// // Text("")
// // ],
// // ),
// // );
// // }
// // }

View File

@ -14,7 +14,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.2"
version: "2.9.0"
boolean_selector:
dependency: transitive
description:
@ -28,21 +28,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
version: "1.2.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
collection:
dependency: "direct main"
description:
@ -77,7 +70,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.3.1"
ffi:
dependency: transitive
description:
@ -145,35 +138,35 @@ packages:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
version: "2.0.1"
flutter_map:
dependency: "direct main"
description:
name: flutter_map
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
version: "3.0.0"
flutter_map_location_marker:
dependency: "direct main"
description:
name: flutter_map_location_marker
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
version: "5.0.0+1"
flutter_map_marker_cluster:
dependency: "direct main"
description:
name: flutter_map_marker_cluster
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.0"
version: "1.0.1"
flutter_map_marker_popup:
dependency: transitive
description:
name: flutter_map_marker_popup
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
version: "4.0.0"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
@ -218,14 +211,14 @@ packages:
name: geolocator
url: "https://pub.dartlang.org"
source: hosted
version: "8.2.1"
version: "9.0.2"
geolocator_android:
dependency: transitive
description:
name: geolocator_android
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.1"
version: "4.1.4"
geolocator_apple:
dependency: transitive
description:
@ -372,7 +365,7 @@ packages:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "2.0.1"
lists:
dependency: transitive
description:
@ -386,28 +379,28 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.11"
version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
version: "0.1.5"
material_design_icons_flutter:
dependency: "direct main"
description:
name: material_design_icons_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.6595"
version: "6.0.7096"
meta:
dependency: "direct main"
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0"
mgrs_dart:
dependency: transitive
description:
@ -415,13 +408,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
nested:
dependency: transitive
description:
name: nested
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.2"
path_provider:
dependency: "direct main"
description:
@ -484,14 +484,35 @@ packages:
name: permission_handler
url: "https://pub.dartlang.org"
source: hosted
version: "8.3.0"
version: "10.2.0"
permission_handler_android:
dependency: transitive
description:
name: permission_handler_android
url: "https://pub.dartlang.org"
source: hosted
version: "10.2.0"
permission_handler_apple:
dependency: transitive
description:
name: permission_handler_apple
url: "https://pub.dartlang.org"
source: hosted
version: "9.0.7"
permission_handler_platform_interface:
dependency: transitive
description:
name: permission_handler_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "3.7.0"
version: "3.9.0"
permission_handler_windows:
dependency: transitive
description:
name: permission_handler_windows
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
platform:
dependency: transitive
description:
@ -540,7 +561,14 @@ packages:
name: proj4dart
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.1.0"
provider:
dependency: transitive
description:
name: provider
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.4"
quiver:
dependency: transitive
description:
@ -553,13 +581,20 @@ packages:
description: flutter
source: sdk
version: "0.0.99"
sliding_up_panel:
dependency: "direct main"
description:
name: sliding_up_panel
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0+1"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
version: "1.9.0"
sqflite:
dependency: "direct main"
description:
@ -601,7 +636,7 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
synchronized:
dependency: transitive
description:
@ -615,14 +650,14 @@ packages:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.9"
version: "0.4.12"
timeline_tile:
dependency: "direct main"
description:
@ -743,5 +778,5 @@ packages:
source: hosted
version: "0.2.0+1"
sdks:
dart: ">=2.17.0 <3.0.0"
flutter: ">=3.0.0"
dart: ">=2.17.5 <3.0.0"
flutter: ">=3.3.0"

View File

@ -36,9 +36,9 @@ dependencies:
cupertino_icons: ^1.0.2
sqflite: ^2.0.1
get: ^4.6.5
flutter_map: any
geolocator: ^8.0.1
permission_handler: ^8.3.0
flutter_map: ^3.0.0
geolocator: ^9.0.1
permission_handler: ^10.0.0
google_api_availability: ^3.0.1
tuple: ^2.0.0
latlong2: ^0.8.1
@ -53,7 +53,7 @@ dependencies:
path_provider: ^2.0.8
flutter_map_location_marker: any
flutter_map_marker_cluster: any
material_design_icons_flutter: ^5.0.6595
material_design_icons_flutter: ^6.0.7096
google_fonts: any
image_picker: ^0.8.4+4
geojson_vi: ^2.0.7
@ -66,6 +66,8 @@ dependencies:
flutter_polyline_points: ^1.0.0
google_maps_webservice: ^0.0.19
flutter_typeahead: ^4.0.0
sliding_up_panel: ^2.0.0+1
dev_dependencies:
@ -77,7 +79,7 @@ dev_dependencies:
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^1.0.0
flutter_lints: ^2.0.1
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

View File

@ -7,11 +7,14 @@
#include "generated_plugin_registrant.h"
#include <geolocator_windows/geolocator_windows.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
GeolocatorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("GeolocatorWindows"));
PermissionHandlerWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
}

View File

@ -4,6 +4,7 @@
list(APPEND FLUTTER_PLUGIN_LIST
geolocator_windows
permission_handler_windows
url_launcher_windows
)