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/HMSMap.dart

41 lines
1.3 KiB
Dart

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:huawei_map/huawei_map.dart' ;
class HMSMap extends StatefulWidget{
final CameraPosition currentLocation;
final Function(CameraPosition) onCameraMoved;
final MapType mapType;
final bool compassEnabled;
final bool myLocationEnabled;
HMSMap({super.key, required this.currentLocation ,required this.onCameraMoved, this.mapType = MapType.normal,this.compassEnabled = false, this.myLocationEnabled = true});
@override
State<HMSMap> createState() => _HMSMapState();
}
class _HMSMapState extends State<HMSMap> {
final Completer<HuaweiMapController> _controller = Completer<HuaweiMapController>();
@override
void initState() {
HuaweiMapInitializer.initializeMap();
super.initState();
}
// @override
@override
Widget build(BuildContext context) =>
HuaweiMap(
mapType: widget.mapType,
zoomControlsEnabled: false,
myLocationEnabled: widget.myLocationEnabled,
compassEnabled: widget.compassEnabled,
initialCameraPosition: widget.currentLocation,
onCameraMove: (value) => widget.onCameraMoved(value),
onMapCreated: (HuaweiMapController controller) {
_controller.complete(controller);
},
);
}