Foil class

accelerometer-animated Foil Wrap a widget with new Foil, providing a rainbow shimmer that twinkles as the accelerometer moves.
  • Other options include gradient-building new Foil.colored & the self-contained new Foil.sheet.
unwrapping Foil Paramater bool isUnwrapped toggles a Foil's invisibility. Default is false.

Accelerometer

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

Influence the intensity of a 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.

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.

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

Inheritance

Constructors

Foil({Key? key, bool isUnwrapped = false, double opacity = 1.0, bool useSensor = true, Gradient? gradient, BlendMode blendMode = BlendMode.srcATop, Scalar scalar = const Scalar(), Gradient? unwrappedGradient, required Widget child, Duration speed = const Duration(milliseconds: 150), Duration duration = const Duration(milliseconds: 500), Curve curve = Curves.ease, VoidCallback? onEnd})
accelerometer-animated Foil Wrap a widget with Foil, providing a rainbow shimmer that twinkles as the accelerometer moves.
const
Foil.colored({Key? key, bool isUnwrapped = false, double opacity = 1.0, bool useSensor = true, required List<Color> colors, BlendMode blendMode = BlendMode.srcATop, Scalar scalar = Scalar.identity, Gradient? unwrappedGradient, required Widget child, Duration speed = const Duration(milliseconds: 150), Duration duration = const Duration(milliseconds: 500), Curve curve = Curves.ease, VoidCallback? onEnd})
accelerometer-animated Foil Wrap a widget with colored Foil, providing a dynamic shimmer that twinkles as the accelerometer moves, colored by a looping LinearGradient formed from colors.
Foil.sheet({Key? key, Sheet sheet = const Sheet(), bool isUnwrapped = false, double opacity = 1.0, bool useSensor = true, Gradient? gradient, BlendMode blendMode = BlendMode.srcATop, Scalar scalar = Scalar.identity, Gradient? unwrappedGradient, Widget? child, Duration speed = const Duration(milliseconds: 150), Duration duration = const Duration(milliseconds: 500), Curve curve = Curves.ease, 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.

Properties

blendMode BlendMode
The BlendMode utilized in painting this Foil's gradient over its child.
final
child Widget
Wrap this child in Foil.
Ideally, for performance, a single static Widget.
final
curve Curve
The Curve for the animation of this Foil, either by translation through accelerometer movements or by altering gradient.
final
duration Duration
The Duration over which any changes to this Foil's gradient will intrinsically animate. Default is 500ms.
final
gradient Gradient?
Customize the visual appearance of this Foil.
final
hashCode int
The hash code for this object.
no setterinherited
isUnwrapped bool
If isUnwrapped is true, this Foil's gradient will be inactive.
Default is false.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onEnd VoidCallback?
Register a callback Function to perform when this Foil finishes transitioning intrinsically from one gradient to another.
final
opacity double
Override the alpha channels in this Foil's gradient by providing an opacity value by which the gradient will be Gradient.scaled.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scalar Scalar
A Scalar provides an opportunity to modify horizontal and vertical accelerometer sensor data independently before they translate to Foil gradient "twinkling" transformation (offset/translation).
final
sheet Sheet
Only applicable for a self-contained Foil.sheet.
Defaults null unless constructing a Foil.sheet, where default is new Sheet.
final
speed Duration
How rapidly this Foil twinkles according to device sensor movements.
final
unwrappedGradient Gradient?
Override the empty, transparent Gradient that this Foil transitions to when isUnwrapped is made true.
final
useSensor bool
Default is true.
accelerometer-animated Foil
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _FoilState
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited