TreemapTooltipSettings class
Customizes the appearance of the tooltip.
late List<SocialMediaUsers> _socialMediaUsersData;
@override
void initState() {
_socialMediaUsersData = <SocialMediaUsers>[
SocialMediaUsers('India', 'Facebook', 280),
SocialMediaUsers('India', 'Instagram', 88),
SocialMediaUsers('USA', 'Facebook', 190),
SocialMediaUsers('USA', 'Instagram', 120),
SocialMediaUsers('Japan', 'Twitter', 48),
SocialMediaUsers('Japan', 'Instagram', 31),
];
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: SfTreemap(
dataCount: _socialMediaUsersData.length,
weightValueMapper: (int index) {
return _socialMediaUsersData[index].usersInMillions;
},
tooltipSettings: TreemapTooltipSettings(
color: Colors.blue,
borderWidth: 2.0,
borderColor: Colors.white,
),
levels: [
TreemapLevel(
padding: EdgeInsets.all(2),
groupMapper: (int index) {
return _socialMediaUsersData[index].country;
},
color: Colors.red,
tooltipBuilder: (BuildContext context, TreemapTile tile) {
return Padding(
padding: EdgeInsets.all(10.0),
child: Text(
'Country ${tile.group}' + '\n Users ${tile.weight}'),
);
}),
],
),
);
}
class SocialMediaUsers {
const SocialMediaUsers(
this.country,
this.socialMedia,
this.usersInMillions,
);
final String country;
final String socialMedia;
final double usersInMillions;
}
See also:
- TreemapLevel.tooltipBuilder, to enable the tooltip.
- Inheritance
-
- Object
- DiagnosticableTree
- TreemapTooltipSettings
- Annotations
Constructors
- TreemapTooltipSettings({Color? color, double hideDelay = 3.0, Color? borderColor, double borderWidth = 1.0, BorderRadiusGeometry borderRadius = const BorderRadius.all(Radius.circular(4.0))})
-
Creates TreemapTooltipSettings.
const
Properties
- borderColor → Color?
-
Specifies the border color applies to the tooltip.
final
- borderRadius → BorderRadiusGeometry
-
Specifies the border radius applies to the tooltip.
final
- borderWidth → double
-
Specifies the border width applies to the tooltip.
final
- color → Color?
-
Fills the tooltip by this color.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- hideDelay → double
-
Specifies the tooltip hide delay duration
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
copyWith(
{Color? color, double? hideDelay, Color? borderColor, double? borderWidth, BorderRadiusGeometry? borderRadius}) → TreemapTooltipSettings - 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.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent 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