Created
September 6, 2019 20:41
-
-
Save icatalud/f128e3765de3f1af0ecb27e407e920df to your computer and use it in GitHub Desktop.
TransitionImage class with a tap gesture.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TransitionImage extends FloopWidget { | |
final Image image; | |
const TransitionImage(this.image); | |
@override | |
Widget build(BuildContext context) { | |
// Opacity transitions from 0 to 1 in 1.5 seconds. | |
return GestureDetector( | |
child: Opacity(opacity: transition(1500), child: image), | |
onTap: () async { | |
if (await fetchAndUpdateImage()) { | |
Transitions.restart(context: context); | |
} | |
}, | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment