@@ -49,14 +49,21 @@ class MyApp extends StatelessWidget {
4949 theme: ThemeData(
5050 // This is the theme of your application.
5151 //
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+ //
5759 // 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,
6067 ),
6168 home: const MyHomePage(title: 'Flutter Demo Home Page'),
6269 );
@@ -105,6 +112,10 @@ class _MyHomePageState extends State<MyHomePage> {
105112 // than having to individually change instances of widgets.
106113 return Scaffold(
107114 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 ,
108119 // Here we take the value from the MyHomePage object that was created by
109120 // the App.build method, and use it to set our appbar title.
110121 title: Text(widget.title ),
@@ -117,16 +128,15 @@ class _MyHomePageState extends State<MyHomePage> {
117128 // arranges them vertically. By default, it sizes itself to fit its
118129 // children horizontally, and tries to be as tall as its parent.
119130 //
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- //
125131 // Column has various properties to control how it sizes itself and
126132 // how it positions its children. Here we use mainAxisAlignment to
127133 // center the children vertically; the main axis here is the vertical
128134 // axis because Columns are vertical (the cross axis would be
129135 // 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.
130140 mainAxisAlignment: MainAxisAlignment.center ,
131141 children: <Widget>[
132142 const Text(
0 commit comments