ShapesGenerator.randomly constructor

ShapesGenerator.randomly({
  1. required double maxWidth,
  2. required double maxHeight,
  3. double minWidth = 0,
  4. double minHeight = 0,
  5. bool enableXMovements = DefaultenableXMovements,
  6. bool enableYMovements = DefaultenableYMovements,
  7. double maxSize = DefaultmaxSize,
  8. double minSize = DefaultminSize,
  9. double maxOpacity = DefaultmaxOpacity,
  10. double minOpacity = DefaultminOpacity,
  11. required List<ItemBehaviour> behaviours,
  12. required List<Color> colors,
  13. double maxSpeed = DefaultmaxSpeed,
  14. double minSpeed = DefaultminSpeed,
  15. WhenOutOfScreenMode whenOutOfScreenMode = DefaultwhenOutOfScreenMode,
})

Implementation

ShapesGenerator.randomly({
  required this.maxWidth,
  required this.maxHeight,
  this.minWidth = 0,
  this.minHeight = 0,
  this.enableXMovements = DefaultenableXMovements,
  this.enableYMovements = DefaultenableYMovements,
  this.maxSize = DefaultmaxSize,
  this.minSize = DefaultminSize,
  this.maxOpacity = DefaultmaxOpacity,
  this.minOpacity = DefaultminOpacity,
  required List<ItemBehaviour> behaviours,
  required List<Color> colors,
  this.maxSpeed = DefaultmaxSpeed,
  this.minSpeed = DefaultminSpeed,
  this.whenOutOfScreenMode = DefaultwhenOutOfScreenMode,
}) {
  this.behaviours = [];
  this.colors = [];
  for (ItemBehaviour b in behaviours) {
    this.behaviours.add(b);
    this.behaviours.add(b);
  }
  for (Color c in colors) {
    this.colors.add(c);
    this.colors.add(c);
  }

  this.colors.shuffle();
  this.behaviours.shuffle();
}