Dynamic Pop Ups - Warnings

This commit is contained in:
2024-09-06 11:56:40 +02:00
parent 9cd55c6be5
commit 80b1bbb16a

View File

@@ -14,16 +14,47 @@ class MIHWarningMessage extends StatefulWidget {
class _MIHDeleteMessageState extends State<MIHWarningMessage> { class _MIHDeleteMessageState extends State<MIHWarningMessage> {
var messageTypes = <String, Widget>{}; var messageTypes = <String, Widget>{};
late double popUpWidth;
late double? popUpheight;
late double popUpTitleSize;
late double popUpSubtitleSize;
late double popUpBodySize;
late double popUpIconSize;
late double popUpPaddingSize;
late double width; late double width;
late double height; late double height;
void checkScreenSize() {
if (MzanziInnovationHub.of(context)!.theme.screenType == "desktop") {
setState(() {
popUpWidth = (width / 4) * 2;
popUpheight = null;
popUpTitleSize = 25.0;
popUpSubtitleSize = 20.0;
popUpBodySize = 15;
popUpPaddingSize = 25.0;
popUpIconSize = 100;
});
} else {
setState(() {
popUpWidth = width - (width * 0.1);
popUpheight = null;
popUpTitleSize = 20.0;
popUpSubtitleSize = 18.0;
popUpBodySize = 15;
popUpPaddingSize = 15.0;
popUpIconSize = 100;
});
}
}
void setNoAccess() { void setNoAccess() {
messageTypes["No Access"] = Stack( messageTypes["No Access"] = Stack(
children: [ children: [
Container( Container(
padding: const EdgeInsets.all(10.0), padding: EdgeInsets.all(popUpPaddingSize),
width: 500.0, width: popUpWidth,
height: (height / 3) * 1.5, height: popUpheight,
decoration: BoxDecoration( decoration: BoxDecoration(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(), color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
borderRadius: BorderRadius.circular(25.0), borderRadius: BorderRadius.circular(25.0),
@@ -33,39 +64,36 @@ class _MIHDeleteMessageState extends State<MIHWarningMessage> {
), ),
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.min,
children: [ children: [
Icon( Icon(
Icons.warning_amber_rounded, Icons.warning_amber_rounded,
size: 100, size: popUpIconSize,
color: color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(), MzanziInnovationHub.of(context)!.theme.secondaryColor(),
), ),
const SizedBox(height: 15), //const SizedBox(height: 15),
Text( Text(
"Access Pending", "Access Pending",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(), MzanziInnovationHub.of(context)!.theme.secondaryColor(),
fontSize: 25.0, fontSize: popUpTitleSize,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
const SizedBox(height: 15), const SizedBox(height: 15),
Padding( Text(
padding: const EdgeInsets.symmetric(horizontal: 25.0), "Your access request is currently being reviewed.\nOnce approved, you'll be able to view patient data.\nPlease follow up with the patient to approve your access request.",
child: Text( style: TextStyle(
"Your access request is currently being reviewed.\n\nOnce approved, you'll be able to view patient data.\n\nPlease follow up with the patient to approve your access request.", color:
style: TextStyle( MzanziInnovationHub.of(context)!.theme.secondaryColor(),
color: MzanziInnovationHub.of(context)! fontSize: popUpBodySize,
.theme fontWeight: FontWeight.bold,
.secondaryColor(),
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
), ),
), ),
const SizedBox(height: 15),
], ],
), ),
), ),
@@ -94,9 +122,9 @@ class _MIHDeleteMessageState extends State<MIHWarningMessage> {
messageTypes["Expired Access"] = Stack( messageTypes["Expired Access"] = Stack(
children: [ children: [
Container( Container(
padding: const EdgeInsets.all(10.0), padding: EdgeInsets.all(popUpPaddingSize),
width: 500.0, width: popUpWidth,
height: (height / 3) * 1, height: popUpheight,
decoration: BoxDecoration( decoration: BoxDecoration(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(), color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
borderRadius: BorderRadius.circular(25.0), borderRadius: BorderRadius.circular(25.0),
@@ -106,39 +134,36 @@ class _MIHDeleteMessageState extends State<MIHWarningMessage> {
), ),
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
//mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.min,
children: [ children: [
Icon( Icon(
Icons.warning_amber_rounded, Icons.warning_amber_rounded,
size: 100, size: popUpIconSize,
color: color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(), MzanziInnovationHub.of(context)!.theme.secondaryColor(),
), ),
const SizedBox(height: 15), //const SizedBox(height: 15),
Text( Text(
"Access Expired", "Access Expired",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(), MzanziInnovationHub.of(context)!.theme.secondaryColor(),
fontSize: 25.0, fontSize: popUpTitleSize,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
const SizedBox(height: 15), const SizedBox(height: 15),
Padding( Text(
padding: const EdgeInsets.symmetric(horizontal: 25.0), "You no longer have access to this patient profile. The authorized access period has ended. Access to a patients profile is limited to 7 days from appointment date.",
child: Text( style: TextStyle(
"You no longer have access to this patient profile. The authorized access period has ended. Access to a patients profile is limited to 7 days from appointment date.", color:
style: TextStyle( MzanziInnovationHub.of(context)!.theme.secondaryColor(),
color: MzanziInnovationHub.of(context)! fontSize: popUpBodySize,
.theme fontWeight: FontWeight.bold,
.secondaryColor(),
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
), ),
), ),
const SizedBox(height: 15),
], ],
), ),
), ),
@@ -180,6 +205,7 @@ class _MIHDeleteMessageState extends State<MIHWarningMessage> {
width = size.width; width = size.width;
height = size.height; height = size.height;
}); });
checkScreenSize();
setNoAccess(); setNoAccess();
setExpiredAccess(); setExpiredAccess();
//print(size); //print(size);