Phased<T> constructor
const
Phased<T> ({
- Key? key,
- required PhasedState<
T> state,
The base class for a Phased widget. Override it to create custom, phased based animations.
Example:
class BlinkState extends PhasedState<bool> {
BlinkState() : super(values: [true, false]);
}
class Blink extends Phased<bool> {
const Blink({
super.key,
required super.state,
required this.child,
});
final Widget child;
@override
Widget build(BuildContext context) {
return AnimatedOpacity(
opacity: state.phaseValue(
values: const {true: 1},
defaultValue: 0,
),
onEnd: state.next,
duration: const Duration(milliseconds: 250),
child: child,
);
}
}
Implementation
const Phased({
super.key,
required this.state,
});