RectButtonComponent constructor

RectButtonComponent({
  1. required void onPressed(),
  2. required String label,
  3. required Vector2? size,
  4. required Vector2? position,
  5. required Color color,
  6. Color? pressedColor,
  7. Color textColor = Colors.white,
})

Creates a RectButtonComponent.

onPressed is the callback triggered when the button is pressed. label is the text displayed on the button. size 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

RectButtonComponent({
  required this.onPressed,
  required this.label,
  required super.size,
  required super.position,
  required this.color,
  Color? pressedColor,
  this.textColor = Colors.white,
}) : pressedColor = pressedColor ?? color,
     currentColor = color;