XL constructor

const XL({
  1. Key? key,
  2. required List<Widget> layers,
  3. bool sharesPointer = true,
  4. bool sharesSensors = false,
  5. Dragging dragging = const Dragging(),
  6. Normalization normalization = const Normalization(),
  7. Duration duration = const Duration(milliseconds: 250),
  8. Curve curve = Curves.ease,
  9. bool useLocalPosition = true,
  10. ReferencePosition referencePosition = ReferencePosition.center,
  11. VoidCallback? onPointerEnter,
  12. VoidCallback? onPointerExit,
  13. VoidCallback? onCompensation,
})

A Widget that allows the definition of a stack of XLayers and/or PLayers and that will intrinsically animate them with a parallax effect based on sensor events (X) or pointer data (P).

Layers

A list of XLayers and/or PLayers, each with their own animatable properties.

Sharing Input

If this XL has both XLayers and PLayers, control the sharing of sensors or pointer data with the opposing Layer variety with the respective flags:

  • sharesPointer provides pointer data to XLayers
  • sharesSensors provides sensors data to PLayers

Dragging

A parameter class that primarily pertains to PLayers and their parallax animation during an active drag or pointer hover event.

Normalization

A parameter class that primarily pertain to XLayers for customizing the intake of SensorEvent data.

Animation

The default duration and curve for this XL's parallax animations are controlled with these properties.

This applies when the layers are being transformed by sensor data or are resetting/autocompensating.

When PLayers are actively hovered/touched, Dragging applies instead.

Void Callbacks

For Function performance on state-change:

  • onPointerEnter
  • onPointerExit
  • onCompensation

Implementation

const XL({
  Key? key,
  required this.layers,
  this.sharesPointer = true,
  this.sharesSensors = false,
  this.dragging = const Dragging(),
  this.normalization = const Normalization(),
  this.duration = const Duration(milliseconds: 250),
  this.curve = Curves.ease,
  this.useLocalPosition = true,
  this.referencePosition = ReferencePosition.center,
  this.onPointerEnter,
  this.onPointerExit,
  this.onCompensation,
}) : super(key: key);