mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
parent
b7ae0be79a
commit
ec0ec75b26
@ -126,7 +126,7 @@ abstract class Template {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class FlutterSimpleTemplate extends Template {
|
class FlutterSimpleTemplate extends Template {
|
||||||
FlutterSimpleTemplate() : super('flutter-simple', 'A minimal Flutter project.') {
|
FlutterSimpleTemplate() : super('flutter-simple', 'A simple Flutter app.') {
|
||||||
files['.analysis_options'] = _analysis_options;
|
files['.analysis_options'] = _analysis_options;
|
||||||
files['.gitignore'] = _gitignore;
|
files['.gitignore'] = _gitignore;
|
||||||
files['flutter.yaml'] = _flutterYaml;
|
files['flutter.yaml'] = _flutterYaml;
|
||||||
@ -201,6 +201,9 @@ const String _flutterYaml = r'''
|
|||||||
name: {{projectName}}
|
name: {{projectName}}
|
||||||
material-design-icons:
|
material-design-icons:
|
||||||
- name: content/add
|
- name: content/add
|
||||||
|
- name: navigation/arrow_back
|
||||||
|
- name: navigation/menu
|
||||||
|
- name: navigation/more_vert
|
||||||
''';
|
''';
|
||||||
|
|
||||||
const String _libMain = r'''
|
const String _libMain = r'''
|
||||||
@ -209,7 +212,7 @@ import 'package:flutter/material.dart';
|
|||||||
void main() {
|
void main() {
|
||||||
runApp(
|
runApp(
|
||||||
new MaterialApp(
|
new MaterialApp(
|
||||||
title: "Flutter Demo",
|
title: 'Flutter Demo',
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, RouteBuilder>{
|
||||||
'/': (RouteArguments args) => new FlutterDemo()
|
'/': (RouteArguments args) => new FlutterDemo()
|
||||||
}
|
}
|
||||||
@ -218,34 +221,33 @@ void main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class FlutterDemo extends StatefulComponent {
|
class FlutterDemo extends StatefulComponent {
|
||||||
@override
|
State createState() => new _FlutterDemoState();
|
||||||
State createState() => new FlutterDemoState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class FlutterDemoState extends State {
|
class _FlutterDemoState extends State<FlutterDemo> {
|
||||||
int counter = 0;
|
int _counter = 0;
|
||||||
|
|
||||||
void incrementCounter() {
|
void _incrementCounter() {
|
||||||
setState(() {
|
setState(() {
|
||||||
counter++;
|
_counter++;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Scaffold(
|
return new Scaffold(
|
||||||
toolBar: new ToolBar(
|
toolBar: new ToolBar(
|
||||||
center: new Text("Flutter Demo")
|
center: new Text('Flutter Demo')
|
||||||
),
|
),
|
||||||
body: new Material(
|
body: new Material(
|
||||||
child: new Center(
|
child: new Center(
|
||||||
child: new Text("Button tapped $counter times.")
|
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
|
onPressed: _incrementCounter
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user