From 7331e5a24d653a47120e2e68c97181a9dc252cf9 Mon Sep 17 00:00:00 2001 From: Ming Ming Date: Mon, 20 May 2024 22:31:14 +0800 Subject: [PATCH] Fix flutter_map compatibility --- np_gps_map/lib/src/osm_gps_map.dart | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/np_gps_map/lib/src/osm_gps_map.dart b/np_gps_map/lib/src/osm_gps_map.dart index 4eaf4d91..e6fffde7 100644 --- a/np_gps_map/lib/src/osm_gps_map.dart +++ b/np_gps_map/lib/src/osm_gps_map.dart @@ -29,35 +29,33 @@ class OsmGpsMap extends StatelessWidget { child: IgnorePointer( child: FlutterMap( options: MapOptions( - center: centerLl, - zoom: zoom, - allowPanning: false, - enableScrollWheel: false, - interactiveFlags: InteractiveFlag.none, - ), - nonRotatedChildren: [ - AttributionWidget.defaultWidget( - source: "OpenStreetMap contributors", + initialCenter: centerLl, + initialZoom: zoom, + interactionOptions: const InteractionOptions( + flags: InteractiveFlag.none, ), - ], - layers: [ - TileLayerOptions( + ), + children: [ + TileLayer( urlTemplate: "https://tile.openstreetmap.org/{z}/{x}/{y}.png", ), - MarkerLayerOptions( + MarkerLayer( markers: [ Marker( width: pinSize, height: pinSize, point: centerLl, - anchorPos: AnchorPos.align(AnchorAlign.top), - builder: (_) => const Image( + alignment: Alignment.topCenter, + child: const Image( image: AssetImage( "packages/np_gps_map/assets/gps_map_pin.png"), ), ), ], ), + const SimpleAttributionWidget( + source: Text("OpenStreetMap contributors"), + ), ], ), ),