- ReticleButton: fixed-at-screen-center "+" circle (HTML prototype: #centerCluster/#reticleBtn), tapping it drops a waypoint at the current map center. - CurrentMissionNotifier (Riverpod): holds the waypoint list for the mission being edited. Reactive single-value state per doc 4.16, so Riverpod rather than a new Bloc/Cubit. - MissionMap now renders each waypoint as a CircleLayer marker (white border, dark fill, matching the prototype's L.circleMarker styling). - PlanScreen owns the MapController needed to read the camera center on tap, and wires the reticle to the provider. Default altitude/speed/catch-radius (60m / 15 m/s / 60m) are hardcoded to the T1 Ranger default profile values from the prototype for now - TODO once drone profile settings (doc 3.5) exist. Verified with flutter analyze, flutter test (incl. a new test covering the add-waypoint path), and a real run on the Pixel_10a emulator: panned the map and dropped two waypoints, both markers stayed correctly georeferenced. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
48 lines
1.6 KiB
Dart
48 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_map/flutter_map.dart';
|
|
import 'package:latlong2/latlong.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
/// Vollbild-OSM-Karte, entspricht dem Leaflet-`#map` im HTML-Demonstrator:
|
|
/// randlos, ohne Zoom-Buttons (Pinch-to-Zoom/Pan reicht), Standard-OSM-Tiles.
|
|
class MissionMap extends StatelessWidget {
|
|
const MissionMap({super.key, this.mapController, this.waypointMarkers = const []});
|
|
|
|
final MapController? mapController;
|
|
|
|
/// Kreis-Marker fuer die Wegpunkte der aktuellen Mission (Doku 3.7).
|
|
final List<CircleMarker> waypointMarkers;
|
|
|
|
// Default-Zentrum/Zoom uebernommen aus dem HTML-Demonstrator
|
|
// (Drone Mission Control.html: L.map(...).setView([52.3676, 4.9041], 16)).
|
|
static const _initialCenter = LatLng(52.3676, 4.9041);
|
|
static const _initialZoom = 16.0;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return FlutterMap(
|
|
mapController: mapController,
|
|
options: const MapOptions(
|
|
initialCenter: _initialCenter,
|
|
initialZoom: _initialZoom,
|
|
minZoom: 3,
|
|
maxZoom: 19,
|
|
),
|
|
children: [
|
|
TileLayer(
|
|
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
|
|
userAgentPackageName: 'de.dmc.dmc_app',
|
|
maxZoom: 19,
|
|
),
|
|
CircleLayer(circles: waypointMarkers),
|
|
SimpleAttributionWidget(
|
|
alignment: Alignment.bottomLeft,
|
|
source: const Text('OpenStreetMap contributors'),
|
|
onTap: () =>
|
|
launchUrl(Uri.parse('https://www.openstreetmap.org/copyright')),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|