-
Notifications
You must be signed in to change notification settings - Fork 2
/
sideDraw.dart
114 lines (110 loc) · 3.56 KB
/
sideDraw.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
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:shared_preferences/shared_preferences.dart';
class SideDraw extends StatelessWidget {
final name;
final profilePicture;
SideDraw(this.name, this.profilePicture);
@override
Widget build(BuildContext context) {
return Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: <Widget>[
DrawerHeader(
decoration: BoxDecoration(
color: Colors.redAccent,
),
child: GestureDetector(
onTap: () {
Navigator.pushNamed(context, "profile");
},
child: Column(
children: <Widget>[
Container(
height: 113,
width: 113,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: const Color(0xff7c94b6),
image: DecorationImage(
image: profilePicture == null
? new ExactAssetImage('assets/profilepic.png')
: NetworkImage(profilePicture),
fit: BoxFit.cover,
),
border: Border.all(
color: Colors.white,
width: 2.0,
),
),
),
SizedBox(height: 8),
Text(
'$name',
style: TextStyle(
color: Colors.white, fontWeight: FontWeight.bold),
)
],
),
),
),
ListTile(
leading: Icon(
FontAwesomeIcons.ambulance,
size: 30,
color: Colors.red,
),
title: Text("Call Ambulance"),
subtitle: Text("For Urgent actions."),
onTap: () {
Navigator.pushNamed(context, 'ambulance');
},
),
ListTile(
leading: Icon(
FontAwesomeIcons.fileMedical,
size: 30,
color: Colors.red,
),
title: Text("Near Hospitals"),
subtitle: Text("To contact with the nearest hospital"),
onTap: () {
Navigator.pushNamed(context, 'doctors');
},
),
ListTile(
leading: Icon(
Icons.info,
size: 30,
color: Colors.red,
),
title: Text("About Us "),
subtitle: Text("About the capstone group."),
onTap: () {
Navigator.pushNamed(context, 'about');
},
),
ListTile(
leading: Icon(
FontAwesomeIcons.angleLeft,
size: 30,
color: Colors.red,
),
title: Text("Log Out"),
subtitle: Text("End your session."),
onTap: () async {
SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.remove("uid");
await prefs.remove("type");
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
await _firebaseMessaging.deleteInstanceID();
Navigator.pushReplacementNamed(context, 'welcome');
},
),
],
),
);
}
}