Skip to content

Commit 4127932

Browse files
committed
update flutter_module
1 parent 5391534 commit 4127932

File tree

1 file changed

+1
-48
lines changed

1 file changed

+1
-48
lines changed

flutter_module/lib/main.dart

+1-48
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,12 @@ void main() => runApp(const MyApp());
66
class MyApp extends StatelessWidget {
77
const MyApp({Key? key}) : super(key: key);
88

9-
// This widget is the root of your application.
109
@override
1110
Widget build(BuildContext context) {
1211
return MaterialApp(
1312
debugShowCheckedModeBanner: false,
1413
title: 'Flutter Module',
1514
theme: ThemeData(
16-
// This is the theme of your application.
17-
//
18-
// Try running your application with "flutter run". You'll see the
19-
// application has a blue toolbar. Then, without quitting the app, try
20-
// changing the primarySwatch below to Colors.green and then invoke
21-
// "hot reload" (press "r" in the console where you ran "flutter run",
22-
// or press Run > Flutter Hot Reload in a Flutter IDE). Notice that the
23-
// counter didn't reset back to zero; the application is not restarted.
2415
primarySwatch: Colors.blue,
2516
),
2617
home: const MyHomePage(title: 'Flutter Module'),
@@ -31,15 +22,6 @@ class MyApp extends StatelessWidget {
3122
class MyHomePage extends StatefulWidget {
3223
const MyHomePage({Key? key, required this.title}) : super(key: key);
3324

34-
// This widget is the home page of your application. It is stateful, meaning
35-
// that it has a State object (defined below) that contains fields that affect
36-
// how it looks.
37-
38-
// This class is the configuration for the state. It holds the values (in this
39-
// case the title) provided by the parent (in this case the App widget) and
40-
// used by the build method of the State. Fields in a Widget subclass are
41-
// always marked "final".
42-
4325
final String title;
4426

4527
@override
@@ -51,51 +33,22 @@ class _MyHomePageState extends State<MyHomePage> {
5133

5234
void _incrementCounter() {
5335
setState(() {
54-
// This call to setState tells the Flutter framework that something has
55-
// changed in this State, which causes it to rerun the build method below
56-
// so that the display can reflect the updated values. If we changed
57-
// _counter without calling setState(), then the build method would not be
58-
// called again, and so nothing would appear to happen.
5936
_counter++;
6037
});
6138
}
6239

6340
@override
6441
Widget build(BuildContext context) {
65-
// This method is rerun every time setState is called, for instance as done
66-
// by the _incrementCounter method above.
67-
//
68-
// The Flutter framework has been optimized to make rerunning build methods
69-
// fast, so that you can just rebuild anything that needs updating rather
70-
// than having to individually change instances of widgets.
7142
return Scaffold(
7243
appBar: AppBar(
7344
leading: IconButton(
7445
icon: const Icon(Icons.arrow_back_ios),
7546
onPressed: () => SystemNavigator.pop(animated: true),
7647
),
77-
// Here we take the value from the MyHomePage object that was created by
78-
// the App.build method, and use it to set our appbar title.
7948
title: Text(widget.title),
8049
),
8150
body: Center(
82-
// Center is a layout widget. It takes a single child and positions it
83-
// in the middle of the parent.
8451
child: Column(
85-
// Column is also a layout widget. It takes a list of children and
86-
// arranges them vertically. By default, it sizes itself to fit its
87-
// children horizontally, and tries to be as tall as its parent.
88-
//
89-
// Invoke "debug painting" (press "p" in the console, choose the
90-
// "Toggle Debug Paint" action from the Flutter Inspector in Android
91-
// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
92-
// to see the wireframe for each widget.
93-
//
94-
// Column has various properties to control how it sizes itself and
95-
// how it positions its children. Here we use mainAxisAlignment to
96-
// center the children vertically; the main axis here is the vertical
97-
// axis because Columns are vertical (the cross axis would be
98-
// horizontal).
9952
mainAxisAlignment: MainAxisAlignment.center,
10053
children: <Widget>[
10154
const Text(
@@ -112,7 +65,7 @@ class _MyHomePageState extends State<MyHomePage> {
11265
onPressed: _incrementCounter,
11366
tooltip: 'Increment',
11467
child: const Icon(Icons.add),
115-
), // This trailing comma makes auto-formatting nicer for build methods.
68+
),
11669
);
11770
}
11871
}

0 commit comments

Comments
 (0)