我已经在抖动中实现了一条折线
Map<PolylineId, Polyline> _mapPolylines = {};
int _polylineIdCounter = 1;
void _add() {
final String polylineIdVal = 'polyline_id_$_polylineIdCounter';
_polylineIdCounter++;
final PolylineId polylineId = PolylineId(polylineIdVal);
final Polyline polyline = Polyline(
polylineId: polylineId,
consumeTapEvents: true,
color: Colors.red,
width: 5,
jointType: JointType.round,
points: points, //_createPoints(),
);
setState(() {
_mapPolylines[polylineId] = polyline;
});
}
并在地图上显示
return new GoogleMap(
mapType: MapType.normal,
markers: Set.from(Markers),
initialCameraPosition: _kGooglePlex,
polylines: Set<Polyline>.of(_mapPolylines.values),
onMapCreated: (GoogleMapController controller) async {
_controller.complete(controller);
});
我正在使用google_maps_flutter软件包,并试图指示到达我的路线的方向。