@@ -7,7 +7,7 @@ import 'package:geolocator/geolocator.dart';
7
7
import 'package:sliding_up_panel2/sliding_up_panel2.dart' ;
8
8
import 'package:talker/talker.dart' ;
9
9
import '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' ;
11
11
import 'package:vietmap_map/features/map_screen/components/category_marker.dart' ;
12
12
import 'package:vietmap_map/method_channel/vietmap_automotive_plugin.dart' ;
13
13
import '../../constants/colors.dart' ;
@@ -41,8 +41,8 @@ class _MapScreenState extends State<MapScreen> {
41
41
bool isShowMarker = true ;
42
42
final PanelController _panelController = PanelController ();
43
43
MyLocationTrackingMode myLocationTrackingMode =
44
- MyLocationTrackingMode .Tracking ;
45
- MyLocationRenderMode myLocationRenderMode = MyLocationRenderMode .COMPASS ;
44
+ MyLocationTrackingMode .tracking ;
45
+ MyLocationRenderMode myLocationRenderMode = MyLocationRenderMode .compass ;
46
46
final talker = Talker ();
47
47
String tileMap = AppContext .getVietmapMapStyleUrl () ?? "" ;
48
48
@override
@@ -95,8 +95,8 @@ class _MapScreenState extends State<MapScreen> {
95
95
setState (() {});
96
96
}
97
97
if (state is MapStateChangeMapTilesSuccess ) {
98
- _controller? .setStyle (
99
- state.mapTile.getMapTiles (AppContext .getVietmapAPIKey () ?? "" ));
98
+ // _controller?.setStyle(
99
+ // state.mapTile.getMapTiles(AppContext.getVietmapAPIKey() ?? ""));
100
100
}
101
101
if (state is MapStateGetLocationFromCoordinateSuccess &&
102
102
ModalRoute .of (context)? .isCurrent == true ) {
@@ -178,7 +178,7 @@ class _MapScreenState extends State<MapScreen> {
178
178
VietmapGL (
179
179
myLocationEnabled: true ,
180
180
myLocationTrackingMode:
181
- MyLocationTrackingMode .TrackingCompass ,
181
+ MyLocationTrackingMode .trackingCompass ,
182
182
myLocationRenderMode: myLocationRenderMode,
183
183
trackCameraPosition: true ,
184
184
compassViewMargins:
@@ -252,7 +252,7 @@ class _MapScreenState extends State<MapScreen> {
252
252
);
253
253
break ;
254
254
case Events .onRecenter:
255
- await _controller? .recenter ();
255
+ // await _controller?.recenter();
256
256
break ;
257
257
default :
258
258
}
@@ -264,7 +264,7 @@ class _MapScreenState extends State<MapScreen> {
264
264
_removeRoutes ();
265
265
_clearMarker ();
266
266
var response =
267
- await _controller? .queryRenderedFeatures (point: point );
267
+ await _controller? .queryRenderedFeatures (point, [], [] );
268
268
if (response == null || response.isEmpty) return ;
269
269
for (var item in response) {
270
270
talker.good (item);
@@ -293,13 +293,46 @@ class _MapScreenState extends State<MapScreen> {
293
293
}
294
294
// talker.info(response);
295
295
},
296
- onMapLongClick: (point, coordinates) {
296
+ onMapLongClick: (point, coordinates) async {
297
297
setState (() {
298
298
_nearbyMarker = [];
299
299
});
300
300
context
301
301
.read <MapBloc >()
302
302
.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
+ // });
303
336
},
304
337
),
305
338
_controller == null
@@ -426,7 +459,7 @@ class _MapScreenState extends State<MapScreen> {
426
459
heroTag: "recenter" ,
427
460
backgroundColor: Colors .white,
428
461
onPressed: () async {
429
- await _controller? .recenter ();
462
+ // await _controller?.recenter();
430
463
await _mapAutomotivePlugin.recenter ();
431
464
},
432
465
child: Icon (
@@ -440,29 +473,29 @@ class _MapScreenState extends State<MapScreen> {
440
473
backgroundColor: Colors .white,
441
474
onPressed: () {
442
475
if (myLocationTrackingMode !=
443
- MyLocationTrackingMode .TrackingCompass ) {
476
+ MyLocationTrackingMode .trackingCompass ) {
444
477
_controller? .updateMyLocationTrackingMode (
445
- MyLocationTrackingMode .TrackingCompass );
478
+ MyLocationTrackingMode .trackingCompass );
446
479
setState (() {
447
480
myLocationTrackingMode =
448
- MyLocationTrackingMode .TrackingCompass ;
481
+ MyLocationTrackingMode .trackingCompass ;
449
482
myLocationRenderMode =
450
- MyLocationRenderMode .COMPASS ;
483
+ MyLocationRenderMode .compass ;
451
484
});
452
485
} else {
453
486
_controller? .updateMyLocationTrackingMode (
454
- MyLocationTrackingMode .TrackingGPS );
487
+ MyLocationTrackingMode .trackingGps );
455
488
setState (() {
456
489
myLocationTrackingMode =
457
- MyLocationTrackingMode .TrackingGPS ;
490
+ MyLocationTrackingMode .trackingGps ;
458
491
myLocationRenderMode =
459
- MyLocationRenderMode .NORMAL ;
492
+ MyLocationRenderMode .normal ;
460
493
});
461
494
}
462
495
},
463
496
child: Icon (
464
497
myLocationTrackingMode ==
465
- MyLocationTrackingMode .TrackingCompass
498
+ MyLocationTrackingMode .trackingCompass
466
499
? Icons .compass_calibration_sharp
467
500
: Icons .gps_fixed,
468
501
color: Colors .grey[800 ]),
0 commit comments