update
This commit is contained in:
@ -2,19 +2,4 @@ import 'package:get/get.dart';
|
||||
|
||||
class LayerDrawerController extends GetxController {
|
||||
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,56 +13,54 @@ class DrawerPage extends StatelessWidget {
|
||||
// Add a ListView to the drawer. This ensures the user can scroll
|
||||
// through the options in the drawer if there isn't enough vertical
|
||||
// space to fit everything.
|
||||
child: Container(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 100,
|
||||
color: Colors.amber,
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.login),
|
||||
title: Text("login".tr),
|
||||
onTap: (){},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.password),
|
||||
title: Text("change_password".tr),
|
||||
onTap: (){},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.person),
|
||||
title: Text("profile".tr),
|
||||
onTap: (){},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.route),
|
||||
title: Text("recommended_route".tr),
|
||||
onTap: (){},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.favorite_rounded),
|
||||
title: Text("point_rank".tr),
|
||||
onTap: (){},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.featured_video),
|
||||
title: Text("game_rank".tr),
|
||||
onTap: (){},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.router),
|
||||
title: Text("my_route".tr),
|
||||
onTap: (){},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.history_sharp),
|
||||
title: Text("visit_history".tr),
|
||||
onTap: (){},
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 100,
|
||||
color: Colors.amber,
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.login),
|
||||
title: Text("login".tr),
|
||||
onTap: (){},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.password),
|
||||
title: Text("change_password".tr),
|
||||
onTap: (){},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.person),
|
||||
title: Text("profile".tr),
|
||||
onTap: (){},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.route),
|
||||
title: Text("recommended_route".tr),
|
||||
onTap: (){},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.favorite_rounded),
|
||||
title: Text("point_rank".tr),
|
||||
onTap: (){},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.featured_video),
|
||||
title: Text("game_rank".tr),
|
||||
onTap: (){},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.router),
|
||||
title: Text("my_route".tr),
|
||||
onTap: (){},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.history_sharp),
|
||||
title: Text("visit_history".tr),
|
||||
onTap: (){},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
import 'package:get/get_core/src/get_main.dart';
|
||||
import 'package:get/get_instance/src/bindings_interface.dart';
|
||||
import 'package:get/get_instance/src/extension_instance.dart';
|
||||
import 'package:rogapp/pages/home/home_controller.dart';
|
||||
|
||||
|
||||
class HomeBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.put<HomeController>(HomeController());
|
||||
}
|
||||
}
|
||||
13
lib/pages/home/home_binding_t.dart
Normal file
13
lib/pages/home/home_binding_t.dart
Normal file
@ -0,0 +1,13 @@
|
||||
// import 'package:flutter_map/flutter_map.dart';
|
||||
// import 'package:get/get_core/src/get_main.dart';
|
||||
// import 'package:get/get_instance/src/bindings_interface.dart';
|
||||
// import 'package:get/get_instance/src/extension_instance.dart';
|
||||
// import 'package:rogapp/pages/home/home_controller.dart';
|
||||
|
||||
|
||||
// class HomeBinding extends Bindings {
|
||||
// @override
|
||||
// void dependencies() {
|
||||
// Get.put<HomeController>(HomeController());
|
||||
// }
|
||||
// }
|
||||
@ -1,155 +0,0 @@
|
||||
|
||||
|
||||
import 'package:flutter_map/plugin_api.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:rogapp/pages/map/map_page.dart';
|
||||
import 'package:rogapp/services/location_service.dart';
|
||||
import 'package:rogapp/services/perfecture_service.dart';
|
||||
|
||||
class HomeController extends GetxController {
|
||||
|
||||
List<GeoJsonFeatureCollection> locations = <GeoJsonFeatureCollection>[].obs;
|
||||
List<GeoJsonFeature> currentFeature = <GeoJsonFeature>[].obs;
|
||||
List<dynamic> perfectures = <dynamic>[].obs;
|
||||
List<LatLngBounds> currentBound = <LatLngBounds>[].obs;
|
||||
List<dynamic> subPerfs = <dynamic>[].obs;
|
||||
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
LocationService.loadLocations().then((value){
|
||||
locations.add(value!);
|
||||
});
|
||||
|
||||
PerfectureService.loadPerfectures().then((value){
|
||||
perfectures.add(value);
|
||||
});
|
||||
|
||||
super.onInit();
|
||||
|
||||
}
|
||||
|
||||
void getBoundFromLatLng(List<LatLng> list) {
|
||||
double? x0, x1, y0, y1;
|
||||
for (LatLng latLng in list) {
|
||||
if (x0 == 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;
|
||||
}
|
||||
}
|
||||
currentBound.clear();
|
||||
currentBound.add(LatLngBounds(LatLng(x1!, y1!), LatLng(x0!, y0!)));
|
||||
}
|
||||
|
||||
void setBounds(){
|
||||
List<LatLng> lts = [];
|
||||
if(locations.length > 0){
|
||||
for(GeoJsonFeature i in locations[0].collection){
|
||||
GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
|
||||
LatLng lt = LatLng(p.geoSerie!.geoPoints[0].latitude , p.geoSerie!.geoPoints[0].longitude) ;
|
||||
lts.add(lt);
|
||||
}
|
||||
}
|
||||
else{
|
||||
LatLng lt = LatLng(37.15319600454702, 139.58765950528198);
|
||||
lts.add(lt);
|
||||
}
|
||||
getBoundFromLatLng(lts);
|
||||
}
|
||||
|
||||
void loadLocationforPerf(String perf){
|
||||
locations.clear();
|
||||
LocationService.loadLocationsFor(perf).then((value){
|
||||
locations.add(value!);
|
||||
setBounds();
|
||||
MapPage.mapController.fitBounds(currentBound[0]);
|
||||
});
|
||||
}
|
||||
|
||||
String getSubInitialVal(){
|
||||
int min = 0;
|
||||
if(subPerfs.length > 0){
|
||||
min = subPerfs[0][0]['id'] as int;
|
||||
for(var sub in subPerfs[0]){
|
||||
int x = sub['id'] as int;
|
||||
if(x < min){
|
||||
min = x;
|
||||
}
|
||||
}
|
||||
}
|
||||
return min.toString();
|
||||
}
|
||||
|
||||
void loadSubPerfFor(String perf){
|
||||
subPerfs.clear();
|
||||
PerfectureService.loadSubPerfectures(perf).then((value){
|
||||
subPerfs.add(value);
|
||||
print(subPerfs);
|
||||
});
|
||||
}
|
||||
|
||||
GeoJsonFeature? getFeatureForLatLong(double lat, double long){
|
||||
if(locations.length > 0){
|
||||
for(GeoJsonFeature i in locations[0].collection){
|
||||
GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
|
||||
if(p.geoSerie!.geoPoints[0].latitude == lat && p.geoSerie!.geoPoints[0].longitude == long){
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void makeNext(GeoJsonFeature fs){
|
||||
GeoJsonFeature<GeoJsonMultiPoint> pt = fs as GeoJsonFeature<GeoJsonMultiPoint>;
|
||||
|
||||
for(int i=0; i<= locations[0].collection.length - 1; i++){
|
||||
GeoJsonMultiPoint p = locations[0].collection[i].geometry as GeoJsonMultiPoint;
|
||||
|
||||
if(p.geoSerie!.geoPoints[0].latitude == pt.geometry!.geoSerie!.geoPoints[0].latitude && p.geoSerie!.geoPoints[0].longitude == pt.geometry!.geoSerie!.geoPoints[0].longitude ){
|
||||
|
||||
if(currentFeature.length > 0){
|
||||
currentFeature.clear();
|
||||
}
|
||||
if(i >= locations[0].collection.length - 1 ){
|
||||
currentFeature.add(locations[0].collection[0] as GeoJsonFeature);
|
||||
}
|
||||
else{
|
||||
currentFeature.add(locations[0].collection[i + 1] as GeoJsonFeature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void makePrevious(GeoJsonFeature fs){
|
||||
GeoJsonFeature<GeoJsonMultiPoint> pt = fs as GeoJsonFeature<GeoJsonMultiPoint>;
|
||||
|
||||
for(int i=0; i<= locations[0].collection.length - 1; i++){
|
||||
GeoJsonMultiPoint p = locations[0].collection[i].geometry as GeoJsonMultiPoint;
|
||||
|
||||
if(p.geoSerie!.geoPoints[0].latitude == pt.geometry!.geoSerie!.geoPoints[0].latitude && p.geoSerie!.geoPoints[0].longitude == pt.geometry!.geoSerie!.geoPoints[0].longitude ){
|
||||
|
||||
if(currentFeature.length > 0){
|
||||
currentFeature.clear();
|
||||
}
|
||||
if(i == 0 ){
|
||||
currentFeature.add(locations[0].collection[locations[0].collection.length -1] as GeoJsonFeature);
|
||||
}
|
||||
else{
|
||||
currentFeature.add(locations[0].collection[i - 1] as GeoJsonFeature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
199
lib/pages/home/home_controller_t.dart
Normal file
199
lib/pages/home/home_controller_t.dart
Normal file
@ -0,0 +1,199 @@
|
||||
|
||||
|
||||
// import 'package:flutter_map/plugin_api.dart';
|
||||
// import 'package:geojson/geojson.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// import 'package:latlong2/latlong.dart';
|
||||
// import 'package:meta/meta.dart';
|
||||
// import 'package:rogapp/pages/map/map_page.dart';
|
||||
// import 'package:rogapp/services/location_service.dart';
|
||||
// import 'package:rogapp/services/perfecture_service.dart';
|
||||
|
||||
// class HomeController extends GetxController {
|
||||
|
||||
// List<GeoJsonFeatureCollection> locations = <GeoJsonFeatureCollection>[].obs;
|
||||
// List<GeoJsonFeature> currentFeature = <GeoJsonFeature>[].obs;
|
||||
// List<dynamic> perfectures = <dynamic>[].obs;
|
||||
// List<LatLngBounds> currentBound = <LatLngBounds>[].obs;
|
||||
// List<dynamic> subPerfs = <dynamic>[].obs;
|
||||
|
||||
// String SubDropdownValue = "-1";
|
||||
|
||||
|
||||
// @override
|
||||
// void onInit() {
|
||||
// super.onInit();
|
||||
|
||||
// if(locations.length == 0){
|
||||
// LocationService.loadLocations().then((value){
|
||||
// locations.add(value!);
|
||||
// //print(value);
|
||||
// });
|
||||
// }
|
||||
// if(perfectures.length == 0){
|
||||
// PerfectureService.loadPerfectures().then((value){
|
||||
// perfectures.add(value);
|
||||
// loadSubPerfFor("9");
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
// void getBoundFromLatLng(List<LatLng> list) {
|
||||
// double? x0, x1, y0, y1;
|
||||
// for (LatLng latLng in list) {
|
||||
// if (x0 == 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;
|
||||
// }
|
||||
// }
|
||||
// currentBound.clear();
|
||||
// if(x0 != null && x1 != null && y0 != null && y1 != null ){
|
||||
// currentBound.add(LatLngBounds(LatLng(x1, y1), LatLng(x0, y0)));
|
||||
// }
|
||||
// }
|
||||
|
||||
// void setBounds(){
|
||||
// List<LatLng> lts = [];
|
||||
// if(locations.length > 0){
|
||||
// for(GeoJsonFeature i in locations[0].collection){
|
||||
// GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
|
||||
// LatLng lt = LatLng(p.geoSerie!.geoPoints[0].latitude , p.geoSerie!.geoPoints[0].longitude) ;
|
||||
// lts.add(lt);
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// LatLng lt = LatLng(37.15319600454702, 139.58765950528198);
|
||||
// lts.add(lt);
|
||||
// }
|
||||
// getBoundFromLatLng(lts);
|
||||
// }
|
||||
|
||||
// void zoomtoMainPerf(String id, MapController mapController){
|
||||
|
||||
// PerfectureService.getMainPerfExt(id).then((value){
|
||||
// print(value);
|
||||
// LatLng lat1 = LatLng(value![1], value[0]);
|
||||
// LatLng lat2 = LatLng(value[3], value[2]);
|
||||
// LatLngBounds bound = LatLngBounds(lat1, lat2);
|
||||
// mapController.fitBounds(bound);
|
||||
// });
|
||||
|
||||
// }
|
||||
|
||||
// void zoomtoSubPerf(String id, MapController mapController){
|
||||
|
||||
// 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);
|
||||
// });
|
||||
|
||||
// }
|
||||
|
||||
// void loadLocationforPerf(String perf, MapController mapController) async {
|
||||
// locations.clear();
|
||||
// LocationService.loadLocationsFor(perf).then((value){
|
||||
// locations.add(value!);
|
||||
// setBounds();
|
||||
// mapController.fitBounds(currentBound[0]);
|
||||
// });
|
||||
// }
|
||||
|
||||
// void loadLocationforSubPerf(String subperf, MapController mapController) async {
|
||||
// locations.clear();
|
||||
// LocationService.loadLocationsSubFor(subperf).then((value){
|
||||
// locations.add(value!);
|
||||
// //setBounds();
|
||||
// //mapController!.fitBounds(currentBound[0]);
|
||||
// });
|
||||
// }
|
||||
|
||||
// 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();
|
||||
// //print(subPerfs[0]);
|
||||
// });
|
||||
// }
|
||||
|
||||
// String getSubInitialVal(){
|
||||
// int min = 0;
|
||||
// if(subPerfs.length > 0){
|
||||
// min = subPerfs[0][0]['id'] as int;
|
||||
// for(var sub in subPerfs[0]){
|
||||
// int x = int.parse(sub['id'].toString()); // as int;
|
||||
// if(x < min){
|
||||
// min = x;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return min.toString();
|
||||
// }
|
||||
|
||||
// GeoJsonFeature? getFeatureForLatLong(double lat, double long){
|
||||
// if(locations.length > 0){
|
||||
// for(GeoJsonFeature i in locations[0].collection){
|
||||
// GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
|
||||
// if(p.geoSerie!.geoPoints[0].latitude == lat && p.geoSerie!.geoPoints[0].longitude == long){
|
||||
// return i;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// void makeNext(GeoJsonFeature fs){
|
||||
// GeoJsonFeature<GeoJsonMultiPoint> pt = fs as GeoJsonFeature<GeoJsonMultiPoint>;
|
||||
|
||||
// for(int i=0; i<= locations[0].collection.length - 1; i++){
|
||||
// GeoJsonMultiPoint p = locations[0].collection[i].geometry as GeoJsonMultiPoint;
|
||||
|
||||
// if(p.geoSerie!.geoPoints[0].latitude == pt.geometry!.geoSerie!.geoPoints[0].latitude && p.geoSerie!.geoPoints[0].longitude == pt.geometry!.geoSerie!.geoPoints[0].longitude ){
|
||||
|
||||
// if(currentFeature.length > 0){
|
||||
// currentFeature.clear();
|
||||
// }
|
||||
// if(i >= locations[0].collection.length - 1 ){
|
||||
// currentFeature.add(locations[0].collection[0] as GeoJsonFeature);
|
||||
// }
|
||||
// else{
|
||||
// currentFeature.add(locations[0].collection[i + 1] as GeoJsonFeature);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// void makePrevious(GeoJsonFeature fs){
|
||||
// GeoJsonFeature<GeoJsonMultiPoint> pt = fs as GeoJsonFeature<GeoJsonMultiPoint>;
|
||||
|
||||
// for(int i=0; i<= locations[0].collection.length - 1; i++){
|
||||
// GeoJsonMultiPoint p = locations[0].collection[i].geometry as GeoJsonMultiPoint;
|
||||
|
||||
// if(p.geoSerie!.geoPoints[0].latitude == pt.geometry!.geoSerie!.geoPoints[0].latitude && p.geoSerie!.geoPoints[0].longitude == pt.geometry!.geoSerie!.geoPoints[0].longitude ){
|
||||
|
||||
// if(currentFeature.length > 0){
|
||||
// currentFeature.clear();
|
||||
// }
|
||||
// if(i == 0 ){
|
||||
// currentFeature.add(locations[0].collection[locations[0].collection.length -1] as GeoJsonFeature);
|
||||
// }
|
||||
// else{
|
||||
// currentFeature.add(locations[0].collection[i - 1] as GeoJsonFeature);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// }
|
||||
@ -1,122 +0,0 @@
|
||||
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/drawer/drawer_page.dart';
|
||||
import 'package:rogapp/pages/home/home_controller.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:rogapp/services/perfecture_service.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
import 'package:flutter_breadcrumb/flutter_breadcrumb.dart';
|
||||
|
||||
class HomePage extends GetView<HomeController> {
|
||||
|
||||
final HomeController homeController = Get.find<HomeController>();
|
||||
|
||||
|
||||
void changeCurrentFeature(GeoJsonFeature fs){
|
||||
if(homeController.currentFeature.length > 0){
|
||||
homeController.currentFeature.clear();
|
||||
}
|
||||
homeController.currentFeature.add(fs);
|
||||
}
|
||||
|
||||
Image getImage(int index){
|
||||
if(homeController.locations[0].collection[index].properties!["photos"] == null || homeController.locations[0].collection[index].properties!["photos"] == ""){
|
||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
}
|
||||
else{
|
||||
return Image(image: NetworkImage(homeController.locations[0].collection[index].properties!["photos"]));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
drawer: DrawerPage(),
|
||||
appBar: AppBar(
|
||||
title: Text("app_title".tr),
|
||||
centerTitle: true,
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.map),
|
||||
onPressed: (){
|
||||
//print(homeController.locations.length);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
floatingActionButton: new FloatingActionButton(
|
||||
onPressed: (){
|
||||
Get.toNamed(AppPages.MAP);
|
||||
},
|
||||
tooltip: 'Increment',
|
||||
child: new Icon(Icons.document_scanner),
|
||||
elevation: 4.0,
|
||||
),
|
||||
bottomNavigationBar: BottomAppBar(
|
||||
child: new Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Expanded(child: IconButton(icon: Icon(Icons.camera_enhance), onPressed: (){},),),
|
||||
Expanded(child: new Text('')),
|
||||
Expanded(child: IconButton(icon: Icon(Icons.travel_explore), onPressed: (){}),),
|
||||
],
|
||||
),
|
||||
),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
||||
body:Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
height: 50.0,
|
||||
child: BreadCrumb(
|
||||
items: <BreadCrumbItem>[
|
||||
BreadCrumbItem(
|
||||
content: ElevatedButton(child: Text("Press"), onPressed: (){
|
||||
print("-----");
|
||||
print(homeController.perfectures[0][0]);
|
||||
},)
|
||||
),
|
||||
BreadCrumbItem(content: Text('Item2', style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold),)),
|
||||
],
|
||||
divider: Icon(Icons.chevron_right),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Obx(() =>
|
||||
homeController.locations.length > 0 ?
|
||||
ListView.builder(
|
||||
itemCount: homeController.locations[0].collection.length,
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (_, index){
|
||||
return Card(
|
||||
child: ListTile(
|
||||
onTap: (){
|
||||
GeoJsonFeature gf = homeController.locations[0].collection[index];
|
||||
changeCurrentFeature(gf);
|
||||
showModalBottomSheet(
|
||||
isScrollControlled: true,
|
||||
context: context,
|
||||
builder: (context) => BottomSheetWidget(),
|
||||
);
|
||||
},
|
||||
leading: getImage(index),
|
||||
title: Text(homeController.locations[0].collection[index].properties!['location_name'].toString()),
|
||||
subtitle: Text(homeController.locations[0].collection[index].properties!['category']),
|
||||
),
|
||||
);
|
||||
},
|
||||
) : Container(width: 0, height: 0,),
|
||||
)
|
||||
)
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
129
lib/pages/home/home_page_t.dart
Normal file
129
lib/pages/home/home_page_t.dart
Normal file
@ -0,0 +1,129 @@
|
||||
|
||||
// import 'dart:ui';
|
||||
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:flutter_map/plugin_api.dart';
|
||||
// import 'package:geojson/geojson.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// import 'package:rogapp/pages/drawer/drawer_page.dart';
|
||||
// import 'package:rogapp/pages/home/home_controller.dart';
|
||||
// import 'package:rogapp/routes/app_pages.dart';
|
||||
// import 'package:rogapp/services/perfecture_service.dart';
|
||||
// import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
// import 'package:flutter_breadcrumb/flutter_breadcrumb.dart';
|
||||
// import 'package:rogapp/widgets/perfecture_widget.dart';
|
||||
|
||||
// class HomePage extends GetView<HomeController> {
|
||||
|
||||
// final HomeController homeController = Get.find<HomeController>();
|
||||
// MapController mapController = Get.arguments[0];
|
||||
|
||||
// void changeCurrentFeature(GeoJsonFeature fs){
|
||||
// if(homeController.currentFeature.length > 0){
|
||||
// homeController.currentFeature.clear();
|
||||
// }
|
||||
// homeController.currentFeature.add(fs);
|
||||
// }
|
||||
|
||||
// Image getImage(int index){
|
||||
// if(homeController.locations[0].collection[index].properties!["photos"] == null || homeController.locations[0].collection[index].properties!["photos"] == ""){
|
||||
// return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
// }
|
||||
// else{
|
||||
// return Image(image: NetworkImage(homeController.locations[0].collection[index].properties!["photos"]));
|
||||
// }
|
||||
// }
|
||||
|
||||
// Widget getBreadCurms(){
|
||||
// return Obx(() =>
|
||||
// homeController.perfectures.length > 0 ?
|
||||
// BreadCrumb.builder(
|
||||
// itemCount: homeController.perfectures.length,
|
||||
// builder: (index) {
|
||||
// return BreadCrumbItem(
|
||||
// content: PerfectureWidget(homeController: homeController, mapController: mapController) //Text('Item$index')
|
||||
// );
|
||||
// },
|
||||
// divider: Icon(Icons.chevron_right),
|
||||
// ) :
|
||||
// Container(width: 0, height: 0,),
|
||||
// );
|
||||
// }
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Scaffold(
|
||||
// drawer: DrawerPage(),
|
||||
// appBar: AppBar(
|
||||
// title: Text("app_title".tr),
|
||||
// centerTitle: true,
|
||||
// actions: [
|
||||
// IconButton(
|
||||
// icon: const Icon(Icons.map),
|
||||
// onPressed: (){
|
||||
// //print(homeController.locations.length);
|
||||
// },
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// floatingActionButton: new FloatingActionButton(
|
||||
// onPressed: (){
|
||||
// Get.toNamed(AppPages.MAP);
|
||||
// },
|
||||
// tooltip: 'Increment',
|
||||
// child: new Icon(Icons.document_scanner),
|
||||
// elevation: 4.0,
|
||||
// ),
|
||||
// bottomNavigationBar: BottomAppBar(
|
||||
// child: new Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: <Widget>[
|
||||
// Expanded(child: IconButton(icon: Icon(Icons.camera_enhance), onPressed: (){},),),
|
||||
// Expanded(child: new Text('')),
|
||||
// Expanded(child: IconButton(icon: Icon(Icons.travel_explore), onPressed: (){}),),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
||||
// body:Column(
|
||||
// children: [
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
// child: Container(
|
||||
// alignment: Alignment.centerLeft,
|
||||
// height: 50.0,
|
||||
// child: getBreadCurms(),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: Obx(() =>
|
||||
// homeController.locations.length > 0 ?
|
||||
// ListView.builder(
|
||||
// itemCount: homeController.locations[0].collection.length,
|
||||
// shrinkWrap: true,
|
||||
// itemBuilder: (_, index){
|
||||
// return Card(
|
||||
// child: ListTile(
|
||||
// onTap: (){
|
||||
// GeoJsonFeature gf = homeController.locations[0].collection[index];
|
||||
// changeCurrentFeature(gf);
|
||||
// showModalBottomSheet(
|
||||
// isScrollControlled: true,
|
||||
// context: context,
|
||||
// builder: (context) => BottomSheetWidget(),
|
||||
// );
|
||||
// },
|
||||
// leading: getImage(index),
|
||||
// title: Text(homeController.locations[0].collection[index].properties!['location_name'].toString()),
|
||||
// subtitle: Text(homeController.locations[0].collection[index].properties!['category']),
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// ) : Container(width: 0, height: 0,),
|
||||
// )
|
||||
// )
|
||||
// ],
|
||||
// )
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
14
lib/pages/map/map_binding_t.dart
Normal file
14
lib/pages/map/map_binding_t.dart
Normal file
@ -0,0 +1,14 @@
|
||||
// import 'package:flutter_map/flutter_map.dart';
|
||||
// import 'package:get/get_core/src/get_main.dart';
|
||||
// import 'package:get/get_instance/src/bindings_interface.dart';
|
||||
// import 'package:get/get_instance/src/extension_instance.dart';
|
||||
// import 'package:rogapp/pages/home/home_controller.dart';
|
||||
|
||||
|
||||
// class MapBinding extends Bindings {
|
||||
// @override
|
||||
// void dependencies() {
|
||||
// Get.put<HomeController>(HomeController());
|
||||
// Get.put<MapController>(MapController());
|
||||
// }
|
||||
// }
|
||||
@ -1,183 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter_breadcrumb/flutter_breadcrumb.dart';
|
||||
import 'package:flutter_map/plugin_api.dart';
|
||||
import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_state_manager/get_state_manager.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:rogapp/pages/drawer/drawer_page.dart';
|
||||
import 'package:rogapp/pages/home/home_controller.dart';
|
||||
import 'package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:rogapp/widgets/base_layer_widget.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
import 'package:rogapp/widgets/perfecture_widget.dart';
|
||||
|
||||
|
||||
class MapPage extends StatelessWidget {
|
||||
MapPage({ Key? key }) : super(key: key);
|
||||
|
||||
final HomeController homeController = Get.find<HomeController>();
|
||||
|
||||
static final MapController mapController = MapController();
|
||||
|
||||
|
||||
Widget getBreadCurms(){
|
||||
print("---------map-------------");
|
||||
return Obx(() =>
|
||||
homeController.perfectures.length > 0 ?
|
||||
BreadCrumb.builder(
|
||||
itemCount: homeController.perfectures.length,
|
||||
builder: (index) {
|
||||
return BreadCrumbItem(
|
||||
content: PerfectureWidget(homeController: homeController,) //Text('Item$index')
|
||||
);
|
||||
},
|
||||
divider: Icon(Icons.chevron_right),
|
||||
) :
|
||||
Container(width: 0, height: 0,),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final PopupController _popupController = PopupController();
|
||||
|
||||
|
||||
return Scaffold(
|
||||
drawer: DrawerPage(),
|
||||
appBar: AppBar(
|
||||
title: Text("app_title".tr),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.map),
|
||||
onPressed: () => {print("action")},
|
||||
)
|
||||
|
||||
],
|
||||
),
|
||||
bottomNavigationBar: BottomAppBar(
|
||||
child: new Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Expanded(child: IconButton(icon: Icon(Icons.camera_enhance), onPressed: (){},),),
|
||||
Expanded(child: new Text('')),
|
||||
Expanded(child: IconButton(icon: Icon(Icons.travel_explore), onPressed: (){}),),
|
||||
],
|
||||
),
|
||||
),
|
||||
floatingActionButton: new FloatingActionButton(
|
||||
onPressed: (){
|
||||
Get.toNamed(AppPages.INITIAL);
|
||||
},
|
||||
tooltip: 'Increment',
|
||||
child: new Icon(Icons.document_scanner),
|
||||
elevation: 4.0,
|
||||
),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
height: 50.0,
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child:
|
||||
getBreadCurms(),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Obx(() =>
|
||||
Stack(
|
||||
children: [
|
||||
FlutterMap(
|
||||
mapController: mapController,
|
||||
options: MapOptions(
|
||||
|
||||
//center: LatLng(37.15319600454702, 139.58765950528198),
|
||||
bounds: homeController.currentBound.length > 0 ? homeController.currentBound[0]: LatLngBounds.fromPoints([LatLng(37.15319600454702, 139.58765950528198)]),
|
||||
zoom: 6,
|
||||
maxZoom: 20,
|
||||
plugins: [
|
||||
MarkerClusterPlugin(),
|
||||
],
|
||||
onTap: (_, __) =>
|
||||
_popupController
|
||||
.hideAllPopups(), // Hide popup when the map is tapped.
|
||||
),
|
||||
children: [
|
||||
BaseLayer(),
|
||||
LocationMarkerLayerWidget(),
|
||||
homeController.locations.length > 0 ?
|
||||
MarkerClusterLayerWidget(
|
||||
options: MarkerClusterLayerOptions(
|
||||
spiderfyCircleRadius: 80,
|
||||
spiderfySpiralDistanceMultiplier: 2,
|
||||
circleSpiralSwitchover: 12,
|
||||
maxClusterRadius: 20,
|
||||
rotate: true,
|
||||
onMarkerTap: (marker){
|
||||
GeoJsonFeature? fs = homeController.getFeatureForLatLong(marker.point.latitude, marker.point.longitude);
|
||||
print(fs);
|
||||
if(fs != null){
|
||||
if(homeController.currentFeature.length > 0) {
|
||||
homeController.currentFeature.clear();
|
||||
}
|
||||
homeController.currentFeature.add(fs);
|
||||
|
||||
showModalBottomSheet(context: context, isScrollControlled: true,
|
||||
builder:((context) => BottomSheetWidget())
|
||||
);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
size: Size(40, 40),
|
||||
anchor: AnchorPos.align(AnchorAlign.center),
|
||||
fitBoundsOptions: const FitBoundsOptions(
|
||||
padding: EdgeInsets.all(50),
|
||||
maxZoom: 265,
|
||||
),
|
||||
markers:homeController.locations[0].collection.map((i) {
|
||||
GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
|
||||
return Marker(
|
||||
anchorPos: AnchorPos.align(AnchorAlign.center),
|
||||
height: 70.0,
|
||||
width: 70.0,
|
||||
point: LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude),
|
||||
builder: (ctx) => 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),
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
181
lib/pages/map/map_page_t.dart
Normal file
181
lib/pages/map/map_page_t.dart
Normal file
@ -0,0 +1,181 @@
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:flutter/rendering.dart';
|
||||
// import 'package:flutter_breadcrumb/flutter_breadcrumb.dart';
|
||||
// import 'package:flutter_map/plugin_api.dart';
|
||||
// import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
|
||||
// import 'package:geojson/geojson.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// import 'package:get/get_state_manager/get_state_manager.dart';
|
||||
// import 'package:latlong2/latlong.dart';
|
||||
// import 'package:rogapp/pages/drawer/drawer_page.dart';
|
||||
// import 'package:rogapp/pages/home/home_controller.dart';
|
||||
// import 'package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart';
|
||||
// import 'package:rogapp/routes/app_pages.dart';
|
||||
// import 'package:rogapp/widgets/base_layer_widget.dart';
|
||||
// import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
// import 'package:rogapp/widgets/perfecture_widget.dart';
|
||||
|
||||
|
||||
// class MapPage extends GetView<HomeController> {
|
||||
// MapPage({ Key? key }) : super(key: key);
|
||||
|
||||
// final HomeController homeController = Get.find<HomeController>();
|
||||
// final MapController mapController = MapController();
|
||||
|
||||
|
||||
// Widget getBreadCurms(){
|
||||
// return Obx(() =>
|
||||
// homeController.perfectures.length > 0 ?
|
||||
// BreadCrumb.builder(
|
||||
// itemCount: homeController.perfectures.length,
|
||||
// builder: (index) {
|
||||
// return BreadCrumbItem(
|
||||
// content: PerfectureWidget(homeController: homeController, mapController: mapController) //Text('Item$index')
|
||||
// );
|
||||
// },
|
||||
// divider: Icon(Icons.chevron_right),
|
||||
// ) :
|
||||
// Container(width: 0, height: 0,),
|
||||
// );
|
||||
// }
|
||||
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
|
||||
// final PopupController _popupController = PopupController();
|
||||
|
||||
// return Scaffold(
|
||||
// drawer: DrawerPage(),
|
||||
// appBar: AppBar(
|
||||
// title: Text("app_title".tr),
|
||||
// actions: [
|
||||
// IconButton(
|
||||
// icon: const Icon(Icons.map),
|
||||
// onPressed: () => {print("action")},
|
||||
// )
|
||||
|
||||
// ],
|
||||
// ),
|
||||
// bottomNavigationBar: BottomAppBar(
|
||||
// child: new Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: <Widget>[
|
||||
// Expanded(child: IconButton(icon: Icon(Icons.camera_enhance), onPressed: (){},),),
|
||||
// Expanded(child: new Text('')),
|
||||
// Expanded(child: IconButton(icon: Icon(Icons.travel_explore), onPressed: (){}),),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// floatingActionButton: new FloatingActionButton(
|
||||
// onPressed: (){
|
||||
// Get.toNamed(AppPages.INITIAL, arguments: [mapController]);
|
||||
// },
|
||||
// tooltip: 'Increment',
|
||||
// child: new Icon(Icons.document_scanner),
|
||||
// elevation: 4.0,
|
||||
// ),
|
||||
// floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
||||
// body: SafeArea(
|
||||
// child: Column(
|
||||
// children: [
|
||||
// Container(
|
||||
// padding: EdgeInsets.symmetric(horizontal: 16.0),
|
||||
// alignment: Alignment.centerLeft,
|
||||
// height: 50.0,
|
||||
// child: SingleChildScrollView(
|
||||
// scrollDirection: Axis.horizontal,
|
||||
// child:
|
||||
// getBreadCurms(),
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: Obx(() =>
|
||||
// Stack(
|
||||
// children: [
|
||||
// FlutterMap(
|
||||
// mapController: mapController,
|
||||
// options: MapOptions(
|
||||
|
||||
// //center: LatLng(37.15319600454702, 139.58765950528198),
|
||||
// bounds: homeController.currentBound.length > 0 ? homeController.currentBound[0]: LatLngBounds.fromPoints([LatLng(37.15319600454702, 139.58765950528198)]),
|
||||
// zoom: 6,
|
||||
// maxZoom: 20,
|
||||
// plugins: [
|
||||
// MarkerClusterPlugin(),
|
||||
// ],
|
||||
// onTap: (_, __) =>
|
||||
// _popupController
|
||||
// .hideAllPopups(), // Hide popup when the map is tapped.
|
||||
// ),
|
||||
// children: [
|
||||
// BaseLayer(),
|
||||
// LocationMarkerLayerWidget(),
|
||||
// homeController.locations.length > 0 ?
|
||||
// MarkerClusterLayerWidget(
|
||||
// options: MarkerClusterLayerOptions(
|
||||
// spiderfyCircleRadius: 80,
|
||||
// spiderfySpiralDistanceMultiplier: 2,
|
||||
// circleSpiralSwitchover: 12,
|
||||
// maxClusterRadius: 20,
|
||||
// rotate: true,
|
||||
// onMarkerTap: (marker){
|
||||
// GeoJsonFeature? fs = homeController.getFeatureForLatLong(marker.point.latitude, marker.point.longitude);
|
||||
// print(fs);
|
||||
// if(fs != null){
|
||||
// if(homeController.currentFeature.length > 0) {
|
||||
// homeController.currentFeature.clear();
|
||||
// }
|
||||
// homeController.currentFeature.add(fs);
|
||||
|
||||
// showModalBottomSheet(context: context, isScrollControlled: true,
|
||||
// builder:((context) => BottomSheetWidget())
|
||||
// );
|
||||
// }
|
||||
|
||||
// },
|
||||
|
||||
// size: Size(40, 40),
|
||||
// anchor: AnchorPos.align(AnchorAlign.center),
|
||||
// fitBoundsOptions: const FitBoundsOptions(
|
||||
// padding: EdgeInsets.all(50),
|
||||
// maxZoom: 265,
|
||||
// ),
|
||||
// markers:homeController.locations[0].collection.map((i) {
|
||||
// GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
|
||||
// return Marker(
|
||||
// anchorPos: AnchorPos.align(AnchorAlign.center),
|
||||
// height: 70.0,
|
||||
// width: 70.0,
|
||||
// point: LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude),
|
||||
// builder: (ctx) => 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),
|
||||
// ],
|
||||
// )
|
||||
// ],
|
||||
// )
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user