M
maps_curved_line
maps_curved_line
A package to help draw curved lines on Google Maps. Generates a list of LatLng which can be used to render a curved polyline between the given start and end LatLng.
Installation
First, add maps_curved_lines
as a dependency in your pubspec.yaml file.
Usage:
import 'package:maps_curved_line/maps_curved_line.dart';
.
.
class _MapsPageState extends State<MapsPage> {
final Set<Polyline> _polylines = Set();
final LatLng _point1 = LatLng(12.947437, 77.681345);
final LatLng _point2 = LatLng(12.948767, 77.689120);
@override
Widget build(BuildContext context) {
_polylines.add(
Polyline(
polylineId: PolylineId("line 1"),
visible: true,
width: 2,
//latlng is List<LatLng>
patterns: [PatternItem.dash(30), PatternItem.gap(10)],
points: MapsCurvedLines.getPointsOnCurve(_point1, _point2), // Invoke lib to get curved line points
color: Colors.blue,
)
);
return new Scaffold(
body: GoogleMap(
// Configure google maps widget are required
.
polylines: _polylines, // Add constructed polyline for curved line
.
.
),
);
}
}