Skip to content

Instantly share code, notes, and snippets.

@icatalud
Last active September 13, 2019 19:00
Show Gist options
  • Save icatalud/ae23817a147bd255a6d08f4bb9db4156 to your computer and use it in GitHub Desktop.
Save icatalud/ae23817a147bd255a6d08f4bb9db4156 to your computer and use it in GitHub Desktop.
Clicker example 1
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