Layer constructor

Layer({
  1. String? id,
  2. Offset? offset,
  3. double? rotation,
  4. double? scale,
  5. bool? flipX,
  6. bool? flipY,
})

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,
}) {
  key = GlobalKey();
  // 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;
}