map updated to 6

This commit is contained in:
2023-12-06 11:16:17 +05:30
parent 8d1c84d9fb
commit fa0587178f
19 changed files with 631 additions and 596 deletions

View File

@ -1,10 +1,10 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_map/plugin_api.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
import 'package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart';
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
import 'package:geojson/geojson.dart';
import 'package:geojson_vi/geojson_vi.dart';
import 'package:get/get.dart';
import 'package:latlong2/latlong.dart';
import 'package:rogapp/model/destination.dart';
@ -25,8 +25,8 @@ class MapWidget extends StatelessWidget {
StreamSubscription? subscription;
Widget getMarkerShape(GeoJsonFeature i, BuildContext context) {
GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
Widget getMarkerShape(GeoJSONFeature i, BuildContext context) {
GeoJSONMultiPoint p = i.geometry as GeoJSONMultiPoint;
//print("lat is ${p.geoSerie!.geoPoints[0].latitude} and lon is ${p.geoSerie!.geoPoints[0].longitude}");
//RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
return Row(
@ -34,9 +34,8 @@ class MapWidget extends StatelessWidget {
children: [
InkWell(
onTap: () {
GeoJsonFeature? fs = indexController.getFeatureForLatLong(
p.geoSerie!.geoPoints[0].latitude,
p.geoSerie!.geoPoints[0].longitude);
GeoJSONFeature? fs = indexController.getFeatureForLatLong(
p.coordinates[0][1], p.coordinates[0][0]);
//print("------- fs $fs------");
if (fs != null) {
indexController.currentFeature.clear();
@ -204,27 +203,24 @@ class MapWidget extends StatelessWidget {
),
),
indexController.locations.isNotEmpty &&
indexController.locations[0].collection.isNotEmpty
indexController.locations[0].features.isNotEmpty
? MarkerLayer(
markers:
indexController.locations[0].collection.map((i) {
indexController.locations[0].features.map((i) {
//print("i si ${i.properties!['location_id']}");
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
GeoJsonMultiPoint p =
i.geometry as GeoJsonMultiPoint;
GeoJSONMultiPoint p =
i!.geometry as GeoJSONMultiPoint;
//print(
// "lat is ${p.geoSerie!.geoPoints[0].latitude} and lon is ${p.geoSerie!.geoPoints[0].longitude}");
return Marker(
anchorPos: AnchorPos.exactly(Anchor(108.0, 18.0)),
height: 32.0,
width: 120.0,
point: LatLng(p.geoSerie!.geoPoints[0].latitude,
p.geoSerie!.geoPoints[0].longitude),
builder: (ctx) {
return getMarkerShape(i, context);
},
);
alignment: Alignment.topCenter,
height: 32.0,
width: 120.0,
point: LatLng(
p.coordinates[0][1], p.coordinates[0][0]),
child: getMarkerShape(i, context));
}).toList(),
)
: const Center(child: CircularProgressIndicator()),