Skip to content

Commit 1aa7c73

Browse files
committed
Listy lessons, don't forget arrow functions
1 parent c2fa640 commit 1aa7c73

File tree

1 file changed

+19
-91
lines changed

1 file changed

+19
-91
lines changed

lib/main.dart

Lines changed: 19 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -2,106 +2,34 @@ import 'package:flutter/material.dart';
22

33
void main() {
44
runApp(MaterialApp(
5-
home: Home(),
5+
home: QuoteList(),
66
));
77
}
88

9-
class Home extends StatefulWidget {
9+
class QuoteList extends StatefulWidget {
1010
@override
11-
_HomeState createState() => _HomeState();
11+
_QuoteListState createState() => _QuoteListState();
1212
}
1313

14-
class _HomeState extends State<Home> {
15-
int ninjaLevel = 0;
16-
14+
class _QuoteListState extends State<QuoteList> {
15+
List<String> quotes = [
16+
'To be or not to be, that is the question',
17+
'There is no one better that you at being you, don\'t mess it up',
18+
'Dogs also think, don\' discredit yourself so quickly'
19+
];
1720
@override
1821
Widget build(BuildContext context) {
1922
return Scaffold(
20-
appBar: AppBar(
21-
backgroundColor: Colors.grey[800],
22-
title: Text('Ninja ID'),
23-
centerTitle: true,
24-
),
25-
body: Container(
26-
color: Colors.grey[900],
27-
child: Padding(
28-
padding: const EdgeInsets.symmetric(
29-
horizontal: 20.0,
30-
vertical: 0.0,
31-
),
32-
child: Column(
33-
crossAxisAlignment: CrossAxisAlignment.start,
34-
mainAxisAlignment: MainAxisAlignment.start,
35-
children: [
36-
SizedBox(
37-
height: 30.0,
38-
),
39-
Center(
40-
child: CircleAvatar(
41-
radius: 40.0,
42-
backgroundImage: AssetImage('assets/images/alex.jpg'),
43-
),
44-
),
45-
Divider(
46-
height: 40.0,
47-
color: Colors.blue,
48-
),
49-
Text(
50-
'NAME',
51-
style: TextStyle(fontSize: 15.0, color: Colors.grey[350]),
52-
),
53-
Text(
54-
'Chun-Li',
55-
style: TextStyle(
56-
fontWeight: FontWeight.bold,
57-
color: Colors.yellow,
58-
fontSize: 35.0),
59-
),
60-
SizedBox(
61-
height: 20.0,
62-
),
63-
Text(
64-
'CURRENT NINJA LEVEL',
65-
style: TextStyle(fontSize: 15.0, color: Colors.grey[350]),
66-
),
67-
Text(
68-
'$ninjaLevel',
69-
style: TextStyle(
70-
fontWeight: FontWeight.bold,
71-
color: Colors.yellow,
72-
fontSize: 35.0),
73-
),
74-
SizedBox(
75-
height: 20.0,
76-
),
77-
Row(children: [
78-
Icon(
79-
Icons.email,
80-
color: Colors.grey[300],
81-
),
82-
SizedBox(
83-
width: 10.0,
84-
),
85-
Text(
86-
'chun-li@ninja.com',
87-
style: TextStyle(
88-
color: Colors.grey[300],
89-
),
90-
)
91-
]),
92-
],
93-
),
23+
backgroundColor: Colors.grey[200],
24+
appBar: AppBar(
25+
title: Text('Awesone Quotes'),
26+
centerTitle: true,
27+
backgroundColor: Colors.redAccent,
9428
),
95-
),
96-
floatingActionButton: FloatingActionButton(
97-
onPressed: () {
98-
setState(() {
99-
ninjaLevel++;
100-
});
101-
},
102-
child: Icon(Icons.add),
103-
backgroundColor: Colors.yellow,
104-
),
105-
);
29+
body: Column(
30+
children: quotes.map((quote) {
31+
return Text(quote);
32+
}).toList(),
33+
));
10634
}
10735
}

0 commit comments

Comments
 (0)