drawRect method

void drawRect(
  1. double x,
  2. double y,
  3. double width,
  4. double height, {
  5. Texture? texture,
  6. ColorList? colors,
})

Draws a filled rectangle at (x, y) with the given width and height.

If a texture is provided, it will be mapped to the rectangle. Otherwise, it's filled with the current color (or colors if specified).

  • x: The x-coordinate of the top-left corner.
  • y: The y-coordinate of the top-left corner.
  • width: The width of the rectangle.
  • height: The height of the rectangle.
  • texture: An optional Texture to apply. Defaults to a white texture.
  • colors: An optional list of Color objects for per-vertex coloring. Colors are applied in order: top-left, bottom-left, top-right, bottom-right.

Implementation

void drawRect(double x, double y, double width, double height, {Texture? texture, ColorList? colors}) {
  texture ??= Texture.white;
  drawTexture(Texture.white, x: x, y: y, width: width, height: height, colors: colors);
}