Flutter google maps , how to make a gradient in polylines?

597

If you are using google_maps_flutter package, it seems that the feature to add a gradient polyline is not yet available for this package as there's an existing feature request to support gradient colors to polyline/plolygons.

However, if you are using flutter_map package, perhaps you can try this.

Share:
597
Nick Korolev
Author by

Nick Korolev

Updated on December 21, 2022

Comments

  • Nick Korolev
    Nick Korolev over 1 year

    Is there any way to make the polylines a gradient, and not just the same color?

    That code is working well = polylines created but i can't add gradient //Create polylines

      void _setPolylLines() {
        _polylines.add(
          Polyline(
            polylineId: PolylineId("polylineHistoryRoute"),
            points: polyLinesLatLongs,
            width: 4,
            patterns: <PatternItem>[PatternItem.dash(25), PatternItem.gap(15)],
            color: Color.fromRGBO(86, 168, 235, 1),
          ),
        );
      }
    
  • Nick Korolev
    Nick Korolev almost 4 years
    Thanks for the answer. I already found out that so far the gradient in the package google_maps_flutter is not supported