'Set opacity color in google map polygon in Flutter

Is somebody know how can I set the opacity color in my polygon coordinates, I just want the black background in my polygon set the color to purple which has the opacity color and same also to the border of the polygon. It is possible?.It would be great if anybody could figure out, thank you so much in advance!.

enter image description here

my polygon

  Set<Polygon> myPolygon() {
    List<LatLng> polygonCoords = new List();
    polygonCoords.add(LatLng(8.9442, 125.5321));
    polygonCoords.add(LatLng(8.9486, 125.5364));
    polygonCoords.add(LatLng(8.9303, 125.5384));
    polygonCoords.add(LatLng(8.9442, 125.5321));
    Set<Polygon> polygonSet = new Set();
    polygonSet.add(Polygon(
        polygonId: PolygonId('test'),
        points: polygonCoords,
        strokeColor: Colors.red));  //color of the border
    return polygonSet;
  }

My google map

  @override
  Widget build(BuildContext context){
    return Scaffold(
        backgroundColor: Colors.deepOrange,
        appBar: AppBar(
          title: Text('Google Map API'),
        ),
        body:Padding(
            padding: EdgeInsets.only(bottom: 16.0),
            child: GoogleMap(
              onMapCreated:  _onMapCreated,
              polygons: myPolygon(), markers: _markers,
              mapType: MapType.normal,
              initialCameraPosition:CameraPosition(target: LatLng(8.9405, 125.5364),
                zoom: 15,
            ))
        ),
    );
  }


Solution 1:[1]

Add-on to @JimChiu's answer, you can use hex color like this,

class HexColor extends Color {
  HexColor(final String hexColor) : super(_getColorFromHex(hexColor));

  static int _getColorFromHex(String hexColor) {
    hexColor = hexColor.toUpperCase().replaceAll('#', '');
    if (hexColor.length == 6) {
      hexColor = 'FF' + hexColor;
    }
    return int.parse(hexColor, radix: 16);
  }
}

And you can use like this.

polygonSet.add(Polygon(
        polygonId: PolygonId('test'),
        points: polygonCoords,
        strokeColor: HexColor('#88F04857')));

Solution 2:[2]

You can simply use the code for desired opacity of any color from the drop-down that appears when you start typing the name of color after Colors, like Colors.red. For example, it could be Colors.red[100].

Solution 3:[3]

Use tibble:rownames_to_column:

tibble::rownames_to_column(Data_Null, var ="Variables")

# A tibble: 6 x 2
  Variables           Null
  <chr>              <dbl>
1 Year                   0
2 Month                  0
3 Day                    0
4 Hour                   0
5 Id_Type                1
6 Code_Intersecction     1

Solution 4:[4]

Base R:

Data$Variables <- rownames(Data)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gunaseelan
Solution 2 Sagar Darekar
Solution 3 Maël
Solution 4 TarJae