IconComponent constructor
IconComponent({})
Creates an IconComponent that renders icon as a Flame component.
icon: The IconData to render (e.g.,Icons.star).iconSize: The resolution at which to rasterize the icon (default 64).paint: Optional paint for rendering effects.size: The display size of the component. Defaults toVector2.all(iconSize)if not specified.
Implementation
IconComponent({
IconData? icon,
double iconSize = 64,
Paint? paint,
super.position,
Vector2? size,
super.scale,
super.angle,
super.nativeAngle,
super.anchor,
super.children,
super.priority,
super.key,
}) : _icon = icon,
_iconSize = iconSize,
super(size: size ?? Vector2.all(iconSize)) {
if (paint != null) {
this.paint = paint;
}
_dstRect = this.size.toRect();
this.size.addListener(_updateDstRect);
}