@@ -7,7 +7,7 @@ import 'package:geolocator/geolocator.dart';
77import 'package:sliding_up_panel2/sliding_up_panel2.dart' ;
88import 'package:talker/talker.dart' ;
99import 'package:vietmap_flutter_gl/vietmap_flutter_gl.dart' ;
10- import 'package:vietmap_map/extension/tilemap_extension .dart' ;
10+ import 'package:vietmap_gl_platform_interface/vietmap_gl_platform_interface .dart' ;
1111import 'package:vietmap_map/features/map_screen/components/category_marker.dart' ;
1212import 'package:vietmap_map/method_channel/vietmap_automotive_plugin.dart' ;
1313import '../../constants/colors.dart' ;
@@ -41,8 +41,8 @@ class _MapScreenState extends State<MapScreen> {
4141 bool isShowMarker = true ;
4242 final PanelController _panelController = PanelController ();
4343 MyLocationTrackingMode myLocationTrackingMode =
44- MyLocationTrackingMode .Tracking ;
45- MyLocationRenderMode myLocationRenderMode = MyLocationRenderMode .COMPASS ;
44+ MyLocationTrackingMode .tracking ;
45+ MyLocationRenderMode myLocationRenderMode = MyLocationRenderMode .compass ;
4646 final talker = Talker ();
4747 String tileMap = AppContext .getVietmapMapStyleUrl () ?? "" ;
4848 @override
@@ -95,8 +95,8 @@ class _MapScreenState extends State<MapScreen> {
9595 setState (() {});
9696 }
9797 if (state is MapStateChangeMapTilesSuccess ) {
98- _controller? .setStyle (
99- state.mapTile.getMapTiles (AppContext .getVietmapAPIKey () ?? "" ));
98+ // _controller?.setStyle(
99+ // state.mapTile.getMapTiles(AppContext.getVietmapAPIKey() ?? ""));
100100 }
101101 if (state is MapStateGetLocationFromCoordinateSuccess &&
102102 ModalRoute .of (context)? .isCurrent == true ) {
@@ -178,7 +178,7 @@ class _MapScreenState extends State<MapScreen> {
178178 VietmapGL (
179179 myLocationEnabled: true ,
180180 myLocationTrackingMode:
181- MyLocationTrackingMode .TrackingCompass ,
181+ MyLocationTrackingMode .trackingCompass ,
182182 myLocationRenderMode: myLocationRenderMode,
183183 trackCameraPosition: true ,
184184 compassViewMargins:
@@ -252,7 +252,7 @@ class _MapScreenState extends State<MapScreen> {
252252 );
253253 break ;
254254 case Events .onRecenter:
255- await _controller? .recenter ();
255+ // await _controller?.recenter();
256256 break ;
257257 default :
258258 }
@@ -264,7 +264,7 @@ class _MapScreenState extends State<MapScreen> {
264264 _removeRoutes ();
265265 _clearMarker ();
266266 var response =
267- await _controller? .queryRenderedFeatures (point: point );
267+ await _controller? .queryRenderedFeatures (point, [], [] );
268268 if (response == null || response.isEmpty) return ;
269269 for (var item in response) {
270270 talker.good (item);
@@ -293,13 +293,46 @@ class _MapScreenState extends State<MapScreen> {
293293 }
294294 // talker.info(response);
295295 },
296- onMapLongClick: (point, coordinates) {
296+ onMapLongClick: (point, coordinates) async {
297297 setState (() {
298298 _nearbyMarker = [];
299299 });
300300 context
301301 .read <MapBloc >()
302302 .add (MapEventOnUserLongTapOnMap (coordinates));
303+
304+ // var res = await VietmapApiRepositories().findRoute(
305+ // VietMapRoutingParams(
306+ // apiKey: AppContext.getVietmapAPIKey()!,
307+ // vehicle: VehicleType.motorcycle,
308+ // originPoint: LatLng(10, 106),
309+ // destinationPoint: coordinates));
310+ // res.fold((l) {
311+ // EasyLoading.showError('Có lỗi xảy ra');
312+ // }, (r) {
313+ // var locs = VietmapPolylineDecoder.decodePolyline(
314+ // r.paths!.first.points!, false)
315+ // .map((e) {
316+ // return LatLng(e.latitude, e.longitude);
317+ // }).toList();
318+ // _controller?.addPolyline(PolylineOptions(
319+ // geometry: locs,
320+ // polylineWidth: 4,
321+ // polylineColor: vietmapColor,
322+ // ));
323+ // var bbox = r.paths?.first.bbox;
324+ // if (bbox == null) return;
325+ // _controller?.moveCamera(CameraUpdate.newLatLngBounds(
326+ // LatLngBounds(
327+ // southwest: LatLng(
328+ // bbox[1]!.toDouble(), bbox[0]!.toDouble()),
329+ // northeast: LatLng(
330+ // bbox[3]!.toDouble(), bbox[2]!.toDouble())),
331+ // left: 200,
332+ // right: 200,
333+ // top: 200,
334+ // bottom: 200));
335+ // });
303336 },
304337 ),
305338 _controller == null
@@ -426,7 +459,7 @@ class _MapScreenState extends State<MapScreen> {
426459 heroTag: "recenter" ,
427460 backgroundColor: Colors .white,
428461 onPressed: () async {
429- await _controller? .recenter ();
462+ // await _controller?.recenter();
430463 await _mapAutomotivePlugin.recenter ();
431464 },
432465 child: Icon (
@@ -440,29 +473,29 @@ class _MapScreenState extends State<MapScreen> {
440473 backgroundColor: Colors .white,
441474 onPressed: () {
442475 if (myLocationTrackingMode !=
443- MyLocationTrackingMode .TrackingCompass ) {
476+ MyLocationTrackingMode .trackingCompass ) {
444477 _controller? .updateMyLocationTrackingMode (
445- MyLocationTrackingMode .TrackingCompass );
478+ MyLocationTrackingMode .trackingCompass );
446479 setState (() {
447480 myLocationTrackingMode =
448- MyLocationTrackingMode .TrackingCompass ;
481+ MyLocationTrackingMode .trackingCompass ;
449482 myLocationRenderMode =
450- MyLocationRenderMode .COMPASS ;
483+ MyLocationRenderMode .compass ;
451484 });
452485 } else {
453486 _controller? .updateMyLocationTrackingMode (
454- MyLocationTrackingMode .TrackingGPS );
487+ MyLocationTrackingMode .trackingGps );
455488 setState (() {
456489 myLocationTrackingMode =
457- MyLocationTrackingMode .TrackingGPS ;
490+ MyLocationTrackingMode .trackingGps ;
458491 myLocationRenderMode =
459- MyLocationRenderMode .NORMAL ;
492+ MyLocationRenderMode .normal ;
460493 });
461494 }
462495 },
463496 child: Icon (
464497 myLocationTrackingMode ==
465- MyLocationTrackingMode .TrackingCompass
498+ MyLocationTrackingMode .trackingCompass
466499 ? Icons .compass_calibration_sharp
467500 : Icons .gps_fixed,
468501 color: Colors .grey[800 ]),
0 commit comments