nc-photos/app/lib/mobile/google_gps_map.dart

48 lines
1.2 KiB
Dart
Raw Normal View History

2021-04-19 18:14:32 +02:00
import 'package:flutter/widgets.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:tuple/tuple.dart';
2021-11-17 15:41:11 +01:00
class GoogleGpsMap extends StatelessWidget {
const GoogleGpsMap({
2021-07-23 22:05:57 +02:00
Key? key,
required this.center,
required this.zoom,
2021-04-19 18:14:32 +02:00
this.onTap,
}) : super(key: key);
@override
build(BuildContext context) {
final centerLl = LatLng(center.item1, center.item2);
return GoogleMap(
compassEnabled: false,
mapToolbarEnabled: false,
rotateGesturesEnabled: false,
scrollGesturesEnabled: false,
zoomControlsEnabled: false,
zoomGesturesEnabled: false,
tiltGesturesEnabled: false,
myLocationButtonEnabled: false,
buildingsEnabled: false,
// liteModeEnabled: true,
initialCameraPosition: CameraPosition(
target: centerLl,
zoom: zoom,
),
markers: {
Marker(
2021-09-15 08:58:06 +02:00
markerId: const MarkerId("at"),
2021-04-19 18:14:32 +02:00
position: centerLl,
// for some reason, GoogleMap's onTap is not triggered if
// tapped on top of the marker
onTap: onTap,
),
},
onTap: (_) => onTap?.call(),
);
}
final Tuple2<double, double> center;
final double zoom;
2021-07-23 22:05:57 +02:00
final VoidCallback? onTap;
2021-04-19 18:14:32 +02:00
}