Dynamic pop[ up - delete

This commit is contained in:
2024-09-06 12:09:44 +02:00
parent dcf40c3187
commit 791b4009ed

View File

@@ -17,16 +17,47 @@ class MIHDeleteMessage extends StatefulWidget {
class _MIHDeleteMessageState extends State<MIHDeleteMessage> { class _MIHDeleteMessageState extends State<MIHDeleteMessage> {
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 setDeleteNote() { void setDeleteNote() {
messageTypes["Note"] = Stack( messageTypes["Note"] = 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),
@@ -36,40 +67,36 @@ class _MIHDeleteMessageState extends State<MIHDeleteMessage> {
), ),
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(
"Are you sure you want to delete this?", "Are you sure you want to delete this?",
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),
child: Text(
"This note will be deleted permanently. Are you certain you want to delete it?", "This note will be deleted permanently. Are you certain you want to delete it?",
style: TextStyle( style: TextStyle(
color: MzanziInnovationHub.of(context)! color:
.theme MzanziInnovationHub.of(context)!.theme.secondaryColor(),
.secondaryColor(), fontSize: popUpBodySize,
fontSize: 15.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
), const SizedBox(height: 15),
const SizedBox(height: 30),
SizedBox( SizedBox(
width: 300, width: 300,
height: 50, height: 50,
@@ -110,9 +137,9 @@ class _MIHDeleteMessageState extends State<MIHDeleteMessage> {
messageTypes["File"] = Stack( messageTypes["File"] = 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),
@@ -122,40 +149,36 @@ class _MIHDeleteMessageState extends State<MIHDeleteMessage> {
), ),
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(
"Are you sure you want to delete this?", "Are you sure you want to delete this?",
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),
child: Text(
"This file will be deleted permanently. Are you certain you want to delete it?", "This file will be deleted permanently. Are you certain you want to delete it?",
style: TextStyle( style: TextStyle(
color: MzanziInnovationHub.of(context)! color:
.theme MzanziInnovationHub.of(context)!.theme.secondaryColor(),
.secondaryColor(), fontSize: popUpBodySize,
fontSize: 15.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
), const SizedBox(height: 15),
const SizedBox(height: 30),
SizedBox( SizedBox(
width: 300, width: 300,
height: 50, height: 50,
@@ -209,6 +232,7 @@ class _MIHDeleteMessageState extends State<MIHDeleteMessage> {
width = size.width; width = size.width;
height = size.height; height = size.height;
}); });
checkScreenSize();
setDeleteNote(); setDeleteNote();
setFileNote(); setFileNote();