gradients library Null safety

Offers an AnimatedGradient specification driven by an instantiated Listenable (more like FooTransition than an AnimatedFoo).

Also provides Steps and ShadedSteps type gradients.

Gradient utilities include copyWith() many potential properties for a variety of types, but also a GradientCopyWith template to override the default in this library, as well as other extension methods.

NillGradients is an extension that maintains the concept of nillify()ing a gradient.

Finally, the origin of package:spectrum, the realized GradientTween, not just by Gradient.lerp, but by bespoke IntermediateGradients.


This import is a module library for package:spectrum.

For colors functionality:

import 'package:spectrum/colors.dart';

Or for the all-in-one library:

import 'package:spectrum/spectrum.dart';
Gradient API References: GradientUtils | GradientTween | Steps | FooShadedSteps | AnimatedGradient
🐸 Zaba.app ― simple packages, simple names.

Classes

AnimatedGradient
An AnimatedWidget that expects to be provided an initialized Listenable. [...]
GradientPacket
If a list of colors and list of stops makes a PrimitiveGradient, does this GradientPacket constitute a supergradient?
GradientTween
An interpolation between two Gradients. [...]
IntermediateGradient
A new IntermediateGradient can be resolved to a discrete form of Gradient during tweens.
LinearShadedSteps
Construct a new LinearShadedSteps that progresses from one color to the next in hard steps, each with its own intrinsic "shading," as opposed to smooth transitions by way of "quadruplicating" colors and stops. [...]
LinearSteps
Construct a new LinearSteps that progresses from one color to the next in hard steps as opposed to smooth transitions by way of duplicating colors and stops. [...]
Maths
A few options for functions that fulfill the StopsArithmetic definition.
PrimitiveGradient
The most basic representation of a gradient.
RadialShadedSteps
Construct a new RadialShadedSteps that progresses from one color to the next in hard steps, each with its own intrinsic "shading," as opposed to smooth transitions by way of "quadruplicating" colors and stops. [...]
RadialSteps
Construct a new RadialSteps that progresses from one color to the next in hard steps as opposed to smooth transitions by way of duplicating colors and stops. [...]
Shades
A few options for functions that fulfill the ColorArithmetic definition.
Steps
These Steps work a little bit differently than standard Gradients. [...]
SweepShadedSteps
Construct a new SweepShadedSteps that progresses from one color to the next in hard steps, each with its own intrinsic "shading," as opposed to smooth transitions by way of "quadruplicating" colors and stops. [...]
SweepSteps
Construct a new SweepSteps that progresses from one color to the next in hard steps as opposed to smooth transitions by way of duplicating colors and stops. [...]

Extensions

GradientUtils
Offers copyWith method to make duplicate Gradients as well as global getters for any Gradient with specific fallbacks; reversed to easily return a Gradient with its colors reversed; and animate, as a shortcut to provide this Gradient as an AnimatedGradient's source and return the AnimatedGradient.observe output.
LinearGradientUtils
Offers copyWith method to make duplicate Gradients.
NillGradients
A wrapper for retrieving transparent, empty Gradients appropriate for smooth GradientTweens. [...]
RadialGradientUtils
Offers copyWith method to make duplicate Gradients.
SweepGradientUtils
Offers copyWith method to make duplicate Gradients.

Enums

GradientAnimation
Defines the options for a variety of transformations to apply to a Gradient in the process of making it an AnimatedGradient. [...]
GradientProperty
Potential gradient properties for tweenage, notably excluding colors, stops, transform, & tileMode, as well as shadeFunction for FooShadedSteps.

Typedefs

ColorArithmetic = Color Function(Color color, double factor)
A ColorArithmetic is a function that returns a Color after accepting and considering a Color and an double factor. [...]
GradientCopyWith = Gradient Function(Gradient gradient, {AlignmentGeometry? begin, AlignmentGeometry? center, List<Color>? colors, double? distance, AlignmentGeometry? end, double? endAngle, AlignmentGeometry? focal, double? focalRadius, double? radius, double? shadeFactor, ColorArithmetic? shadeFunction, double? softness, double? startAngle, List<double>? stops, TileMode? tileMode, GradientTransform? transform})
Provision of a function type defintion for the purpose of allowing the override of this package's default copyWith() method. [...]
StopsArithmetic = double Function(double stop, double factor)
A StopsArithmetic is a function that returns a double after accepting and considering a double stop and an double factor. [...]