Skip to content

Instantly share code, notes, and snippets.

@icatalud
Created September 6, 2019 20:41
Show Gist options
  • Save icatalud/f128e3765de3f1af0ecb27e407e920df to your computer and use it in GitHub Desktop.
Save icatalud/f128e3765de3f1af0ecb27e407e920df to your computer and use it in GitHub Desktop.
TransitionImage class with a tap gesture.
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