The Flutter Visibility Widget allows everything contained within it to be both hidden and disabled. However, I want to animate the opacity as well as invoke visibility. Using the Visibility widget is overriding the animated opacity. This is to be expected based on my knowledge of other languages.
Is there a simple and convenient way to achieve an animated opacity and visibility. IT would make life simpler than setting a timer.
The example below uses a bool of hasAccess using Provider as the state management.
child: Stack(
children: [
Visibility(
visible: hasAccess ? false : true,
child: AnimatedOpacity(
duration: Duration(milliseconds: 400),
opacity: hasAccess ? 0 : 1,
child: Text('Not logged in'),
)),
Visibility(
visible: hasAccess ? true : false,
child: AnimatedOpacity(
duration: Duration(milliseconds: 400),
opacity: hasAccess ? 1 : 0,
child: Text('Is logged in'),
),
),
],
)