Foil.sheet constructor

Foil.sheet({
  1. Key? key,
  2. Sheet sheet = const Sheet(),
  3. bool isUnwrapped = false,
  4. double opacity = 1.0,
  5. bool useSensor = true,
  6. Gradient? gradient,
  7. BlendMode blendMode = BlendMode.srcATop,
  8. Scalar scalar = Scalar.identity,
  9. Gradient? unwrappedGradient,
  10. Widget? child,
  11. Duration speed = const Duration(milliseconds: 150),
  12. Duration duration = const Duration(milliseconds: 500),
  13. Curve curve = Curves.ease,
  14. VoidCallback? onEnd,
})

Create a sizeable Widget with the specified gradient and all the same properties as a standard Foil, but as its own standalone AnimatedContainer with or without a child.

Create a new Sheet for parameter sheet to stylize the container.

unwrapping Foil Paramater bool isUnwrapped toggles a Foil's invisibility. Default is false.

Accelerometer

Disable this Foil's reaction to accelerometer sensor motion by
useSensor: false. Default is true.

Influence the intensity of this Foil's reaction to accelerometer motion
by providing a custom Scalar scalar. Default is Scalar.identity
which has both a horizontal and vertical multiplier of +1.0.

(Not to be confused with a potential and optional Crinkle.scalar,
provided by wrapping Foil in a Roll and declaring Roll.crinkle.
This Scalar is used to scale axis-dependent animation values.)

Using a Roll of Foil

Optionally a Roll may be deployed higher up in the widget tree.
This ancestor offers two additional features to any Foil underneath it.

Either declare a Roll.gradient to which any descendent Foil may fallback and/or provide a Roll.crinkle to make declarations about gradient animation beyond accelerometer sensors data.

See Crinkle for more information.

Transitioning

Control how rapidly this Foil transforms its gradient with speed and define the animation curve.
Defaults are 150ms and Curves.ease.

Furthermore, provide duration to dictate how long intrinsic animations of this Foil's gradient will take. duration is also used if isUnwrapped is made true as the duration over which gradient will Gradient.lerp to an appropriately-Typed transparent gradient for tweening.

There is hard-coded recognition for linear, radial, and sweep Gradients,
as well as the additional LinearSteps, RadialSteps, and SweepSteps
variants that this package provides. Falls back to LinearGradient (nillLG) if Type cannot be matched.

Upon completion of any tween to a new gradient, this Foil will call onEnd, an optional void callback.

Implementation

Foil.sheet({
  Key? key,
  this.sheet = const Sheet(),
  this.isUnwrapped = false,
  this.opacity = 1.0,
  this.useSensor = true,
  this.gradient,
  this.blendMode = BlendMode.srcATop,
  this.scalar = Scalar.identity,
  this.unwrappedGradient,
  Widget? child,
  this.speed = const Duration(milliseconds: 150),
  this.duration = const Duration(milliseconds: 500),
  this.curve = Curves.ease,
  this.onEnd,
})  : child = child ?? const SizedBox(),
      _box = AnimatedContainer(
        width: sheet.width,
        height: sheet.height,
        margin: sheet.margin,
        padding: sheet.padding,
        alignment: sheet.alignment,
        color: sheet.color,
        decoration: sheet.decoration,
        foregroundDecoration: sheet.foregroundDecoration,
        clipBehavior: sheet.clipBehavior,
        constraints: sheet.constraints,
        transform: sheet.transform,
        transformAlignment: sheet.transformAlignment,
        duration: duration,
        curve: curve,
        child: child,
      ),
      super(key: key);