CircleButtonComponent constructor
CircleButtonComponent({})
Creates a CircleButtonComponent.
onPressed is the callback triggered when the button is pressed.
label is the text displayed on the button.
sprite is the sprite displayed on the button.
radius and position define the size and position of the button.
color is the default background color.
pressedColor is the background color when pressed. Defaults to color.
textColor is the color of the label text.
Implementation
CircleButtonComponent({
required this.onPressed,
String? label,
required this.radius,
required super.position,
required this.color,
this.paintStyle = PaintingStyle.fill,
Sprite? sprite,
Color? pressedColor,
this.textColor = Colors.white,
}) : assert(radius > 0, 'Radius must be greater than zero'),
assert(
sprite == null || label == null,
'Cannot set both sprite and label on CircleButtonComponent',
),
_label = label,
_sprite = sprite,
pressedColor = pressedColor ?? color,
paint =
Paint()
..color = color
..style = paintStyle;