map_view flutter,如何更改插件以添加变量位置纬度和经度

时间:2018-04-19 17:43:00

标签: google-maps plugins flutter

您好我不知道如何更改map_view插件:localition.dart,以便能够使用可变纬度和经度。不是修复lat,而是目前的。

https://github.com/apptreesoftware/flutter_google_map_view/tree/master/lib

locations.dart(plugin map_view):

import 'location.dart';

class Locations {
  static Location portland = new Location(37.0902, 37.0902);
  static Location centerOfUSA = new Location(37.0902, -95.7192);
}

main.dart(app):

@override
initState() {
super.initState();


cameraPosition = new CameraPosition(Locations.portland, 2.0);
staticMapUri = staticMapProvider.getStaticUri(Locations.portland, 20,
    width: 900, height: 400, mapType: StaticMapViewType.hybrid );
}

我想用双拉和双倍更改更改波特兰。

1 个答案:

答案 0 :(得分:0)

Locations.portland只是一个可能用于测试或其他东西的例子。您可以使用new Location(<your latitude>, <your longitude>);,即new Location(48.8583,2.2944);来使用您想要的任何位置。

那就是

staticMapUri = staticMapProvider.getStaticUri(
  new Location(48.8583,2.2944), 20,
  width: 900, height: 400, mapType: StaticMapViewType.hybrid,
);