Layer constructor
Creates a new layer with optional properties.
The id
parameter can be used to provide a custom identifier for the layer.
The offset
parameter determines the position offset of the widget.
The rotation
parameter sets the rotation angle of the widget in degrees (default is 0).
The scale
parameter sets the scale factor of the widget (default is 1).
The flipX
parameter controls horizontal flipping (default is false).
The flipY
parameter controls vertical flipping (default is false).
Implementation
Layer({
String? id,
Offset? offset,
double? rotation,
double? scale,
bool? flipX,
bool? flipY,
}) {
// Initialize properties with provided values or defaults.
this.id = id ?? _generateUniqueId();
this.offset = offset ?? const Offset(64, 64);
this.rotation = rotation ?? 0;
this.scale = scale ?? 1;
this.flipX = flipX ?? false;
this.flipY = flipY ?? false;
}