mirror of
https://github.com/timokz/flutter-vienna-hackathon-25.git
synced 2025-11-08 18:44:20 +01:00
29 lines
710 B
Dart
29 lines
710 B
Dart
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
|
|
|
String gStaticMap(
|
|
double lat,
|
|
double lon, {
|
|
int w = 600,
|
|
int h = 360,
|
|
int zoom = 15,
|
|
int scale = 2,
|
|
String markerHex = 'E53935',
|
|
String maptype = 'roadmap',
|
|
String language = 'de',
|
|
String region = 'AT',
|
|
}) {
|
|
final mapsApiKey = dotenv.env['MAPS_KEY'] ?? '';
|
|
final qp = <String, String>{
|
|
'center': '$lat,$lon',
|
|
'zoom': '$zoom',
|
|
'size': '${w}x$h',
|
|
'scale': '$scale',
|
|
'maptype': maptype,
|
|
'format': 'png',
|
|
'language': language,
|
|
'region': region,
|
|
'markers': 'color:0x$markerHex|$lat,$lon',
|
|
'key': mapsApiKey,
|
|
};
|
|
return Uri.https('maps.googleapis.com', '/maps/api/staticmap', qp).toString();
|
|
}
|