I want to display a widget only if i press a button, then after a second it disappear
I'm trying to do it with Opacity Widget something like this:
double _woofOp = 0.0;
void hideImg(){
Duration(seconds: 1);
setState(() {
_woofOp = 0.0;
});
}
void playAudio() {
setState(() {
_woofOp = 1.0;
playBark.play('DogWoof.mp3');
});
hideImg();
}
and the widget:
Opacity(
opacity: _woofOp,
child: Image.asset('images/woof-png.png',
width: 80.0,
),
)
but by using it nothing happens,(but audio works which is in same function) any idea why?
or any idea how can i do that using another ways? I'm just a learner. Thank you