@@ -21,12 +21,13 @@ p Run the #[+liveExampleLink2('', 'toh-3')] for this part.
2121 .children
2222 .file index.html
2323 .file main.dart
24+ .file styles.css
2425 .file pubspec.yaml
2526:marked
2627 ### Keep the app compiling and running
2728 We want to start the Dart compiler, have it watch for changes, and start our server. We'll do this by typing
2829
29- code-example( format = "." language ="bash" ) .
30+ code-example( language ="bash" ) .
3031 pub serve
3132
3233:marked
@@ -50,7 +51,7 @@ code-example(format="." language="bash").
5051 ### Separating the Hero Detail Component
5152 Add a new file named `hero_detail_component.dart` to the `lib` folder and create `HeroDetailComponent` as follows.
5253
53- + makeExample('toh-3/dart/lib/hero_detail_component.dart' , 'v1' , 'hero_detail_component.dart (initial version)' )( format ="." )
54+ + makeExample('toh-3/dart/lib/hero_detail_component.dart' , 'v1' , 'lib/ hero_detail_component.dart (initial version)' )( format ="." )
5455.l-sub-section
5556 :marked
5657 ### Naming conventions
@@ -61,7 +62,8 @@ code-example(format="." language="bash").
6162
6263 All of our component names end in "Component". All of our component file names end in "_component".
6364
64- We spell our filenames in lower underscore case (AKA "snake_case") so we don't worry about
65+ We spell our filenames in lower **underscore case**
66+ (AKA **[snake_case](../guide/glossary.html#!#snake_case)**) so we don't worry about
6567 case sensitivity on the server or in source control.
6668
6769 <!-- TODO
@@ -89,26 +91,26 @@ code-example(format="." language="bash").
8991 So we replace `selectedHero` with `hero` everywhere in our new template. That's our only change.
9092 The result looks like this:
9193
92- + makeExample('toh-3/dart/lib/hero_detail_component.dart' , 'template' , 'hero_detail_component.dart (template)' )( format ="." )
94+ + makeExample('toh-3/dart/lib/hero_detail_component.dart' , 'template' , 'lib/ hero_detail_component.dart (template)' )( format ="." )
9395
9496:marked
9597 Now our hero detail layout exists only in the `HeroDetailComponent`.
9698
9799 #### Add the *hero* property
98100 Let’s add that `hero` property we were talking about to the component class.
99- + makeExample('toh-3/dart/lib/hero_detail_component.dart' , 'hero' )( format = "." )
101+ + makeExample('toh-3/dart/lib/hero_detail_component.dart' , 'hero' )
100102:marked
101103 Uh oh. We declared the `hero` property as type `Hero` but our `Hero` class is over in the `app_component.dart` file.
102104 We have two components, each in their own file, that need to reference the `Hero` class.
103105
104106 We solve the problem by relocating the `Hero` class from `app_component.dart` to its own `hero.dart` file.
105107
106- + makeExample('toh-3/dart/lib/hero.dart' , null , 'hero.dart (Exported Hero class) ' )( format ="." )
108+ + makeExample('toh-3/dart/lib/hero.dart' , '' , 'lib/ hero.dart' )( format ="." )
107109
108110:marked
109- Add the following import statement near the top of both `app_component.dart` and `hero_detail_component.dart`.
111+ Add the following import statement near the top of ** both `app_component.dart` and `hero_detail_component.dart`** .
110112
111- + makeExample('toh-3/dart/lib/hero_detail_component.dart' , 'hero-import' , 'hero_detail_component.dart and app_component.dart (Import the Hero class)' ) ( format = "." )
113+ + makeExample('toh-3/dart/lib/hero_detail_component.dart' , 'hero-import' )
112114
113115:marked
114116 #### The *hero* property is an ***input***
@@ -167,7 +169,7 @@ code-example(format=".")
167169:marked
168170 The `AppComponent`’s template should now look like this
169171
170- + makeExample('toh-3/dart/lib/app_component.dart' , 'hero-detail-template' , 'app_component.dart (Template )' )( format ="." )
172+ + makeExample('toh-3/dart/lib/app_component.dart' , 'hero-detail-template' , 'app_component.dart (template )' )( format ="." )
171173:marked
172174 Thanks to the binding, the `HeroDetailComponent` should receive the hero from the `AppComponent` and display that hero's detail beneath the list.
173175 The detail should update every time the user picks a new hero.
@@ -213,6 +215,7 @@ code-example(format=".")
213215 .children
214216 .file index.html
215217 .file main.dart
218+ .file styles.css
216219 .file pubspec.yaml
217220:marked
218221 Here are the code files we discussed in this chapter.
@@ -237,6 +240,8 @@ code-example(format=".")
237240 * We learned to bind a parent component to a child component.
238241 * We learned to declare the application directives we need in a `directives` list.
239242
243+ p Run the #[ + liveExampleLink2('' , 'toh-3' )] for this part.
244+
240245.l-main-section
241246:marked
242247 ## The Road Ahead
0 commit comments