scale, zoom level, working estimates (size not accurate), download progress, more

This commit is contained in:
stopflock
2025-08-06 23:19:28 -05:00
parent 82b7583a86
commit 4182b99507
4 changed files with 62 additions and 17 deletions

View File

@@ -212,7 +212,9 @@ class _DownloadAreaDialogState extends State<DownloadAreaDialog> {
final id = DateTime.now().toIso8601String().replaceAll(':', '-');
final appDocDir = await OfflineAreaService().getOfflineAreaDir();
final dir = "${appDocDir.path}/$id";
await OfflineAreaService().downloadArea(
// Fire and forget: don't await download, so dialog closes immediately
// ignore: unawaited_futures
OfflineAreaService().downloadArea(
id: id,
bounds: bounds,
minZoom: _minZoom ?? 12,

View File

@@ -14,6 +14,7 @@ import '../services/overpass_service.dart';
import '../models/osm_camera_node.dart';
import 'debouncer.dart';
import 'camera_tag_sheet.dart';
// (removed flutter_map_scalebar: using built-in Scalebar from flutter_map)
class MapView extends StatefulWidget {
final MapController controller;
@@ -179,8 +180,8 @@ class _MapViewState extends State<MapView> {
FlutterMap(
mapController: _controller,
options: MapOptions(
center: _currentLatLng ?? LatLng(37.7749, -122.4194),
zoom: 15,
initialCenter: _currentLatLng ?? LatLng(37.7749, -122.4194),
initialZoom: 15,
maxZoom: 19,
onPositionChanged: (pos, gesture) {
if (gesture) widget.onUserGesture();
@@ -206,6 +207,15 @@ class _MapViewState extends State<MapView> {
),
PolygonLayer(polygons: overlays),
MarkerLayer(markers: markers),
// Built-in scale bar from flutter_map
Scalebar(
alignment: Alignment.bottomLeft,
padding: EdgeInsets.only(left: 8, bottom: 54), // above attribution
textStyle: TextStyle(color: Colors.black, fontWeight: FontWeight.bold),
lineColor: Colors.black,
strokeWidth: 3,
// backgroundColor removed in flutter_map >=8 (wrap in Container if needed)
),
],
),
@@ -239,6 +249,31 @@ class _MapViewState extends State<MapView> {
),
),
// Zoom indicator, positioned above scale bar
Positioned(
left: 10,
bottom: 92,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 7, vertical: 2),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.52),
borderRadius: BorderRadius.circular(7),
),
child: Builder(
builder: (context) {
final zoom = _controller.camera.zoom;
return Text(
'Zoom: ${zoom.toStringAsFixed(2)}',
style: const TextStyle(
color: Colors.white,
fontSize: 12,
fontWeight: FontWeight.w600,
),
);
},
),
),
),
// Attribution overlay
Positioned(
bottom: 20,
@@ -281,7 +316,6 @@ class _MapViewState extends State<MapView> {
return Polygon(
points: [origin, left, right, origin],
isFilled: true,
color: Colors.redAccent.withOpacity(0.25),
borderColor: Colors.redAccent,
borderStrokeWidth: 1,

View File

@@ -41,6 +41,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.6"
dart_earcut:
dependency: transitive
description:
name: dart_earcut
sha256: e485001bfc05dcbc437d7bfb666316182e3522d4c3f9668048e004d0eb2ce43b
url: "https://pub.dev"
source: hosted
version: "1.2.0"
dart_polylabel2:
dependency: transitive
description:
name: dart_polylabel2
sha256: "7eeab15ce72894e4bdba6a8765712231fc81be0bd95247de4ad9966abc57adc6"
url: "https://pub.dev"
source: hosted
version: "1.0.0"
desktop_webview_window:
dependency: transitive
description:
@@ -82,10 +98,10 @@ packages:
dependency: "direct main"
description:
name: flutter_map
sha256: "87cc8349b8fa5dccda5af50018c7374b6645334a0d680931c1fe11bce88fa5bb"
sha256: df33e784b09fae857c6261a5521dd42bd4d3342cb6200884bb70730638af5fd5
url: "https://pub.dev"
source: hosted
version: "6.2.1"
version: "8.2.1"
flutter_secure_storage:
dependency: "direct main"
description:
@@ -207,10 +223,10 @@ packages:
dependency: "direct main"
description:
name: http
sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b"
sha256: "85ab0074f9bf2b24625906d8382bbec84d3d6919d285ba9c106b07b65791fb99"
url: "https://pub.dev"
source: hosted
version: "1.4.0"
version: "1.5.0-beta.2"
http_parser:
dependency: transitive
description:
@@ -363,14 +379,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.8"
polylabel:
dependency: transitive
description:
name: polylabel
sha256: "41b9099afb2aa6c1730bdd8a0fab1400d287694ec7615dd8516935fa3144214b"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
proj4dart:
dependency: transitive
description:

View File

@@ -12,7 +12,8 @@ dependencies:
# UI & Map
provider: ^6.1.2
flutter_map: ^6.2.1
flutter_map: ^8.2.1
# (removed: using built-in Scalebar from flutter_map >= v6)
latlong2: ^0.9.0
geolocator: ^10.1.0
http: ^1.2.1