@@ -12,18 +12,41 @@ class QuoteList extends StatefulWidget {
12
12
13
13
class _QuoteListState extends State <QuoteList > {
14
14
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
-
21
15
List <Quote > quotes = [
22
16
Quote (author: 'Oscar Wilde' , text: 'Be yourself; everyone else is already taken' ),
23
17
Quote (author: 'Oscar Wilde' , text: 'I have nothing to declare except my genius' ),
24
18
Quote (author: 'Oscar Wilde' , text: 'The truth is rarely pure and never simple' )
25
19
];
26
20
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
+
27
50
@override
28
51
Widget build (BuildContext context) {
29
52
return Scaffold (
@@ -34,7 +57,7 @@ class _QuoteListState extends State<QuoteList> {
34
57
backgroundColor: Colors .redAccent,
35
58
),
36
59
body: Column (
37
- children: quotes.map ((quote) => Text ( '${ quote . text } - ${ quote . author }' )).toList (),
60
+ children: quotes.map ((quote) => quoteTemplate ( quote)).toList (),
38
61
),
39
62
);
40
63
}
0 commit comments