mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
57 lines
1.3 KiB
Cheetah
57 lines
1.3 KiB
Cheetah
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',
|
|
theme: new ThemeData(
|
|
primarySwatch: Colors.blue,
|
|
),
|
|
home: new FlutterDemo(),
|
|
),
|
|
);
|
|
}
|
|
|
|
class FlutterDemo extends StatefulWidget {
|
|
FlutterDemo({Key key}) : super(key: key);
|
|
|
|
@override
|
|
_FlutterDemoState createState() => new _FlutterDemoState();
|
|
}
|
|
|
|
class _FlutterDemoState extends State<FlutterDemo> {
|
|
int _counter = 0;
|
|
|
|
void _incrementCounter() {
|
|
setState(() {
|
|
_counter++;
|
|
});
|
|
}
|
|
|
|
@override
|
|
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(Icons.add),
|
|
),
|
|
);
|
|
}
|
|
}
|