-
Notifications
You must be signed in to change notification settings - Fork 1
/
patient_home_page.dart
377 lines (358 loc) · 9.74 KB
/
patient_home_page.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter/material.dart';
import 'appointment_page.dart';
void main() {
runApp(PatientApp());
}
class PatientApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Patient App',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: PatientHomePage(),
);
}
}
class PatientHomePage extends StatefulWidget {
@override
_PatientHomePageState createState() => _PatientHomePageState();
}
class _PatientHomePageState extends State<PatientHomePage> {
int _selectedIndex = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Patient App'),
actions: [
IconButton(
icon: Icon(Icons.search),
onPressed: () {
// Implement search functionality
},
),
],
),
body: Stack(
children: [
// Background image
Image.asset(
'assets/background_image.jpg', // Replace with your image path
fit: BoxFit.cover,
width: double.infinity,
height: double.infinity,
),
// Existing content
SingleChildScrollView(
child: Column(
children: [
_buildNewsCarousel(),
SizedBox(height: 16), // Add spacing from the top
_buildQuickAccessMenu(),
SizedBox(
height: 16), // Add spacing between Quick Access and Body
_buildBody(_selectedIndex),
],
),
),
],
),
bottomNavigationBar: BottomNavigationBar(
currentIndex: _selectedIndex,
onTap: (index) {
setState(() {
_selectedIndex = index;
});
},
items: [
BottomNavigationBarItem(
icon: Icon(Icons.home),
label: 'Home',
),
BottomNavigationBarItem(
icon: Icon(Icons.list),
label: 'List',
),
BottomNavigationBarItem(
icon: Icon(Icons.person),
label: 'Profile',
),
],
),
drawer: Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: [
DrawerHeader(
decoration: BoxDecoration(
color: Colors.blue,
),
child: Text('Menu'),
),
ListTile(
title: Text('Home'),
onTap: () {
// Navigate to the home screen
Navigator.pop(context);
setState(() {
_selectedIndex = 0;
});
},
),
ListTile(
title: Text('List'),
onTap: () {
// Navigate to the List screen
Navigator.pop(context);
setState(() {
_selectedIndex = 1;
});
},
),
ListTile(
title: Text('Profile'),
onTap: () {
// Navigate to the Profile screen
Navigator.pop(context);
setState(() {
_selectedIndex = 2;
});
},
),
],
),
),
);
}
Widget _buildNewsCarousel() {
return CarouselSlider(
items: [
// Carousel items with images and news details
Card(
elevation: 3,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: Image.asset(
'assets/news11.jpg', // Replace with your image path
fit: BoxFit.cover,
),
),
ListTile(
title: Text('A special visit',
style: TextStyle(fontWeight: FontWeight.bold)),
subtitle: Text('PM modi take tour of hospital'),
),
],
),
),
Card(
elevation: 3,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: Image.asset(
'assets/news22.jpg', // Replace with your image path
fit: BoxFit.cover,
),
),
ListTile(
title: Text('COVID-19 updates',
style: TextStyle(fontWeight: FontWeight.bold)),
subtitle: Text('A new variant found'),
),
],
),
),
Card(
elevation: 3,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: Image.asset(
'assets/news3.jpg', // Replace with your image path
fit: BoxFit.cover,
),
),
ListTile(
title: Text('Do' 's and Dont' 's',
style: TextStyle(fontWeight: FontWeight.bold)),
subtitle:
Text('Take a tour of what to do in case of emergency'),
),
],
),
),
// Add more carousel items with images and news details as needed
],
options: CarouselOptions(
height: 200.0, // Adjust the carousel height as needed
autoPlay: true,
enlargeCenterPage: true,
),
);
}
Widget _buildQuickAccessMenu() {
return GridView.count(
crossAxisCount: 2,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
children: [
_buildQuickAccessItem('Appointment', Icons.event, () {
// Navigate to the Appointment page
Navigator.push(
context, MaterialPageRoute(builder: (_) => AppointmentPage()));
}),
_buildQuickAccessItem('Emergency', Icons.local_hospital, () {
// Navigate to the Emergency page
Navigator.push(
context, MaterialPageRoute(builder: (_) => EmergencyPage()));
}),
_buildQuickAccessItem('Health History', Icons.history, () {
// Navigate to the Health History page
Navigator.push(
context, MaterialPageRoute(builder: (_) => HealthHistoryPage()));
}),
_buildQuickAccessItem('Review', Icons.star, () {
// Navigate to the Review page
Navigator.push(
context, MaterialPageRoute(builder: (_) => ReviewPage()));
}),
// Add more Quick Access items as needed
],
);
}
Widget _buildQuickAccessItem(
String title, IconData icon, void Function()? onPressed) {
return InkWell(
onTap: onPressed,
child: Container(
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.2), // Adjust the opacity as needed
borderRadius: BorderRadius.circular(10.0), // Add rounded corners
border: Border.all(
color: Colors.blue, // Border color
width: 1.0, // Border width
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
icon,
size: 100, // Adjust the icon size as needed
color: Colors.blue,
),
SizedBox(height: 8),
Text(
title,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
],
),
),
);
}
Widget _buildBody(int index) {
switch (index) {
case 0:
return _buildHomePageContent();
case 1:
return Container(); // You can return an empty container for "List" for now
case 2:
return Container(); // You can return an empty container for "Profile" for now
default:
return Container();
}
}
Widget _buildHomePageContent() {
return Center(
child: Text('Home Page Content'),
);
}
void _navigateToListPage() {
Navigator.of(context).push(
MaterialPageRoute(
builder: (_) => ListPage(),
),
);
}
void _navigateToProfilePage() {
Navigator.of(context).push(
MaterialPageRoute(
builder: (_) => ProfilePage(),
),
);
}
}
class EmergencyPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Emergency'),
),
body: Center(
child: Text('Emergency Page Content'),
),
);
}
}
class HealthHistoryPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Health History'),
),
body: Center(
child: Text('Health History Page Content'),
),
);
}
}
class ReviewPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Review'),
),
body: Center(
child: Text('Review Page Content'),
),
);
}
}
class ListPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('List Page'),
),
body: Center(
child: Text('List Page Content'),
),
);
}
}
class ProfilePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Profile Page'),
),
body: Center(
child: Text('Profile Page Content'),
),
);
}
}