update
This commit is contained in:
@ -24,6 +24,7 @@ class _CatWidgetState extends State<CatWidget> {
|
||||
widget.indexController.refreshLocationForCat();
|
||||
setState(() {
|
||||
print(value);
|
||||
//widget.indexController.is_loading.value = true;
|
||||
defaultValue = value.toString();
|
||||
});
|
||||
},
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
import 'dart:async';
|
||||
import 'dart:ffi';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/plugin_api.dart';
|
||||
import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
|
||||
@ -16,16 +19,38 @@ class MapWidget extends StatelessWidget {
|
||||
|
||||
MapWidget({ Key? key}) : super(key: key);
|
||||
|
||||
StreamSubscription? subscription;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
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;},
|
||||
onMapCreated: (c){
|
||||
indexController.mapController = c;
|
||||
|
||||
indexController.mapController!.onReady.then((_) {
|
||||
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,
|
||||
@ -34,20 +59,75 @@ class MapWidget extends StatelessWidget {
|
||||
plugins: [
|
||||
MarkerClusterPlugin(),
|
||||
],
|
||||
|
||||
onPositionChanged: (MapPosition pos, isvalue){
|
||||
|
||||
// LatLng c1 = pos.center?? LatLng(0, 0);
|
||||
|
||||
// Timer(Duration(milliseconds:800), () {
|
||||
// print(pos.bounds!.center);
|
||||
// print("Yeah, this line is printed after 3 second");
|
||||
// LatLng c2 = pos.center?? LatLng(0, 0);
|
||||
// if(c1.latitude != 0 && c1.latitude == c2.latitude){
|
||||
// print("------ calling ----");
|
||||
// //indexController.loadLocationsBound();
|
||||
// }
|
||||
|
||||
// });
|
||||
|
||||
//
|
||||
},
|
||||
onTap: (_, __) =>
|
||||
_popupController
|
||||
.hideAllPopups(), // Hide popup when the map is tapped.
|
||||
),
|
||||
layers: [
|
||||
// MarkerLayerOptions(
|
||||
// markers: indexController.locations[0].collection.map((i) {
|
||||
// print("i si ${i.properties!['location_id']}");
|
||||
// GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
|
||||
// print("lat is ${p.geoSerie!.geoPoints[0].latitude} and lon is ${p.geoSerie!.geoPoints[0].longitude}");
|
||||
// return Marker(
|
||||
// anchorPos: AnchorPos.align(AnchorAlign.center),
|
||||
// height: 70.0,
|
||||
// width: 70.0,
|
||||
// point: LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude),
|
||||
// builder: (ctx) =>
|
||||
// IconButton(
|
||||
// icon: const Icon(Icons.pin_drop),
|
||||
// tooltip: 'Increase volume by 10',
|
||||
// onPressed: () {
|
||||
// GeoJsonFeature? fs = indexController.getFeatureForLatLong(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude);
|
||||
// print(fs);
|
||||
// if(fs != null){
|
||||
// if(indexController.currentFeature.length > 0) {
|
||||
// indexController.currentFeature.clear();
|
||||
// }
|
||||
// indexController.currentFeature.add(fs);
|
||||
// indexController.getAction();
|
||||
|
||||
// showModalBottomSheet(context: context, isScrollControlled: true,
|
||||
// builder:((context) => BottomSheetWidget())
|
||||
// );
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
|
||||
// );
|
||||
// }).toList(),
|
||||
// ),
|
||||
],
|
||||
children: [
|
||||
BaseLayer(),
|
||||
LocationMarkerLayerWidget(),
|
||||
|
||||
indexController.locations.length > 0 ?
|
||||
MarkerClusterLayerWidget(
|
||||
options: MarkerClusterLayerOptions(
|
||||
spiderfyCircleRadius: 80,
|
||||
spiderfyCircleRadius: 0,
|
||||
spiderfySpiralDistanceMultiplier: 2,
|
||||
circleSpiralSwitchover: 12,
|
||||
maxClusterRadius: 20,
|
||||
maxClusterRadius: 0,
|
||||
rotate: true,
|
||||
onMarkerTap: (marker){
|
||||
GeoJsonFeature? fs = indexController.getFeatureForLatLong(marker.point.latitude, marker.point.longitude);
|
||||
|
||||
@ -69,6 +69,7 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
|
||||
onChanged: (String? newValue) {
|
||||
//setState(() {
|
||||
if(newValue != null){
|
||||
widget.indexController.is_loading.value = true;
|
||||
widget.indexController.dropdownValue = newValue;
|
||||
widget.indexController.populateForPerf(newValue, widget.mapController);
|
||||
}
|
||||
@ -92,6 +93,7 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user