maps_curved_line 1.0.2 copy "maps_curved_line: ^1.0.2" to clipboard
maps_curved_line: ^1.0.2 copied to clipboard

A package to help draw curved lines on Google Maps. This can be used as a cost effective way draw a route between location A and location B.

maps_curved_line #

pub package

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
        .
        .
      ),
    );
  }
}
33
likes
130
pub points
86%
popularity

Publisher

unverified uploader

A package to help draw curved lines on Google Maps. This can be used as a cost effective way draw a route between location A and location B.

Repository (GitLab)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, google_maps_flutter

More

Packages that depend on maps_curved_line