Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
class MySecondWidget extends StatefulWidget {
MySecondWidget({Key key}) : super(key: key);
_MySecondWidgetState createState() =>
class _MySecondWidgetState extends State<MySecondWidget> {
int _clickCount = 0;
void incrementClickCount() {
setState(() {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("My First App"),
body: Container(
padding: EdgeInsets.all(8.0),
child: Text(
"Hello! Times clicked: "
+ this._clickCount.toString(),
style: TextStyle(
fontSize: 20.0),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.add),
onPressed: this.incrementClickCount,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment