Skip to content

Issue when add multiple same Statefulwidget Marker  #86

@lidroider

Description

@lidroider

Add more than 1 Marker, which is a same StatefulWidget.
In this case, we have more than 1 StatefulWidget and each StatefulWidget can have more than 1 it's State.
The problem occurs when scroll or move map, the State of StatefulWidget can rebuild and flutter maybe map StatefulWidget and State not exactly.
I try to add key to the StatefulWidget, flutter maybe rebuild State and map to StatefulWidget exactly but it rebuild a completely new State, so they lost the previous State of the StatefulWidget.

In my case, the StatefulWidget subscribe to the ValueNotifier to receive notification from server and change icon. When I scroll or move map the the notification on StatefulWidget change to another StatefulWidget. It likes the StatefulWidget changed to notification status become normal StatefulWidget and another normal StatefulWidget become notification status StatefulWidget

I find out the code if (!latlngBounds.contains(markerOpt.point)) {continue;} in marker_layer.dart can be a reason. So I fork to (https://github.com/lidroider/flutter_map), add alwaysKeepWidget to always add StatefulWidget Marker to Map.

So anyone have any idea or other solution for this issue?

p/s: sorry for my English

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions