@@ -49,14 +49,21 @@ class MyApp extends StatelessWidget {
49
49
theme: ThemeData(
50
50
// This is the theme of your application.
51
51
//
52
- // Try running your application with "flutter run". You'll see the
53
- // application has a blue toolbar. Then, without quitting the app, try
54
- // changing the primarySwatch below to Colors.green and then invoke
55
- // "hot reload" (press "r" in the console where you ran "flutter run",
56
- // or simply save your changes to "hot reload" in a Flutter IDE).
52
+ // TRY THIS: Try running your application with "flutter run". You'll see
53
+ // the application has a blue toolbar. Then, without quitting the app,
54
+ // try changing the seedColor in the colorScheme below to Colors.green
55
+ // and then invoke "hot reload" (save your changes or press the "hot
56
+ // reload" button in a Flutter-supported IDE, or press "r" if you used
57
+ // the command line to start the app).
58
+ //
57
59
// Notice that the counter didn't reset back to zero; the application
58
- // is not restarted.
59
- primarySwatch: Colors.blue,
60
+ // state is not lost during the reload. To reset the state, use hot
61
+ // restart instead.
62
+ //
63
+ // This works for code too, not just values: Most code changes can be
64
+ // tested with just a hot reload.
65
+ colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
66
+ useMaterial3: true,
60
67
),
61
68
home: const MyHomePage(title: 'Flutter Demo Home Page'),
62
69
);
@@ -105,6 +112,10 @@ class _MyHomePageState extends State<MyHomePage> {
105
112
// than having to individually change instances of widgets.
106
113
return Scaffold(
107
114
appBar: AppBar(
115
+ // TRY THIS: Try changing the color here to a specific color (to
116
+ // Colors.amber, perhaps?) and trigger a hot reload to see the AppBar
117
+ // change color while the other colors stay the same.
118
+ backgroundColor: Theme.of(context).colorScheme.inversePrimary,
108
119
// Here we take the value from the MyHomePage object that was created by
109
120
// the App.build method, and use it to set our appbar title.
110
121
title: Text(widget.title),
@@ -117,16 +128,15 @@ class _MyHomePageState extends State<MyHomePage> {
117
128
// arranges them vertically. By default, it sizes itself to fit its
118
129
// children horizontally, and tries to be as tall as its parent.
119
130
//
120
- // Invoke "debug painting" (press "p" in the console, choose the
121
- // "Toggle Debug Paint" action from the Flutter Inspector in Android
122
- // Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
123
- // to see the wireframe for each widget.
124
- //
125
131
// Column has various properties to control how it sizes itself and
126
132
// how it positions its children. Here we use mainAxisAlignment to
127
133
// center the children vertically; the main axis here is the vertical
128
134
// axis because Columns are vertical (the cross axis would be
129
135
// horizontal).
136
+ //
137
+ // TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint"
138
+ // action in the IDE, or press "p" in the console), to see the
139
+ // wireframe for each widget.
130
140
mainAxisAlignment: MainAxisAlignment.center,
131
141
children: <Widget>[
132
142
const Text(
0 commit comments