@@ -18,45 +18,64 @@ class _HomeState extends State<Home> {
1818 Widget build (BuildContext context) {
1919
2020 data = ModalRoute .of (context).settings.arguments;
21- print (data);
21+
22+ // set background image
23+ String bgImage = data['isDaytime' ] ? 'day.png' : 'night.png' ;
24+ Color bgColor = data['isDaytime' ] ? Colors .blue : Colors .indigo[700 ];
2225
2326 return Scaffold (
24- //appBar: AppBar() ,
27+ backgroundColor : bgColor ,
2528 body: SafeArea (
26- child: Padding (
27- padding: const EdgeInsets .fromLTRB (0 , 120.0 , 0 , 0 ),
28- child: Column (
29- children: < Widget > [
30- FlatButton .icon (
31- onPressed: () {
32- Navigator .pushNamed (context, '/location' );
33- },
34- icon: Icon (Icons .edit_location),
35- label: Text (
36- 'Edit Location'
37- )
38- ),
39- SizedBox (height: 20.0 ),
40- Row (
41- mainAxisAlignment: MainAxisAlignment .center,
42- children: < Widget > [
43- Text (
44- data['location' ],
29+ child: Container (
30+ decoration: BoxDecoration (
31+ image: DecorationImage (
32+ image: AssetImage ('assets/$bgImage ' ),
33+ fit: BoxFit .cover,
34+ )
35+ ),
36+ child: Padding (
37+ padding: const EdgeInsets .fromLTRB (0 , 120.0 , 0 , 0 ),
38+ child: Column (
39+ children: < Widget > [
40+ FlatButton .icon (
41+ onPressed: () {
42+ Navigator .pushNamed (context, '/location' );
43+ },
44+ icon: Icon (
45+ Icons .edit_location,
46+ color: Colors .grey[300 ],
47+ ),
48+ label: Text (
49+ 'Edit Location' ,
4550 style: TextStyle (
46- fontSize: 28.0 ,
47- letterSpacing: 2.0 ,
51+ color: Colors .grey[300 ],
4852 ),
4953 ),
50- ],
51- ),
52- SizedBox (height: 20.0 ),
53- Text (
54- data['time' ],
55- style: TextStyle (
56- fontSize: 66.0 ,
57- )
58- ),
59- ],
54+ ),
55+ SizedBox (height: 20.0 ),
56+ Row (
57+ mainAxisAlignment: MainAxisAlignment .center,
58+ children: < Widget > [
59+ Text (
60+ data['location' ],
61+ style: TextStyle (
62+ fontSize: 28.0 ,
63+ letterSpacing: 2.0 ,
64+ color: Colors .white,
65+ ),
66+ ),
67+ ],
68+ ),
69+ SizedBox (height: 20.0 ),
70+ Text (
71+ data['time' ],
72+ style: TextStyle (
73+ fontSize: 66.0 ,
74+ color: Colors .white
75+ )
76+ ),
77+ ],
78+ ),
6079 ),
6180 ),
6281 ),
0 commit comments