Skip to content

Commit d6e7faa

Browse files
committed
Section Three, Video Six: Apply Styles and Themes to your App
1 parent a890c4e commit d6e7faa

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

lib/main.dart

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,15 @@ void main() {
44

55
runApp(
66
MaterialApp(
7+
debugShowCheckedModeBanner: false,
78
title: 'Simple Interest Calculator App',
89
home: SIForm(),
10+
theme: ThemeData(
11+
brightness: Brightness.dark,
12+
primaryColor: Colors.indigo,
13+
accentColor: Colors.indigoAccent
14+
),
15+
916
)
1017
);
1118
}
@@ -27,6 +34,8 @@ class _SIFormState extends State<SIForm> {
2734
@override
2835
Widget build(BuildContext context) {
2936

37+
TextStyle textStyle = Theme.of(context).textTheme.title;
38+
3039
return Scaffold(
3140
// resizeToAvoidBottomPadding: false,
3241
appBar: AppBar(
@@ -44,9 +53,11 @@ class _SIFormState extends State<SIForm> {
4453
padding: EdgeInsets.only(top: _minimumPadding, bottom: _minimumPadding),
4554
child: TextField(
4655
keyboardType: TextInputType.number,
56+
style: textStyle,
4757
decoration: InputDecoration(
4858
labelText: 'Principal',
4959
hintText: 'Enter Principal e.g. 12000',
60+
labelStyle: textStyle,
5061
border: OutlineInputBorder(
5162
borderRadius: BorderRadius.circular(5.0)
5263
)
@@ -57,9 +68,11 @@ class _SIFormState extends State<SIForm> {
5768
padding: EdgeInsets.only(top: _minimumPadding, bottom: _minimumPadding),
5869
child: TextField(
5970
keyboardType: TextInputType.number,
71+
style: textStyle,
6072
decoration: InputDecoration(
6173
labelText: 'Rate of Interest',
6274
hintText: 'In percent',
75+
labelStyle: textStyle,
6376
border: OutlineInputBorder(
6477
borderRadius: BorderRadius.circular(5.0)
6578
)
@@ -73,9 +86,11 @@ class _SIFormState extends State<SIForm> {
7386

7487
Expanded(child: TextField(
7588
keyboardType: TextInputType.number,
89+
style: textStyle,
7690
decoration: InputDecoration(
7791
labelText: 'Term',
7892
hintText: 'Time in years',
93+
labelStyle: textStyle,
7994
border: OutlineInputBorder(
8095
borderRadius: BorderRadius.circular(5.0)
8196
)
@@ -109,7 +124,9 @@ class _SIFormState extends State<SIForm> {
109124
child: Row(children: <Widget>[
110125
Expanded(
111126
child: RaisedButton(
112-
child: Text('Calculate'),
127+
color: Theme.of(context).accentColor,
128+
textColor: Theme.of(context).primaryColorDark,
129+
child: Text('Calculate', textScaleFactor: 1.5,),
113130
onPressed: () {
114131

115132
},
@@ -118,7 +135,9 @@ class _SIFormState extends State<SIForm> {
118135

119136
Expanded(
120137
child: RaisedButton(
121-
child: Text('Reset'),
138+
color: Theme.of(context).primaryColorDark,
139+
textColor: Theme.of(context).primaryColorLight,
140+
child: Text('Reset', textScaleFactor: 1.5,),
122141
onPressed: () {
123142

124143
},
@@ -129,7 +148,7 @@ class _SIFormState extends State<SIForm> {
129148

130149
Padding(
131150
padding: EdgeInsets.all(_minimumPadding * 2),
132-
child: Text('Todo Text'),
151+
child: Text('Todo Text', style: textStyle,),
133152
)
134153

135154
],

0 commit comments

Comments
 (0)