XLayer constructor

const XLayer({
  1. Key? key,
  2. double xOffset = 0.0,
  3. double yOffset = 0.0,
  4. double xRotation = 0.0,
  5. double yRotation = 0.0,
  6. double zRotationByX = 0.0,
  7. double zRotationByGyro = 0.0,
  8. bool enable3d = true,
  9. double dimensionalOffset = 0.001,
  10. Offset offset = const Offset(0, 0),
  11. required Widget child,
})

A Layer in an XL. These by themselves are not Widgets.

Each Layer serves as a blueprint for transformations to its child within its parent and contains all the animatable properties. Keep in mind that axes will depend on device orientation.

The xOffset, yOffset, xRotation, yRotation, and zRotationByX are reactionary to their respective axes when it comes to AccelerometerEvents.

The zRotationByGyro, however, is a secondary Z-axis "spin" factor whose core value is derived from GyroscopeEvents.

  • This means that samples from the gyroscope for Z-axis "spins" with this property, according to Normalization.samplingRate, will spike but return to 0 immediately once the device has finished "spinning".

Implementation

const XLayer({
  Key? key,
  double xOffset = 0.0,
  double yOffset = 0.0,
  double xRotation = 0.0,
  double yRotation = 0.0,
  double zRotationByX = 0.0,
  this.zRotationByGyro = 0.0,
  bool enable3d = true,
  double dimensionalOffset = 0.001,
  Offset offset = const Offset(0, 0),
  required Widget child,
}) : super(
        key: key,
        xOffset: xOffset,
        yOffset: yOffset,
        xRotation: xRotation,
        yRotation: yRotation,
        zRotation: zRotationByX,
        enable3d: enable3d,
        dimensionalOffset: dimensionalOffset,
        offset: offset,
        child: child,
      );