fix add marker style

This commit is contained in:
Valentin CZERYBA 2024-11-15 22:48:05 +01:00
parent be8b0d3b66
commit 7182e0e324

View File

@ -42,7 +42,7 @@ class Mapboxpages extends StatefulWidget {
class _MapboxpagesState extends State<Mapboxpages> with ShowErrorDialog {
late String mapboxAccessToken;
MapboxMapController? mapController; // Mark mapController as nullable
late MapboxMapController mapController; // Mark mapController as nullable
double longitude = 0.0;
double latitude = 0.0;
bool isLoading = true;
@ -100,10 +100,12 @@ class _MapboxpagesState extends State<Mapboxpages> with ShowErrorDialog {
return data.buffer.asUint8List();
}
// Called when the map is created
void _onMapCreated(MapboxMapController controller) async {
void _onMapCreated(MapboxMapController controller) {
mapController = controller;
}
// Called when the map is created
void _onStyleLoaded() async {
// Log the map controller and coordinates
print("Mapbox controller initialized: $mapController");
print("lat - long : $latitude - $longitude");
@ -152,6 +154,7 @@ class _MapboxpagesState extends State<Mapboxpages> with ShowErrorDialog {
: MapboxMap(
accessToken: mapboxAccessToken, // Your Mapbox API key
onMapCreated: _onMapCreated,
onStyleLoadedCallback: _onStyleLoaded,
initialCameraPosition: CameraPosition(
target: LatLng(latitude, longitude),
zoom: 14.0,