我在颤振中实现了一条折线
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 包,我试图指示我的路线方向。