Last active
September 13, 2019 19:00
-
-
Save icatalud/ae23817a147bd255a6d08f4bb9db4156 to your computer and use it in GitHub Desktop.
Clicker example 1
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
import 'package:flutter/material.dart'; | |
import 'package:floop/floop.dart'; | |
main() { | |
floop['clicks'] = 0; //initialize 'clicks' | |
runApp(MaterialApp(title: 'Clicker', home: Clicker())); | |
} | |
class Clicker extends StatelessWidget with Floop { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Center( | |
child: Text( | |
floop['clicks'].toString(), | |
style: TextStyle( | |
color: Colors.red, | |
fontSize: 100, | |
), | |
), | |
), | |
floatingActionButton: FloatingActionButton( | |
child: Icon(Icons.add), | |
onPressed: () => floop['clicks']++, | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment