animatedOpacity method

Widget animatedOpacity({
  1. required double opacity,
  2. required Duration duration,
  3. Key? key,
  4. Curve curve = Curves.linear,
  5. VoidCallback? onEnd,
  6. bool alwaysIncludeSemantics = false,
})

Animated version of Opacity which automatically transitions the child's opacity over a given duration whenever the given opacity changes.

Implementation

Widget animatedOpacity({
  required double opacity,
  required Duration duration,
  Key? key,
  Curve curve = Curves.linear,
  VoidCallback? onEnd,
  bool alwaysIncludeSemantics = false,
}) {
  return AnimatedOpacity(
    key: key,
    opacity: opacity,
    curve: curve,
    duration: duration,
    onEnd: onEnd,
    alwaysIncludeSemantics: alwaysIncludeSemantics,
    child: this,
  );
}