create notification Object
This commit is contained in:
@@ -1,15 +1,17 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:patient_manager/main.dart';
|
import 'package:patient_manager/main.dart';
|
||||||
import 'package:patient_manager/mih_objects/app_user.dart';
|
import 'package:patient_manager/mih_objects/app_user.dart';
|
||||||
|
import 'package:patient_manager/mih_objects/notification.dart';
|
||||||
|
|
||||||
class MIHNotificationDrawer extends StatefulWidget {
|
class MIHNotificationDrawer extends StatefulWidget {
|
||||||
final AppUser signedInUser;
|
final AppUser signedInUser;
|
||||||
final ImageProvider<Object>? propicFile;
|
final List<MIHNotification> notifications;
|
||||||
|
//final ImageProvider<Object>? propicFile;
|
||||||
|
|
||||||
const MIHNotificationDrawer({
|
const MIHNotificationDrawer({
|
||||||
super.key,
|
super.key,
|
||||||
required this.signedInUser,
|
required this.signedInUser,
|
||||||
required this.propicFile,
|
required this.notifications,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -34,7 +36,7 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
|
|||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget displayNotifications(int index) {
|
Widget displayTempNotifications(int index) {
|
||||||
String title = notificationList[index][0];
|
String title = notificationList[index][0];
|
||||||
String subtitle = notificationList[index][1];
|
String subtitle = notificationList[index][1];
|
||||||
return ListTile(
|
return ListTile(
|
||||||
@@ -56,6 +58,59 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget displayNotifications(int index) {
|
||||||
|
String title = widget.notifications[index].notification_type;
|
||||||
|
String subtitle = widget.notifications[index].notification_message;
|
||||||
|
Widget notificationTitle;
|
||||||
|
if (widget.notifications[index].notification_read == "No") {
|
||||||
|
notificationTitle = Row(
|
||||||
|
children: [
|
||||||
|
const Icon(Icons.circle_notifications),
|
||||||
|
const SizedBox(
|
||||||
|
width: 5,
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
child: Text(
|
||||||
|
title,
|
||||||
|
style: TextStyle(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
notificationTitle = Row(
|
||||||
|
children: [
|
||||||
|
//const Icon(Icons.circle_notifications),
|
||||||
|
Flexible(
|
||||||
|
child: Text(
|
||||||
|
title,
|
||||||
|
style: TextStyle(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return ListTile(
|
||||||
|
title: notificationTitle,
|
||||||
|
subtitle: Text(
|
||||||
|
subtitle,
|
||||||
|
style: TextStyle(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).pushNamed(
|
||||||
|
widget.notifications[index].action_path,
|
||||||
|
arguments: widget.signedInUser,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
@@ -106,7 +161,7 @@ class _MIHNotificationDrawerState extends State<MIHNotificationDrawer> {
|
|||||||
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
itemCount: notificationList.length,
|
itemCount: widget.notifications.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
//final patient = widget.patients[index].id_no.contains(widget.searchString);
|
//final patient = widget.patients[index].id_no.contains(widget.searchString);
|
||||||
//print(index);
|
//print(index);
|
||||||
|
|||||||
Reference in New Issue
Block a user