AutoXL constructor

const AutoXL({
  1. Key? key,
  2. double depthFactor = 20.0,
  3. required List<Widget> layers,
  4. bool supportsPointer = true,
  5. bool supportsSensors = true,
  6. int depth = -1,
  7. Duration duration = const Duration(milliseconds: 200),
  8. Curve curve = Curves.ease,
  9. Duration drag = const Duration(milliseconds: 100),
})

Deploy an AutoXL to simplify the setup of an XL stack.

Provide List<Widget> layers and double depthFactor (and optionally a max depth for parallax effects) to create an XL with progressively more parallax-reactive layers.

Override duration and curve to control parallax animation.

Default depth == -1 which means no max layer depth for parallax effects.

Default depthFactor == 20.0 which is between AutoXL.wiggler and AutoXL.deep.

Implementation

const AutoXL({
  Key? key,
  double depthFactor = 20.0,
  required this.layers,
  this.supportsPointer = true,
  this.supportsSensors = true,
  this.depth = -1,
  this.duration = const Duration(milliseconds: 200),
  this.curve = Curves.ease,
  this.drag = const Duration(milliseconds: 100),
})  : _threeD = (!supportsPointer && !supportsSensors) ? 0 : 0.0015,
      _baseOffset =
          (!supportsPointer && !supportsSensors) ? 0 : depthFactor - 10,
      _layerOffset = (!supportsPointer && !supportsSensors) ? 0 : depthFactor,
      _baseRotation =
          (!supportsPointer && !supportsSensors) ? 0 : depthFactor * 0.0025,
      _layerRotation =
          (!supportsPointer && !supportsSensors) ? 0 : depthFactor * 0.001,
      _baseZ =
          (!supportsPointer && !supportsSensors) ? 0 : depthFactor * 0.0015,
      _layerZ =
          (!supportsPointer && !supportsSensors) ? 0 : depthFactor * 0.0015,
      super(key: key);