return SafeArea(
child: Scaffold(
body: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: data['isdaytime']? AssetImage('images/day.jpg'): AssetImage('images/night.jpg'),
fit: BoxFit.cover,
),
),
child: Padding(
padding: const EdgeInsets.fromLTRB(0, 80, 0, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
FlatButton(
onPressed: () async{
result = await Navigator.pushReplacementNamed(context, '/editlocation');
if(result!=0){
setState(() {
data = {
'location': result['location'],
'flag': result['flag'],
'time': result['time'],
'isdaytime': result['isdaytime'],
};
});
}
// Exception has occurred.
// FlutterError (setState() called after dispose():
// if(result!=0){
// print("11");
// data = {
// 'location': result['location'],
// 'flag': result['flag'],
// 'time': result['time'],
// 'isdaytime': result['isdaytime'],
// };
// print(data);
// // setState(() {
// // print("12");
// // data = {
// // 'location': result['location'],
// // 'flag': result['flag'],
// // 'time': result['time'],
// // 'isdaytime': result['isdaytime'],
// // };
// // print(data['location']);
// // });
// }
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(Icons.location_on,color: Colors.white,),
SizedBox(width:10.0),
Text(
"Edit Location",
style: TextStyle(
color: Colors.white,
),
),
],
),
),
SizedBox(
height: 10.0,
),
Center(
child: Text(data['time'],style: data['isdaytime']?
TextStyle(
fontSize: 40.0,
letterSpacing: 3.0,
fontWeight: FontWeight.bold,
) : TextStyle(
fontSize: 40.0,
letterSpacing: 3.0,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
SizedBox(
height: 10.0,
),
Center(
child: Text(data['location'],style: data['isdaytime']?
TextStyle(
fontSize: 30.0,
letterSpacing: 3.0,
fontStyle: FontStyle.italic,
) : TextStyle(
fontSize: 30.0,
letterSpacing: 3.0,
color: Colors.white,
fontStyle: FontStyle.italic,
),
),
),
],
),
),
),
),
);