added map

This commit is contained in:
2024-03-26 21:25:38 +01:00
parent 10b0c59c3f
commit 6626de94be
4 changed files with 132 additions and 2 deletions

View File

@ -1,4 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:http/http.dart';
import 'package:http/retry.dart';
import 'package:latlong2/latlong.dart';
class MapView extends StatefulWidget {
const MapView({super.key});
@ -10,6 +14,24 @@ class MapView extends StatefulWidget {
class _MapViewState extends State<MapView> {
@override
Widget build(BuildContext context) {
return const Placeholder();
return FlutterMap(
options: const MapOptions(
initialCenter: LatLng(50.354, 7.5845),
initialZoom: 16,
),
children: [
TileLayer(
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
),
TileLayer(
urlTemplate: "https://bubatzkarte.de/tiles/radius/100/{z}/{x}/{y}.png",
tileProvider: NetworkTileProvider(
httpClient: RetryClient(
Client(),
when: (response) => response.statusCode == 502)
),
)
],
);
}
}