animatedOpacity method
Wraps the widget with an AnimatedOpacity widget to animate its visibility.
The widget fades in or out based on the isVisible parameter. You can customize the
animation duration using the duration parameter.
Example:
Text("Hello").animatedOpacity(true); // Widget fades in.
Text("Hello").animatedOpacity(false); // Widget fades out.
Implementation
AnimatedOpacity animatedOpacity(
bool isVisible, {
Duration duration = const Duration(milliseconds: 300),
}) =>
AnimatedOpacity(
duration: duration,
opacity: isVisible ? 1.0 : 0.0,
child: this,
);