change profile getter to check for patient profile

This commit is contained in:
2024-12-18 11:25:36 +02:00
parent 292c632e5a
commit 2c0560c475
4 changed files with 101 additions and 23 deletions

View File

@@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:convert';
// import 'dart:convert';
import 'package:Mzansi_Innovation_Hub/mih_objects/patients.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_swipe_detector/flutter_swipe_detector.dart';
@@ -43,6 +44,7 @@ class MIHHome extends StatefulWidget {
final AppUser signedInUser;
final BusinessUser? businessUser;
final Business? business;
final Patient? patient;
final List<MIHNotification> notifications;
final ImageProvider<Object>? propicFile;
final bool isUserNew;
@@ -55,6 +57,7 @@ class MIHHome extends StatefulWidget {
required this.signedInUser,
required this.businessUser,
required this.business,
required this.patient,
required this.notifications,
required this.propicFile,
required this.isUserNew,
@@ -169,29 +172,78 @@ class _MIHHomeState extends State<MIHHome> {
p: getPrim(),
s: getSec(),
));
tileList.add(MIHTile(
videoID: "NUDdoWrbXNc",
onTap: () {
Navigator.of(context).pushNamed('/patient-profile',
arguments: PatientViewArguments(
widget.signedInUser, null, null, null, "personal"));
},
tileName: "Patient Profile",
tileIcon: Center(
child: FaIcon(
FontAwesomeIcons.bookMedical,
color: getSec(),
size: 200,
print("Pat Prof: ${widget.patient}");
if (widget.patient != null) {
tileList.add(MIHTile(
videoID: "NUDdoWrbXNc",
onTap: () {
Navigator.of(context).pushNamed('/patient-profile',
arguments: PatientViewArguments(
widget.signedInUser, null, null, null, "personal"));
},
tileName: "Patient Profile",
tileIcon: Center(
child: FaIcon(
FontAwesomeIcons.bookMedical,
color: getSec(),
size: 200,
),
),
),
// Icon(
// Icons.medication,
// color: getSec(),
// size: 200,
// ),
p: getPrim(),
s: getSec(),
));
// Icon(
// Icons.medication,
// color: getSec(),
// size: 200,
// ),
p: getPrim(),
s: getSec(),
));
} else {
tileList.add(MIHTile(
videoID: "NUDdoWrbXNc",
onTap: () {
Navigator.of(context).pushNamed('/patient-profile/set-up',
arguments: widget.signedInUser);
},
tileName: "Set Up Patient",
tileIcon: Center(
child: FaIcon(
FontAwesomeIcons.bookMedical,
color: getSec(),
size: 200,
),
),
// Icon(
// Icons.medication,
// color: getSec(),
// size: 200,
// ),
p: getPrim(),
s: getSec(),
));
}
// tileList.add(MIHTile(
// videoID: "NUDdoWrbXNc",
// onTap: () {
// Navigator.of(context).pushNamed('/patient-profile',
// arguments: PatientViewArguments(
// widget.signedInUser, null, null, null, "personal"));
// },
// tileName: "Patient Profile",
// tileIcon: Center(
// child: FaIcon(
// FontAwesomeIcons.bookMedical,
// color: getSec(),
// size: 200,
// ),
// ),
// // Icon(
// // Icons.medication,
// // color: getSec(),
// // size: 200,
// // ),
// p: getPrim(),
// s: getSec(),
// ));
tileList.add(MIHTile(
onTap: () {
Navigator.of(context).pushNamed(

View File

@@ -99,6 +99,7 @@ class _MIHProfileGetterState extends State<MIHProfileGetter> {
signedInUser: snapshot.requireData.signedInUser,
businessUser: snapshot.data!.businessUser,
business: snapshot.data!.business,
patient: snapshot.data!.patient,
notifications: snapshot.data!.notifi,
propicFile: isPictureAvailable(snapshot.data!.profilePicUrl),
isUserNew: isUserNew(snapshot.requireData.signedInUser),