Skip to content

Instantly share code, notes, and snippets.

@sethladd
Last active February 6, 2016 00:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sethladd/0b4aff30c106196201f4 to your computer and use it in GitHub Desktop.
Save sethladd/0b4aff30c106196201f4 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
void main() {
runApp(
new MaterialApp(
title: "Flutter Demo",
routes: <String, RouteBuilder>{
'/': (RouteArguments args) => new FlutterDemo()
}
)
);
}
class FlutterDemo extends StatefulComponent {
State createState() => new FlutterDemoState();
}
class FlutterDemoState extends State {
int counter = 0;
void incrementCounter() {
setState(() => counter++);
}
Widget build(BuildContext context) {
return new Scaffold(
toolBar: new ToolBar(
center: new Text("Flutter Demo")
),
body: new Material(
child: new Center(
child: new Text("Button tapped $counter times.")
)
),
floatingActionButton: new FloatingActionButton(
child: new Icon(
icon: 'content/add'
),
onPressed: incrementCounter
)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment