main.dart.tmpl 991 Bytes
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<FlutterDemo> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  Widget build(BuildContext context) {
    return new Scaffold(
      toolBar: new ToolBar(
        center: new Text('Flutter Demo')
      ),
      body: new Center(
        child: new Text(
          'Button tapped $_counter times.',
          key: const ValueKey('counter')
        )
      ),
      floatingActionButton: new FloatingActionButton(
        key: const ValueKey('fab'),
        child: new Icon(
          icon: 'content/add'
        ),
        onPressed: _incrementCounter
      )
    );
  }
}