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

Run Sample App #397

Closed
bruceo-beflex opened this issue Aug 19, 2019 · 2 comments
Closed

Run Sample App #397

bruceo-beflex opened this issue Aug 19, 2019 · 2 comments

Comments

@bruceo-beflex
Copy link

class MapWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new FlutterMap(
      layers: [
        TileLayerOptions(
            urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
            subdomains: ['a', 'b', 'c']),
      ],
      options: MapOptions(
        center: LatLng(51, 32),
        zoom: 5.0,
      ),
    );
  }
}

with sample code, i keep getting an error

flutter: ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
flutter: The following UnsupportedError was thrown building LayoutBuilder:
flutter: Unsupported operation: Infinity or NaN toInt
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #0 double.toInt (dart:core-patch/double.dart:183:36)
flutter: #1 double.round (dart:core-patch/double.dart:151:34)
flutter: #2 CustomPoint.round
package:flutter_map/…/core/point.dart:42
flutter: #3 MapState.getNewPixelOrigin
package:flutter_map/…/map/map.dart:272
flutter: #4 MapState.size=
package:flutter_map/…/map/map.dart:91
flutter: #5 FlutterMapState.build.
package:flutter_map/…/map/flutter_map_state.dart:92
flutter: #6 _LayoutBuilderElement._layout.

CustomPoint getNewPixelOrigin(LatLng center, [double zoom]) {
var viewHalf = size / 2.0;
return (project(center, zoom) - viewHalf).round();
}

CustomPoint round() {
var x = this.x is double ? this.x.round() : this.x;
var y = this.y is double ? this.y.round() : this.y;
return CustomPoint(x, y);
}

when it runs round(), it causes an exception error and it say x is infinity on debug point.

Am I doing something wrong?

@wpietri
Copy link
Contributor

wpietri commented Aug 31, 2019

Hi, @bruceGwanhoOh. I'm getting the same issue. Since you closed this, does this mean you found a way to fix it? Like you, I'm just using the sample code.

@wpietri
Copy link
Contributor

wpietri commented Aug 31, 2019

Ah, I think I'm starting to get this. When I look at this, my MapState.size is being set to CustomPoint (411.42857142857144, Infinity). That appears to be a legitimate value, as box.dart:164 explicitly says infinity is an allowed value. So am I supposed to wrap this in another widget? Right now I just have it in a column.

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

2 participants