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.
HMG_Patient_App_New/lib/widgets/map/map.dart

53 lines
1.8 KiB
Dart

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
class GMSMap extends StatelessWidget{
Completer<GoogleMapController>? controller;
final CameraPosition currentLocation;
final Function(CameraPosition) onCameraMoved;
final VoidCallback onCameraIdle;
final MapType mapType;
final bool compassEnabled;
final bool myLocationEnabled;
final bool showCenterMarker;
GMSMap({super.key, required this.currentLocation ,required this.onCameraMoved,required this.onCameraIdle,
this.mapType = MapType.normal,this.compassEnabled = false,this.showCenterMarker = false,
this.myLocationEnabled = true,Completer<GoogleMapController>? inputController}){
controller = inputController ?? Completer<GoogleMapController>();
}
@override
Widget build(BuildContext context) {
return Stack(
children: [
GoogleMap(
mapType: mapType,
zoomControlsEnabled: false,
myLocationEnabled: myLocationEnabled,
myLocationButtonEnabled: false,
compassEnabled: compassEnabled,
initialCameraPosition: currentLocation,
onCameraMove: (value) => onCameraMoved(value),
onCameraIdle: ()=>onCameraIdle(),
onMapCreated: (GoogleMapController controller) {
this.controller?.complete(controller);
},
),
Visibility(
visible: showCenterMarker,
child: Align(
alignment: Alignment.center,
child: Utils.buildSvgWithAssets(icon: AppAssets.pin_location, width: 24.w, height: 36.h),
),
)
],
);
}
}