| import 'package:flutter/material.dart'; |
| {{#withDriverTest?}} |
| import 'package:flutter_driver/driver_extension.dart'; |
| {{/withDriverTest?}} |
| |
| void main() { |
| {{#withDriverTest?}} |
| // Starts the app with Flutter Driver extension enabled to allow Flutter Driver |
| // to test the app. |
| enableFlutterDriverExtension(); |
| {{/withDriverTest?}} |
| runApp( |
| new MaterialApp( |
| title: 'Flutter Demo', |
| routes: <String, WidgetBuilder>{ |
| '/': (BuildContext context) => new FlutterDemo() |
| } |
| ) |
| ); |
| } |
| |
| class FlutterDemo extends StatefulWidget { |
| _FlutterDemoState createState() => new _FlutterDemoState(); |
| } |
| |
| class _FlutterDemoState extends State<FlutterDemo> { |
| int _counter = 0; |
| |
| void _incrementCounter() { |
| setState(() { |
| _counter++; |
| }); |
| } |
| |
| Widget build(BuildContext context) { |
| return new Scaffold( |
| appBar: new AppBar( |
| title: new Text('Flutter Demo') |
| ), |
| body: new Center( |
| child: new Text('Button tapped $_counter time${ _counter == 1 ? '' : 's' }.') |
| ), |
| floatingActionButton: new FloatingActionButton( |
| onPressed: _incrementCounter, |
| tooltip: 'Increment', |
| child: new Icon( |
| icon: Icons.add |
| ) |
| ) |
| ); |
| } |
| } |