maplibre/flutter-maplibre-gl

[BUG] initialCameraPosition argument ignores targets' latitude

baurzhan opened this issue · 0 comments

Description:
When using the flutter_maplibre_gl package to set the initial camera position, the specified latitude value for the target location appears to be ignored. Regardless of the latitude value provided, the map centers incorrectly, which affects the initial view of the map.

Steps to Reproduce:

  1. Create a new Flutter application.
  2. Add the flutter_maplibre_gl package to pubspec.yaml.
  3. Configure the MaplibreMap widget with an initialCameraPosition specifying a target latitude.
  4. Run the application and observe the map's initial center.

Expected Behavior:
The map should center on the specified target latitude provided in the initialCameraPosition argument.

Actual Behavior:
The map ignores the target latitude and centers incorrectly, displaying a different initial location.

Code Example:

import 'package:flutter/material.dart';
import 'package:maplibre_gl/maplibre_gl.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Maplibre GL Latitude Issue'),
        ),
        body: MaplibreMapWidget(),
      ),
    );
  }
}

class MaplibreMapWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaplibreMap(
      initialCameraPosition: const CameraPosition(
        target: const LatLng(43.256900680871915, 76.90517963197661),
        zoom: 14.0,
      ),
      styleString: 'mapbox://styles/mapbox/streets-v11', // Example style
    );
  }
}

Environment:

  • Flutter version: 3.19.6
  • flutter_maplibre_gl version: master
  • Platform: all

Additional Context:
The issue persists regardless of the latitude value provided. The map consistently centers on an incorrect location, indicating that the latitude value might be ignored or overwritten.