minOpacity property

double? minOpacity

Specifies the minimum opacity applies to the shape or bubble while using from and to.

The shapes or bubbles with lowest value which is from will be applied a minOpacity and the shapes or bubbles with highest value which is to will be applied a maxOpacity. The shapes or bubbles with values in- between the range will get a opacity based on their respective value.

late List<Model> _data;
late MapShapeSource _mapSource;

 void initState() {

   _data = <Model>[
    Model('India', 280, "Low"),
    Model('United States of America', 190, "High"),
    Model('Pakistan', 37, "Low"),

   _mapSource = MapShapeSource.asset(
     shapeDataField: "name",
     dataCount: _data.length,
     primaryValueMapper: (int index) {
       return _data[index].country;
     shapeColorValueMapper: (int index) {
        return _data[index].storage;
     shapeColorMappers: [
          value: "Low",
          color: Colors.red,
          minOpacity: 0.3,
          maxOpacity: 0.7),
          value: "High",
          color: Colors.green,
          minOpacity: 0.5,
          maxOpacity: 0.9)

 Widget build(BuildContext context) {
   return SfMaps(
     layers: [
         source: _mapSource,

class Model {
 const Model(this.country, this.count, this.storage);

 final String country;
 final double count;
 final String storage;

See also:


final double? minOpacity;