fade method

Widget fade({
  1. double opacity = 1.0,
  2. Duration duration = const Duration(milliseconds: 300),
  3. Curve curve = Curves.easeInOut,
})

Wraps the widget with a controllable fade animation.

Example:

Text('Hello').fade(opacity: 0.5);

Implementation

Widget fade({
  double opacity = 1.0,
  Duration duration = const Duration(milliseconds: 300),
  Curve curve = Curves.easeInOut,
}) {
  return AnimatedOpacity(
    opacity: opacity,
    duration: duration,
    curve: curve,
    child: this,
  );
}