fix add marker style
This commit is contained in:
parent
be8b0d3b66
commit
7182e0e324
@ -42,7 +42,7 @@ class Mapboxpages extends StatefulWidget {
|
|||||||
|
|
||||||
class _MapboxpagesState extends State<Mapboxpages> with ShowErrorDialog {
|
class _MapboxpagesState extends State<Mapboxpages> with ShowErrorDialog {
|
||||||
late String mapboxAccessToken;
|
late String mapboxAccessToken;
|
||||||
MapboxMapController? mapController; // Mark mapController as nullable
|
late MapboxMapController mapController; // Mark mapController as nullable
|
||||||
double longitude = 0.0;
|
double longitude = 0.0;
|
||||||
double latitude = 0.0;
|
double latitude = 0.0;
|
||||||
bool isLoading = true;
|
bool isLoading = true;
|
||||||
@ -100,10 +100,12 @@ class _MapboxpagesState extends State<Mapboxpages> with ShowErrorDialog {
|
|||||||
return data.buffer.asUint8List();
|
return data.buffer.asUint8List();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the map is created
|
void _onMapCreated(MapboxMapController controller) {
|
||||||
void _onMapCreated(MapboxMapController controller) async {
|
|
||||||
mapController = controller;
|
mapController = controller;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when the map is created
|
||||||
|
void _onStyleLoaded() async {
|
||||||
// Log the map controller and coordinates
|
// Log the map controller and coordinates
|
||||||
print("Mapbox controller initialized: $mapController");
|
print("Mapbox controller initialized: $mapController");
|
||||||
print("lat - long : $latitude - $longitude");
|
print("lat - long : $latitude - $longitude");
|
||||||
@ -152,6 +154,7 @@ class _MapboxpagesState extends State<Mapboxpages> with ShowErrorDialog {
|
|||||||
: MapboxMap(
|
: MapboxMap(
|
||||||
accessToken: mapboxAccessToken, // Your Mapbox API key
|
accessToken: mapboxAccessToken, // Your Mapbox API key
|
||||||
onMapCreated: _onMapCreated,
|
onMapCreated: _onMapCreated,
|
||||||
|
onStyleLoadedCallback: _onStyleLoaded,
|
||||||
initialCameraPosition: CameraPosition(
|
initialCameraPosition: CameraPosition(
|
||||||
target: LatLng(latitude, longitude),
|
target: LatLng(latitude, longitude),
|
||||||
zoom: 14.0,
|
zoom: 14.0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user