Commit 42d90c00 authored by Seth Ladd's avatar Seth Ladd

starter app now has a button that does something

parent d04e2221
...@@ -201,14 +201,27 @@ void main() { ...@@ -201,14 +201,27 @@ void main() {
runApp( runApp(
new MaterialApp( new MaterialApp(
title: "Flutter Demo", title: "Flutter Demo",
routes: { routes: <String, RouteBuilder>{
'/': (RouteArguments args) => new FlutterDemo() '/': (RouteArguments args) => new FlutterDemo()
} }
) )
); );
} }
class FlutterDemo extends StatelessComponent { class FlutterDemo extends StatefulComponent {
@override
State createState() => new FlutterDemoState();
}
class FlutterDemoState extends State {
int counter = 0;
void incrementCounter() {
setState(() {
counter++;
});
}
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
toolBar: new ToolBar( toolBar: new ToolBar(
...@@ -216,13 +229,14 @@ class FlutterDemo extends StatelessComponent { ...@@ -216,13 +229,14 @@ class FlutterDemo extends StatelessComponent {
), ),
body: new Material( body: new Material(
child: new Center( child: new Center(
child: new Text("Hello world!") child: new Text("Button tapped $counter times.")
) )
), ),
floatingActionButton: new FloatingActionButton( floatingActionButton: new FloatingActionButton(
child: new Icon( child: new Icon(
icon: 'content/add' icon: 'content/add'
) ),
onPressed: incrementCounter
) )
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment