flutter_map icon indicating copy to clipboard operation
flutter_map copied to clipboard

[BUG] when onPositionChanged is called because of controller.move the position is before the move

Open SecretUnicorn opened this issue 2 years ago • 0 comments

What is the bug?

When moving via controller.move() the onPositionChanged position attribute does not hold the correct bounds. The southwest and northeast corner are the same. When slightly moving the map again after the move the bounds are correct.

What is the expected behaviour?

The position attribute of the controller should hold the correct bounds

How can we reproduce this issue?

FlutterMap(
      options: MapOptions(
        onPositionChanged: onMapChanged,
      ),

mapController.move(
                pointOfIntrest,
                mapController.zoom,
              );

 void onMapChanged(MapPosition position, bool gesture) {
    if (_mapChangeDebounce?.isActive ?? false) {
      _mapChangeDebounce!.cancel();
    }
    _mapChangeDebounce = Timer(
      const Duration(
        milliseconds: 500,
      ),
      () {
        Provider.of<GeoProvider>(context, listen: false)
            .fetchSearchesInBoundingBox(
          position.bounds!.southWest!,
          position.bounds!.northEast!,
        );
      },
    );

Do you have a potential solution?

No response

Can you provide any other information?

No response

Platforms Affected

Android

Severity

Obtrusive: Prevents normal functioning but causes no errors in the console

Frequency

Consistently: Always occurs at the same time and location

Requirements

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

SecretUnicorn avatar Sep 23 '22 19:09 SecretUnicorn