ShapesGenerator.randomly constructor
ShapesGenerator.randomly({
- required double maxWidth,
- required double maxHeight,
- double minWidth = 0,
- double minHeight = 0,
- bool enableXMovements = DefaultenableXMovements,
- bool enableYMovements = DefaultenableYMovements,
- double maxSize = DefaultmaxSize,
- double minSize = DefaultminSize,
- double maxOpacity = DefaultmaxOpacity,
- double minOpacity = DefaultminOpacity,
- required List<
ItemBehaviour> behaviours, - required List<
Color> colors, - double maxSpeed = DefaultmaxSpeed,
- double minSpeed = DefaultminSpeed,
- 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();
}