|
152 | 152 |
|
153 | 153 | Here is the end result:
|
154 | 154 |
|
155 |
| - |
| 155 | + |
156 | 156 |
|
157 | 157 | {% tabs %}
|
158 | 158 | {% tab title="artist-card.pug" %}
|
@@ -193,9 +193,92 @@ card
|
193 | 193 | {% endtab %}
|
194 | 194 |
|
195 | 195 | {% tab title="generated artist-card.dart" %}
|
196 |
| - |
| 196 | +```dart |
| 197 | +Card ArtistCard({ @required onBuyPressed, @required onListenPressed }) { |
| 198 | + return Card( |
| 199 | + child: Column( |
| 200 | + children: [ |
| 201 | + ListTile( |
| 202 | + leading: Icon( |
| 203 | + Icons.album, |
| 204 | + color: Colors.white, |
| 205 | + ), |
| 206 | + title: DefaultTextStyle.merge( |
| 207 | + child: |
| 208 | + //-- TITLE ---------------------------------------------------------- |
| 209 | + Container( |
| 210 | + child: Text( |
| 211 | + 'The Enchanted Nightingale', |
| 212 | + ), |
| 213 | + padding: EdgeInsets.only(top: 4, right: 6, bottom: 4, left: 6), |
| 214 | + ), |
| 215 | + style: TextStyle( |
| 216 | + color: Colors.white, |
| 217 | + ), |
| 218 | + ), |
| 219 | + subtitle: DefaultTextStyle.merge( |
| 220 | + child: |
| 221 | + //-- SUBTITLE ---------------------------------------------------------- |
| 222 | + Container( |
| 223 | + child: Text( |
| 224 | + 'Music by Julie Gable. Lyrics by Sidney Stein.', |
| 225 | + ), |
| 226 | + padding: EdgeInsets.only(top: 2, right: 6, bottom: 2, left: 6), |
| 227 | + ), |
| 228 | + style: TextStyle( |
| 229 | + color: Colors.grey.shade300, |
| 230 | + ), |
| 231 | + ), |
| 232 | + ), |
| 233 | + ButtonTheme.bar( |
| 234 | + child: ButtonBar( |
| 235 | + children: [ |
| 236 | + |
| 237 | + //-- TICKETS ---------------------------------------------------------- |
| 238 | + FlatButton( |
| 239 | + onPressed: () { onBuyPressed(); }, |
| 240 | + child: DefaultTextStyle.merge( |
| 241 | + child: |
| 242 | + //-- LABEL ---------------------------------------------------------- |
| 243 | + Container( |
| 244 | + child: Text( |
| 245 | + 'Buy tickets'.toUpperCase(), |
| 246 | + ), |
| 247 | + ), |
| 248 | + style: TextStyle( |
| 249 | + color: Colors.white, |
| 250 | + ), |
| 251 | + ), |
| 252 | + ), |
| 253 | + |
| 254 | + //-- LISTEN ---------------------------------------------------------- |
| 255 | + FlatButton( |
| 256 | + onPressed: () { onListenPressed(); }, |
| 257 | + child: DefaultTextStyle.merge( |
| 258 | + child: |
| 259 | + //-- LABEL ---------------------------------------------------------- |
| 260 | + Container( |
| 261 | + child: Text( |
| 262 | + 'Listen'.toUpperCase(), |
| 263 | + ), |
| 264 | + ), |
| 265 | + style: TextStyle( |
| 266 | + color: Colors.white, |
| 267 | + ), |
| 268 | + ), |
| 269 | + ) |
| 270 | + ], |
| 271 | + ), |
| 272 | + ) |
| 273 | + ]), |
| 274 | + mainAxisSize: MainAxisSize.min, |
| 275 | + ), |
| 276 | + color: Colors.blue, |
| 277 | + ); |
| 278 | +} |
| 279 | +``` |
197 | 280 | {% endtab %}
|
198 | 281 | {% endtabs %}
|
199 | 282 |
|
200 |
| -As you can see, Sass is a very nice match with Pug, since you can retain the same structure. This makes it easy to find the matching styles to your pug elements. |
| 283 | +As you can see here, Sass is a nice match with Pug, since you can retain the same structure. This makes it easy to find the matching styles to your pug elements. |
201 | 284 |
|
0 commit comments