MapBubbleSettings class Null safety

Customizes the appearance of the bubbles.

It is possible to customize the radius, color, opacity and stroke of the bubbles.

late List<Model> _data;
late MapShapeSource _mapSource;

 @override
 void initState() {
   super.initState();

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

   _mapSource = MapShapeSource.asset(
     "assets/world_map.json",
     shapeDataField: "name",
     dataCount: _data.length,
     primaryValueMapper: (int index) {
       return _data[index].country;
     },
     bubbleSizeMapper: (int index) {
       return _data[index].count;
     },
   );
 }

 @override
 Widget build(BuildContext context) {
   return SfMaps(
     layers: [
       MapShapeLayer(
         source: _mapSource,
         bubbleSettings: MapBubbleSettings(maxRadius: 10, minRadius: 2),
       )
     ],
   );
 }

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

 final String country;
 final double count;
 final String storage;
}
Inheritance
Annotations

Constructors

MapBubbleSettings({double minRadius = 10.0, double maxRadius = 50.0, Color? color, double? strokeWidth, Color? strokeColor})
Creates a MapBubbleSettings.
const

Properties

color Color?
Default color of the bubbles. [...]
final
hashCode int
The hash code for this object. [...]
read-only, override
maxRadius double
Maximum radius of the bubble. [...]
final
minRadius double
Minimum radius of the bubble. [...]
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
strokeColor Color?
Stroke color of the bubbles. [...]
final
strokeWidth double?
Stroke width of the bubbles. [...]
final

Methods

copyWith({double? minRadius, double? maxRadius, Color? color, double? strokeWidth, Color? strokeColor}) MapBubbleSettings
Creates a copy of this class but with the given fields replaced with the new values.
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children. [...]
@protected, inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep. [...]
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object. [...]
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants. [...]
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object. [...]
inherited
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
override