1
1
import 'package:flutter/material.dart' ;
2
+ import 'quote.dart' ;
2
3
3
4
void main () => runApp (MaterialApp (
4
5
home: QuoteList ()
@@ -11,10 +12,16 @@ class QuoteList extends StatefulWidget {
11
12
12
13
class _QuoteListState extends State <QuoteList > {
13
14
14
- List <String > quotes = [
15
- 'Be yourself; everyone else is already taken' ,
16
- 'I have nothing to declare except my genius' ,
17
- 'The truth is rarely pure and never simple'
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
+ List <Quote > quotes = [
22
+ Quote (author: 'Oscar Wilde' , text: 'Be yourself; everyone else is already taken' ),
23
+ Quote (author: 'Oscar Wilde' , text: 'I have nothing to declare except my genius' ),
24
+ Quote (author: 'Oscar Wilde' , text: 'The truth is rarely pure and never simple' )
18
25
];
19
26
20
27
@override
@@ -27,7 +34,7 @@ class _QuoteListState extends State<QuoteList> {
27
34
backgroundColor: Colors .redAccent,
28
35
),
29
36
body: Column (
30
- children: quotes.map ((quote) => Text (quote)).toList (),
37
+ children: quotes.map ((quote) => Text ('${ quote . text } - ${ quote . author }' )).toList (),
31
38
),
32
39
);
33
40
}
0 commit comments