Skip to content

Instantly share code, notes, and snippets.

@icatalud
Last active January 25, 2020 16:40
Show Gist options
  • Save icatalud/b0d97b347dce2f964ca2858d3adf4813 to your computer and use it in GitHub Desktop.
Save icatalud/b0d97b347dce2f964ca2858d3adf4813 to your computer and use it in GitHub Desktop.
Basic Floop example
class Clicker extends StatelessWidget with Floop {
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Opacity(
// opacity goes from 0 to 1 in two seconds
opacity: transition(2000),
// Text always displays the current value of floop[#clicks].
child: Text('${floop[#clicks]}'),
)
),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.add),
onPressed: () {
floop[#clicks]++;
// Restarts the opacity transition.
TransitionGroup(context: context).restart();
}),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment