Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to flutter_map v7 #47

Closed
bishen opened this issue Jun 14, 2024 · 17 comments
Closed

Upgrade to flutter_map v7 #47

bishen opened this issue Jun 14, 2024 · 17 comments

Comments

@bishen
Copy link

bishen commented Jun 14, 2024

Do you have any plans to support v7

@ibrierley
Copy link
Owner

Yes, just not in a rush atm as I think v7 needs to settle first. However, if anyone has a compelling reason, I'll try and make it happen sooner.

@manlyman29
Copy link

@ibrierley It seems that v7 does not have a major breaking change. Personally I hope to see the upgrade happen on this library sooner :)

@ibrierley
Copy link
Owner

Heya, no there's not a breaking change, but I think there is an issue on latest release so I wouldn't recommend updating yet, this issue highlights the problem with polygons vanishing.. fleaflet/flutter_map#1921 but if anyone needs a v7 version, I'll do an update.

@Henk-Keijzer
Copy link

Henk-Keijzer commented Jul 6, 2024

It seems that the issue mentioned is solved in flutter_map 7.0.2. I would really appreciate an update of this package...

@ibrierley
Copy link
Owner

Ok, weird, I think something has gone astray with some flutter_map change (maybe), I can't get the polygon example to fill the poly. I can see there has been a change to isFilled, but I don't think that's related, as it doesn't draw borders if I include those in the poly params.

@ibrierley
Copy link
Owner

ibrierley commented Jul 13, 2024

I think the problem is that in flutter_maps polygon.dart is has this line...

LatLngBounds get boundingBox =>
      _boundingBox ??= LatLngBounds.fromPoints(points);

so it's caching the bounding box now. As the poly from an editor starts with nothing, I don't think that will get updated, so I'm assuming it just gets culled for optimisation every time...

I think it can be worked around by creating a new Poly every time, so it's never cached...so the code would look something like the following code. I'm not sure if I like this or not, as on the one hand, it cuts out the normal flutter flow (I'm a bit out of touch), on the other, it's an editor so performance not such an issue here, and also maybe it's more correct...not quite sure.

Any thoughts, let me know.

final polyPoints = <LatLng>[];
  
  @override
  void initState() {
    super.initState();

    polyEditor = PolyEditor(
      addClosePathMarker: true,
      points: polyPoints,
      pointIcon: const Icon(Icons.crop_square, size: 23),
      intermediateIcon: const Icon(Icons.lens, size: 15, color: Colors.grey),
      callbackRefresh: (LatLng? _) => {setState(() {})},
    );
  }

  @override
  Widget build(BuildContext context) {

    final polygons = <Polygon>[];
    final testPolygon = Polygon(
      label: 'Label!',
      color: Colors.deepOrange,
      borderColor: Colors.red,
      borderStrokeWidth: 4,
      points: polyPoints,
    );
    polygons.add(testPolygon);

    return Scaffold(

@ibrierley
Copy link
Owner

I have raised an issue at fleaflet/flutter_map#1932 just to get some thoughts

@eidolonFIRE
Copy link

Adding my interest to v7 support... I'm eager for v7.

@moovida
Copy link
Contributor

moovida commented Sep 27, 2024

I also would love to see a v7. :-)

@moovida
Copy link
Contributor

moovida commented Sep 27, 2024

@ibrierley , how did you even get to that part? I am trying to give it a look but it fails before, when trying to create an initial LatLngBounds with no points, which is not accepted:

  factory LatLngBounds.fromPoints(List<LatLng> points) {
    assert(
      points.isNotEmpty,
      'LatLngBounds cannot be created with an empty List of LatLng',
    );

Is there something I am missing?

@ibrierley
Copy link
Owner

@ibrierley , how did you even get to that part? I am trying to give it a look but it fails before, when trying to create an initial LatLngBounds with no points, which is not accepted:

  factory LatLngBounds.fromPoints(List<LatLng> points) {
    assert(
      points.isNotEmpty,
      'LatLngBounds cannot be created with an empty List of LatLng',
    );

Is there something I am missing?

sorry, completely missed this comment...I'm just retesting the update above after the discussion in FM, will probably use the workaround...

@ibrierley
Copy link
Owner

Feel free to test the v7 branch at https://github.com/ibrierley/flutter_map_line_editor/tree/v7 and give any feedback.

If all works fine, will shove it to pub.

@moovida
Copy link
Contributor

moovida commented Oct 3, 2024

I did some tests and it looks like it is working without any issue. Thanks a lot @ibrierley

@manlyman29
Copy link

in v7 branch the flutter_map_dragmarker is constrained to v6 while the version that supports flutter_map 7 is v7

@ibrierley
Copy link
Owner

Can you clarify where you are seeing that, as I can't find v6 referenced in the pubspecs, but may have missed something.

@manlyman29
Copy link

@ibrierley Never mind, seems like a cached pub situation. pubspec.yaml looks ok. Thanks.

@ibrierley
Copy link
Owner

Ok Super.
Should be published on pub.dev now as well. Thanks for the help testing everyone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants