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

How to zoom on a polyline? #602

Closed
vinnytwice opened this issue Apr 26, 2020 · 2 comments
Closed

How to zoom on a polyline? #602

vinnytwice opened this issue Apr 26, 2020 · 2 comments

Comments

@vinnytwice
Copy link

Hi I'm trying to zoom on the polyline drawn from a List route, but when loading the map I get this error:
´´´
════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following assertion was thrown building RoutesCell(dirty):
'package:flutter_map/flutter_map.dart': Failed assertion: line 142 pos 12: '!isOutOfBounds(center)': is not true.

Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=BUG.md

The relevant error-causing widget was:
RoutesCell file:///Volumes/archivi%20recuperati/Flutter%20apps%20/fixit_cloud_biking/lib/Screens/routes_screen.dart:83:67
When the exception was thrown, this was the stack:
#2 new MapOptions (package:flutter_map/flutter_map.dart:142:12)
#3 RoutesCell.build (package:fixit_cloud_biking/models/my_routes_cell.dart:19:22)
#4 StatelessElement.build (package:flutter/src/widgets/framework.dart:4291:28)
#5 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4223:15)
#6 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
...
════════════════════════════════════════════════════════════════════════════════════════════════════
´´´
this is how I set flutter_map:


          FlutterMap(
            options: MapOptions(
//              center: route.coordinates.first,
              nePanBoundary:
                  LatLngBounds.fromPoints(route.coordinates).northEast,
              swPanBoundary:
                  LatLngBounds.fromPoints(route.coordinates).southWest,
              zoom: 15,
//              minZoom: 5.0,
//              maxZoom: 20.0,
              interactive: true,
            ),
            mapController: _mapController,
            layers: [
              new PolylineLayerOptions(
                polylines: [Polyline(points: route.coordinates)],
              ),
            ],
          ),

What am I doing wrong?

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Mar 28, 2021
@github-actions
Copy link

github-actions bot commented Apr 2, 2021

This issue was closed because it has been stalled for 5 days with no activity.

@github-actions github-actions bot closed this as completed Apr 2, 2021
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

1 participant