JoystickComponent constructor
JoystickComponent({
- PositionComponent? knob,
- PositionComponent? background,
- Vector2? position,
- EdgeInsets? margin,
- double? size,
- double? knobRadius,
- Anchor anchor = Anchor.center,
- Iterable<
Component> ? children, - int? priority,
- 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;
}