Skip to content

[BUG] Changing CRS Does Not Rebuild Other Children #1322

@yang6626

Description

@yang6626

What is the bug?

hi there

flutter_map: 2.0.0

in my case, i have 2 diffenert crs epsg4490 and epsg3857 , let's say we set it as 4490 in the first time and has a polyline on map. when i press a button to switch crs to 3857, the polyline disappear untill i move the map.

What is the expected behaviour?

the polyline still there when change crs.

How can we reproduce this issue?

FlutterMap(
              mapController: _mapController,
              options: MapOptions(
                  crs: _currentMapIndex == 0 ? epsg4490 : const Epsg3857(),
                  center: LatLng(23.388149672864074, 116.7156679026907),
                  interactiveFlags:
                      InteractiveFlag.all & ~InteractiveFlag.rotate,
                  zoom: 14,
                  minZoom: 0,
                  maxZoom: 22),
              children: [
                ..._buildBaseMap(),
                PolylineLayerWidget(
                    options: PolylineLayerOptions(polylines: [
                  Polyline(strokeWidth: 4, color: Colors.red, points: [
                    LatLng(23.3884495, 116.7191143),
                    LatLng(23.3806962, 116.7124767),
                    LatLng(23.3799523, 116.7246074),
                    LatLng(23.3716553, 116.7208881),
                  ])
                ])),
                Positioned(
                  bottom: 20,
                  left: 20,
                  child: TextButton(
                    onPressed: () {
                      _currentMapIndex = _currentMapIndex == 0 ? 1 : 0;
                      setState(() {});
                    },
                    child: const Text("切换"),
                  ),
                )
              ],
            )

Do you have a potential solution?

No response

Can you provide any other information?

No response

Platforms Affected

Android, iOS

Severity

Erroneous: Prevents normal functioning and causes errors in the console

Frequency

Consistently: Always occurs at the same time and location

Requirements

  • I agree to follow this project's Code of Conduct
  • My Flutter/Dart installation is unaltered, and flutter doctor finds no relevant issues
  • I am using the latest stable version of this package
  • I have checked the FAQs section on the documentation website
  • I have checked for similar issues which may be duplicates

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue reports broken functionality or another errorneeds triageThis new bug report needs reproducing and prioritizing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions