AnimatedOMeshGradient class

An implicitly animated widget that animates the mesh of an OMeshGradient.

A change in the mesh will be animated over the duration with the given curve.

Usage example:


// state value
double center = 0.0;

// in the build method

return GestureDetector(
  onTap: () {
    setState(() {
      center = center == 0.5 ? 0.7 : 0.5;
    });
  },
  child: AnimatedOMeshGradient(
    mesh: OMeshRect(
      width: 3,
      height: 3,
      vertices: [
       (0.0, 0.0).v,
       (0.5, 0.0).v,
       (1.0, 0.0).v, // top row

       (0.0, 0.5).v,
       (center, center).v,
       (1.0, 0.5).v, // middle row

       (0.0, 1.0).v,
       (0.5, 1.0).v,
       (1.0, 1.0).v, // bottom row
      ],
      colors: [
        Colors.red,
        Colors.green,
        Colors.blue,
        Colors.yellow,
        Colors.purple,
        Colors.orange,
        Colors.pink,
        Colors.teal,
        Colors.cyan,
      ],
      colorSpace: OMeshColorSpace.lab,
    ),
    duration: const Duration(seconds: 1),
    curve: Curves.easeInOut,
  ),
);

In the above example, the mesh will animate between two states when the widget is tapped.

See also:

Inheritance

Constructors

AnimatedOMeshGradient({required OMeshRect mesh, required Duration duration, Curve? curve, int? tessellation, DebugMode? debugMode, Size? size, Key? key})
Creates a new AnimatedOMeshGradient with the given mesh.
const

Properties

curve → Curve?
The curve to apply when animating the mesh.
final
debugMode → DebugMode?
Whether to enable visual cues to assist the visualization of a mesh gradient.
final
duration → Duration
The duration of the animation.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
mesh → OMeshRect
The mesh that will be rendered.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
size → Size?
The preferred size of the widget. If null, it will sized according to the minimum size of the parent constraints.
final
tessellation → int?
The number of vertices that will be interpolated between each passed vertex.
final

Methods

build(BuildContext context) → Widget
Describes the part of the user interface represented by this widget.
override
createElement() → StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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.
inherited
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, int wrapWidth = 65}) → 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