You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.0 KiB
Dart
32 lines
1.0 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
|
|
|
class GMSMap extends StatelessWidget{
|
|
final Completer<GoogleMapController> _controller = Completer<GoogleMapController>();
|
|
final CameraPosition currentLocation;
|
|
final Function(CameraPosition) onCameraMoved;
|
|
final MapType mapType;
|
|
final bool compassEnabled;
|
|
final bool myLocationEnabled;
|
|
|
|
|
|
GMSMap({super.key, required this.currentLocation ,required this.onCameraMoved, this.mapType = MapType.normal,this.compassEnabled = false, this.myLocationEnabled = true});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GoogleMap(
|
|
mapType: mapType,
|
|
zoomControlsEnabled: false,
|
|
myLocationEnabled: myLocationEnabled,
|
|
compassEnabled: compassEnabled,
|
|
initialCameraPosition: currentLocation,
|
|
onCameraMove: (value) => onCameraMoved(value),
|
|
onMapCreated: (GoogleMapController controller) {
|
|
|
|
_controller.complete(controller);
|
|
},
|
|
);
|
|
}
|
|
} |