Layer constructor

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

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). The enableInteraction parameter controls if a user can interact with the layer

Implementation

Layer({
  String? id,
  Offset? offset,
  double? rotation,
  double? scale,
  bool? flipX,
  bool? flipY,
  bool? enableInteraction,
}) {
  key = GlobalKey();
  // Initialize properties with provided values or defaults.
  this.id = id ?? generateUniqueId();
  this.offset = offset ?? Offset.zero;
  this.rotation = rotation ?? 0;
  this.scale = scale ?? 1;
  this.flipX = flipX ?? false;
  this.flipY = flipY ?? false;
  this.enableInteraction = enableInteraction ?? true;
}