JoystickComponent constructor

JoystickComponent({
  1. PositionComponent? knob,
  2. PositionComponent? background,
  3. Vector2? position,
  4. EdgeInsets? margin,
  5. double? size,
  6. double? knobRadius,
  7. Anchor anchor = Anchor.center,
  8. Iterable<Component>? children,
  9. int? priority,
  10. ComponentKey? key,
})

Implementation

JoystickComponent({
  this.knob,
  this.background,
  super.position,
  EdgeInsets? margin,
  double? size,
  double? knobRadius,
  Anchor super.anchor = Anchor.center,
  super.children,
  super.priority,
  super.key,
}) : assert(
       size != null || background != null,
       'Either size or background must be defined',
     ),
     assert(
       (knob?.position.isZero() ?? true) &&
           (background?.position.isZero() ?? true),
       'Positions should not be set for the knob or the background',
     ),
     super(
       size: background?.size ?? Vector2.all(size ?? 0),
     ) {
  this.margin = margin;
  this.knobRadius = knobRadius ?? this.size.x / 2;
}