reset method

void reset()

Implementation

void reset() {
  final random = Random();
  position = Offset(
    random.nextDouble() * screenSize.width,
    0,
  ); // Random start position
  size = random.nextDouble() * 30 + 20; // Random size
  speedX = random.nextDouble() * 2 - 1; // Horizontal drift (-1 to 1)
  speedY = random.nextDouble() * 3 + 2; // Downward speed (gravity)
  direction = random.nextDouble() * 1 * pi; // Random direction
  rotation = random.nextDouble() * 2 * pi; // Random rotation
  rotationSpeed = random.nextDouble() * 0.1 - 0.05; // Random rotation speed

  // Assign a random widget
  final randomIndex = random.nextInt(widgets.length);

  widget = SizedBox(
    height: size,
    width: size,
    child: widgets[randomIndex],
  );
}