@@ -12,18 +12,41 @@ class QuoteList extends StatefulWidget {
1212
1313class _QuoteListState extends State <QuoteList > {
1414
15- // List<String> quotes = [
16- // 'Be yourself; everyone else is already taken',
17- // 'I have nothing to declare except my genius',
18- // 'The truth is rarely pure and never simple'
19- // ];
20-
2115 List <Quote > quotes = [
2216 Quote (author: 'Oscar Wilde' , text: 'Be yourself; everyone else is already taken' ),
2317 Quote (author: 'Oscar Wilde' , text: 'I have nothing to declare except my genius' ),
2418 Quote (author: 'Oscar Wilde' , text: 'The truth is rarely pure and never simple' )
2519 ];
2620
21+ Widget quoteTemplate (quote) {
22+ return Card (
23+ margin: const EdgeInsets .fromLTRB (16.0 , 16.0 , 16.0 , 0 ),
24+ child: Padding (
25+ padding: const EdgeInsets .all (12.0 ),
26+ child: Column (
27+ crossAxisAlignment: CrossAxisAlignment .stretch,
28+ children: < Widget > [
29+ Text (
30+ quote.text,
31+ style: TextStyle (
32+ fontSize: 18.0 ,
33+ color: Colors .grey[600 ],
34+ ),
35+ ),
36+ SizedBox (height: 6.0 ),
37+ Text (
38+ quote.author,
39+ style: TextStyle (
40+ fontSize: 14.0 ,
41+ color: Colors .grey[800 ],
42+ ),
43+ ),
44+ ],
45+ ),
46+ )
47+ );
48+ }
49+
2750 @override
2851 Widget build (BuildContext context) {
2952 return Scaffold (
@@ -34,7 +57,7 @@ class _QuoteListState extends State<QuoteList> {
3457 backgroundColor: Colors .redAccent,
3558 ),
3659 body: Column (
37- children: quotes.map ((quote) => Text ( '${ quote . text } - ${ quote . author }' )).toList (),
60+ children: quotes.map ((quote) => quoteTemplate ( quote)).toList (),
3861 ),
3962 );
4063 }
0 commit comments