Shape class

Represents the physical manifestation of a shape, such as a moving circle, icon, image, etc.

When creating an instance of this class, provide the following parameters:

  • pos The initial position of the shape.
  • dx The speed of the shape on the X-axis.
  • dy The speed of the shape on the Y-axis.
  • size The size of the shape.
  • color The color of the shape.
  • whenOutOfScreenMode The behavior of the shape at the screen edge (see WhenOutOfScreenMode for more details).
  • behaviour The behavior of the shape at the screen edge (see ItemBehaviour for more details). ignore: must_be_immutable

Constructors

Shape({required Offset pos, required double dx, required double dy, required double size, required Color color, required WhenOutOfScreenMode whenOutOfScreenMode, required ItemBehaviour behaviour})

Properties

behaviour ↔ ItemBehaviour
getter/setter pair
color ↔ Color
getter/setter pair
dx ↔ double
getter/setter pair
dy ↔ double
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
pos ↔ Offset
getter/setter pair
props → List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
size ↔ double
getter/setter pair
stringify → bool?
If set to true, the toString method will be overridden to output this instance's props.
no setter
whenOutOfScreenMode ↔ WhenOutOfScreenMode
getter/setter pair

Methods

delta(double width, double height) → void
deltaNone(double width, double height) → void
deltaReflect(double width, double height) → void
deltaTeleport(double width, double height) → void
draw(Canvas canvas) → void
drawCircles(Canvas canvas, List<double> sizes) → void
Draws multiple circles with centers positioned at pos.
drawIcon(Canvas canvas) → void
drawImage(Canvas canvas) → void
drawSquares(Canvas canvas, List<double> sizes) → void
Draws multiple squares with centers positioned at pos.
getPaint() → Paint
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited