-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.dart
146 lines (135 loc) · 5.91 KB
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
import 'package:flutter/material.dart';
import 'package:characters/characters.dart';
import 'package:my_app/presentation/my_flutter_app_icons.dart';
void main() => runApp(MaterialApp(
home: IrohApp(),
)); // MaterialApp
class IrohApp extends StatefulWidget {
@override
_IrohAppState createState() => _IrohAppState();
}
class _IrohAppState extends State<IrohApp> {
// List of quotes by Iroh.
List<String> quotes = [
'“It is important to draw wisdom from many different places. If we take it from only one place, it becomes rigid and stale.”',
'“Destiny is a funny thing. You never know how things are going to work out. But if you keep an open mind and an open heart, I promise you will find your own destiny someday.”',
'“There is nothing wrong with a life of peace and prosperity. I suggest you think about what it is that you want from your life, and why.”',
'“Perfection and power are overrated. I think you are very wise to choose happiness and love.”',
'“Sometimes life is like this dark tunnel. You can’t always see the light at the end of the tunnel, but if you just keep moving, you will come to a better place.”',
'“Life happens wherever you are, whether you make it or not.”',
'“Pride is not the opposite of shame, but its source. True humility is the only antidote to shame.”',
'“You sound like my nephew, always thinking that you need to do things on your own without anyone’s support.\n There is nothing wrong with letting people who love you help you.”',
'“You must never give in to despair. Allow yourself to slip down that road and you surrender to your lowest instincts. In the darkest times, hope is something you give yourself. That is the meaning of inner strength.”',
'“It is time for you to look inward, and start asking yourself the big questions. Who are you? And what do you want?”',
];
// Blank string in place for new quote.
String newQuote = '';
@override
Widget build(BuildContext context) {
var scaffold = Scaffold(
// App bar
appBar: AppBar(
title: Text(
'Iroh App',
style: TextStyle(
fontFamily: 'Avatar',
), // TextStyle
), // Text
centerTitle: true,
backgroundColor: Colors.red[900],
), // AppBar
// Main body
body: Container(
// Background
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/appa.png"),
fit: BoxFit.cover,
), // DecorationImage
), // BoxDecoration
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
// Quote Iroh button
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
// Button Design
decoration: BoxDecoration(
color: Colors.red[700],
// Drop Shadow
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.5),
spreadRadius: 5,
blurRadius: 7,
offset: Offset(0, 3), //changes position of shadow.
), // BoxShadow
],
), // BoxDecoration
child: RaisedButton.icon(
onPressed: () {
setState(() {
// Shuffles through listed quotes.
// The top quote from the list is then added to the string 'newString'.
quotes.shuffle();
newQuote = quotes[0];
});
},
color: Colors.red[700],
icon: Icon(Icons.menu),
label: Text(
'Quote Iroh',
style: TextStyle(
fontFamily: 'Avatar',
fontWeight: FontWeight.bold,
fontSize: 20.0,
), // TextStyle
), // Text
), // RaisedButton.icon
), // Container
], // <Widget>[]
), // Row
// Quote box
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Expanded(
child: Container(
// Box design
padding: EdgeInsets.all(50.0),
decoration: BoxDecoration(
color: Colors.red[700],
// Drop shadow
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.5),
spreadRadius: 5,
blurRadius: 7,
offset: Offset(0, 3), //changes position of shadow.
), // BoxShadow
],
), // BoxDecoration
child: Text(
// Prints new quote after button is pressed.
'$newQuote',
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: 'Avatar',
fontStyle: FontStyle.italic,
fontWeight: FontWeight.bold,
fontSize: 17.5,
), // TextStyle
), // Text
), // Container
), // Expanded
] // <Widget>[]
), // Row
], // <Widger>[]
), // Column
), // Container
); // Scaffold
return scaffold;
}
}