update
This commit is contained in:
@ -1,7 +1,11 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/plugin_api.dart';
|
||||
import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
|
||||
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
@ -20,6 +24,7 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
final DestinationController destinationController = Get.find<DestinationController>();
|
||||
StreamSubscription? subscription;
|
||||
|
||||
List<LatLng>? getPoints(){
|
||||
//print("##### --- route point ${indexController.routePoints.length}");
|
||||
@ -59,8 +64,26 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
||||
return Obx((() =>
|
||||
FlutterMap(
|
||||
options: MapOptions(
|
||||
onMapCreated: (c){
|
||||
indexController.rogMapController = c;
|
||||
indexController.rogMapController!.onReady.then((_) {
|
||||
subscription = indexController.rogMapController!.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();
|
||||
}
|
||||
});
|
||||
});
|
||||
} ,
|
||||
bounds: indexController.currentBound.length > 0 ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]),
|
||||
zoom: 5.0,
|
||||
zoom: 1,
|
||||
maxZoom: 20,
|
||||
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
|
||||
plugins: [LocationMarkerPlugin(),]
|
||||
),
|
||||
layers: [
|
||||
TileLayerOptions(
|
||||
@ -78,6 +101,7 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
||||
color: Colors.purple),
|
||||
],
|
||||
),
|
||||
LocationMarkerLayerOptions(),
|
||||
],
|
||||
)
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user