dynamic pop up - success
This commit is contained in:
@@ -18,14 +18,46 @@ class MIHSuccessMessage extends StatefulWidget {
|
|||||||
class _MIHSuccessMessageState extends State<MIHSuccessMessage> {
|
class _MIHSuccessMessageState extends State<MIHSuccessMessage> {
|
||||||
var messageTypes = <String, Widget>{};
|
var messageTypes = <String, Widget>{};
|
||||||
late String message;
|
late String message;
|
||||||
|
late double popUpWidth;
|
||||||
|
late double? popUpheight;
|
||||||
|
late double popUpTitleSize;
|
||||||
|
late double popUpSubtitleSize;
|
||||||
|
late double popUpBodySize;
|
||||||
|
late double popUpIconSize;
|
||||||
|
late double popUpPaddingSize;
|
||||||
|
late Size? size;
|
||||||
|
|
||||||
|
void checkScreenSize() {
|
||||||
|
if (MzanziInnovationHub.of(context)!.theme.screenType == "desktop") {
|
||||||
|
setState(() {
|
||||||
|
popUpWidth = (size!.width / 4) * 2;
|
||||||
|
popUpheight = null;
|
||||||
|
popUpTitleSize = 25.0;
|
||||||
|
popUpSubtitleSize = 20.0;
|
||||||
|
popUpBodySize = 15;
|
||||||
|
popUpPaddingSize = 25.0;
|
||||||
|
popUpIconSize = 100;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
popUpWidth = size!.width - (size!.width * 0.1);
|
||||||
|
popUpheight = null;
|
||||||
|
popUpTitleSize = 20.0;
|
||||||
|
popUpSubtitleSize = 18.0;
|
||||||
|
popUpBodySize = 15;
|
||||||
|
popUpPaddingSize = 15.0;
|
||||||
|
popUpIconSize = 100;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void setSuccessmessage() {
|
void setSuccessmessage() {
|
||||||
messageTypes["Success"] = Stack(
|
messageTypes["Success"] = Stack(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.all(10.0),
|
padding: EdgeInsets.all(popUpPaddingSize),
|
||||||
width: 500.0,
|
width: popUpWidth,
|
||||||
// height: 375.0,
|
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),
|
||||||
@@ -38,36 +70,32 @@ class _MIHSuccessMessageState extends State<MIHSuccessMessage> {
|
|||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
Icons.check_circle_outline_rounded,
|
Icons.check_circle_outline_rounded,
|
||||||
size: 100,
|
size: popUpIconSize,
|
||||||
color: MzanziInnovationHub.of(context)!.theme.successColor(),
|
color: MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 15),
|
//const SizedBox(height: 15),
|
||||||
Text(
|
Text(
|
||||||
"Success!",
|
"Success!",
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: MzanziInnovationHub.of(context)!.theme.successColor(),
|
color: MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
fontSize: 25.0,
|
fontSize: popUpTitleSize,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 15),
|
||||||
Padding(
|
Center(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 25.0),
|
|
||||||
child: Center(
|
|
||||||
child: Text(
|
child: Text(
|
||||||
message,
|
message,
|
||||||
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,
|
||||||
@@ -101,13 +129,15 @@ class _MIHSuccessMessageState extends State<MIHSuccessMessage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
message = widget.successMessage;
|
|
||||||
setSuccessmessage();
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
size = MediaQuery.of(context).size;
|
||||||
|
checkScreenSize();
|
||||||
|
message = widget.successMessage;
|
||||||
|
setSuccessmessage();
|
||||||
return Dialog(child: getSuccessMessage(widget.successType));
|
return Dialog(child: getSuccessMessage(widget.successType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user