fix alert padding for desktop

This commit is contained in:
2025-11-21 12:11:51 +02:00
parent b82a5a72c7
commit b749dc62d9

View File

@@ -7,12 +7,25 @@ import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart'; import 'package:mzansi_innovation_hub/mih_package_components/mih_single_child_scroll.dart';
class MihAlertServices { class MihAlertServices {
double getPadingBasedOnScreenWidth(BuildContext context) {
var size = MediaQuery.of(context).size;
if (MzansiInnovationHub.of(context)!.theme.screenType == "desktop") {
return size.width / 7; // Large screens
} else {
return 25.0;
}
}
void internetConnectionAlert(BuildContext context) { void internetConnectionAlert(BuildContext context) {
showDialog( showDialog(
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (context) { builder: (context) {
return MihPackageWindow( return Padding(
padding: EdgeInsets.symmetric(
horizontal: getPadingBasedOnScreenWidth(context),
),
child: MihPackageWindow(
fullscreen: false, fullscreen: false,
windowTitle: null, windowTitle: null,
onWindowTapClose: null, onWindowTapClose: null,
@@ -45,7 +58,8 @@ class MihAlertServices {
"We seem to be having some trouble connecting you to the internet. This could be due to a temporary outage or an issue with your device's connection.", "We seem to be having some trouble connecting you to the internet. This could be due to a temporary outage or an issue with your device's connection.",
style: TextStyle( style: TextStyle(
color: MihColors.getSecondaryColor( color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@@ -73,6 +87,7 @@ class MihAlertServices {
], ],
), ),
), ),
),
); );
}, },
); );
@@ -83,7 +98,11 @@ class MihAlertServices {
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (context) { builder: (context) {
return MihPackageWindow( return Padding(
padding: EdgeInsets.symmetric(
horizontal: getPadingBasedOnScreenWidth(context),
),
child: MihPackageWindow(
fullscreen: false, fullscreen: false,
windowTitle: null, windowTitle: null,
onWindowTapClose: null, onWindowTapClose: null,
@@ -116,7 +135,8 @@ class MihAlertServices {
"To get the most out of MIH, we need your location. Please go to the site settings of the app and enable location services. Once you do that, we can start showing you relevant information based on your location.", "To get the most out of MIH, we need your location. Please go to the site settings of the app and enable location services. Once you do that, we can start showing you relevant information based on your location.",
style: TextStyle( style: TextStyle(
color: MihColors.getSecondaryColor( color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@@ -144,6 +164,7 @@ class MihAlertServices {
], ],
), ),
), ),
),
); );
}, },
); );
@@ -154,7 +175,11 @@ class MihAlertServices {
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (context) { builder: (context) {
return MihPackageWindow( return Padding(
padding: EdgeInsets.symmetric(
horizontal: getPadingBasedOnScreenWidth(context),
),
child: MihPackageWindow(
fullscreen: false, fullscreen: false,
windowTitle: null, windowTitle: null,
onWindowTapClose: null, onWindowTapClose: null,
@@ -187,7 +212,8 @@ class MihAlertServices {
"We noticed that some required fields are still empty. To ensure your request is processed smoothly, please fill out all the highlighted fields before submitting the form again.", "We noticed that some required fields are still empty. To ensure your request is processed smoothly, please fill out all the highlighted fields before submitting the form again.",
style: TextStyle( style: TextStyle(
color: MihColors.getSecondaryColor( color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@@ -208,7 +234,9 @@ class MihAlertServices {
style: TextStyle( style: TextStyle(
fontStyle: FontStyle.italic, fontStyle: FontStyle.italic,
color: MihColors.getSecondaryColor( color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"))), "Dark"))),
const TextSpan( const TextSpan(
text: "Look for fields with an asterisk ("), text: "Look for fields with an asterisk ("),
@@ -216,7 +244,9 @@ class MihAlertServices {
text: "*", text: "*",
style: TextStyle( style: TextStyle(
color: MihColors.getSecondaryColor( color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"))), "Dark"))),
const TextSpan( const TextSpan(
text: ") next to them, as these are mandatory."), text: ") next to them, as these are mandatory."),
@@ -246,6 +276,7 @@ class MihAlertServices {
], ],
), ),
), ),
),
); );
}, },
); );
@@ -256,7 +287,11 @@ class MihAlertServices {
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (context) { builder: (context) {
return MihPackageWindow( return Padding(
padding: EdgeInsets.symmetric(
horizontal: getPadingBasedOnScreenWidth(context),
),
child: MihPackageWindow(
fullscreen: false, fullscreen: false,
windowTitle: null, windowTitle: null,
onWindowTapClose: null, onWindowTapClose: null,
@@ -289,7 +324,8 @@ class MihAlertServices {
"Oops! Your password doesn't quite meet our standards. To keep your account secure, please make sure your password meets the following requirements", "Oops! Your password doesn't quite meet our standards. To keep your account secure, please make sure your password meets the following requirements",
style: TextStyle( style: TextStyle(
color: MihColors.getSecondaryColor( color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@@ -311,16 +347,20 @@ class MihAlertServices {
fontStyle: FontStyle.italic, fontStyle: FontStyle.italic,
fontSize: 20, fontSize: 20,
color: MihColors.getSecondaryColor( color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == MzansiInnovationHub.of(context)!
.theme
.mode ==
"Dark"))), "Dark"))),
const TextSpan( const TextSpan(
text: "1) Contailes at least 8 characters\n", text: "1) Contailes at least 8 characters\n",
), ),
const TextSpan( const TextSpan(
text: "2) Contains at least 1 uppercase letter (A-Z)\n", text:
"2) Contains at least 1 uppercase letter (A-Z)\n",
), ),
const TextSpan( const TextSpan(
text: "3) Contains at least 1 lowercase letter (a-z)\n", text:
"3) Contains at least 1 lowercase letter (a-z)\n",
), ),
const TextSpan( const TextSpan(
text: "4) Contains at least 1 number (0-9)\n", text: "4) Contains at least 1 number (0-9)\n",
@@ -354,6 +394,7 @@ class MihAlertServices {
], ],
), ),
), ),
),
); );
}, },
); );
@@ -364,7 +405,11 @@ class MihAlertServices {
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (context) { builder: (context) {
return MihPackageWindow( return Padding(
padding: EdgeInsets.symmetric(
horizontal: getPadingBasedOnScreenWidth(context),
),
child: MihPackageWindow(
fullscreen: false, fullscreen: false,
windowTitle: null, windowTitle: null,
onWindowTapClose: null, onWindowTapClose: null,
@@ -397,7 +442,8 @@ class MihAlertServices {
"The password and confirm password fields do not match. Please make sure they are identical.", "The password and confirm password fields do not match. Please make sure they are identical.",
style: TextStyle( style: TextStyle(
color: MihColors.getSecondaryColor( color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@@ -425,6 +471,7 @@ class MihAlertServices {
], ],
), ),
), ),
),
); );
}, },
); );
@@ -435,7 +482,11 @@ class MihAlertServices {
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (context) { builder: (context) {
return MihPackageWindow( return Padding(
padding: EdgeInsets.symmetric(
horizontal: getPadingBasedOnScreenWidth(context),
),
child: MihPackageWindow(
fullscreen: false, fullscreen: false,
windowTitle: null, windowTitle: null,
onWindowTapClose: null, onWindowTapClose: null,
@@ -468,7 +519,8 @@ class MihAlertServices {
"The email address or password you entered doesn't seem to match our records. Please double-check your information and try again.", "The email address or password you entered doesn't seem to match our records. Please double-check your information and try again.",
style: TextStyle( style: TextStyle(
color: MihColors.getSecondaryColor( color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@@ -479,7 +531,8 @@ class MihAlertServices {
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: TextStyle( style: TextStyle(
color: MihColors.getSecondaryColor( color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontSize: 18.0, fontSize: 18.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@@ -490,7 +543,8 @@ class MihAlertServices {
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: TextStyle( style: TextStyle(
color: MihColors.getSecondaryColor( color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontSize: 15.0, fontSize: 15.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@@ -518,6 +572,7 @@ class MihAlertServices {
], ],
), ),
), ),
),
); );
}, },
); );
@@ -528,7 +583,11 @@ class MihAlertServices {
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (context) { builder: (context) {
return MihPackageWindow( return Padding(
padding: EdgeInsets.symmetric(
horizontal: getPadingBasedOnScreenWidth(context),
),
child: MihPackageWindow(
fullscreen: false, fullscreen: false,
windowTitle: null, windowTitle: null,
onWindowTapClose: null, onWindowTapClose: null,
@@ -561,7 +620,8 @@ class MihAlertServices {
"It looks like that email is already registered. Please sign in or try a different email.", "It looks like that email is already registered. Please sign in or try a different email.",
style: TextStyle( style: TextStyle(
color: MihColors.getSecondaryColor( color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@@ -589,6 +649,7 @@ class MihAlertServices {
], ],
), ),
), ),
),
); );
}, },
); );
@@ -599,7 +660,11 @@ class MihAlertServices {
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (context) { builder: (context) {
return MihPackageWindow( return Padding(
padding: EdgeInsets.symmetric(
horizontal: getPadingBasedOnScreenWidth(context),
),
child: MihPackageWindow(
fullscreen: false, fullscreen: false,
windowTitle: null, windowTitle: null,
onWindowTapClose: null, onWindowTapClose: null,
@@ -632,7 +697,8 @@ class MihAlertServices {
"Looks like there's a little hiccup with that email address. Please double-check that you've entered it correctly, including the \"@\" symbol and a domain (like example@email.com).", "Looks like there's a little hiccup with that email address. Please double-check that you've entered it correctly, including the \"@\" symbol and a domain (like example@email.com).",
style: TextStyle( style: TextStyle(
color: MihColors.getSecondaryColor( color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@@ -660,6 +726,7 @@ class MihAlertServices {
], ],
), ),
), ),
),
); );
}, },
); );
@@ -670,7 +737,11 @@ class MihAlertServices {
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (context) { builder: (context) {
return MihPackageWindow( return Padding(
padding: EdgeInsets.symmetric(
horizontal: getPadingBasedOnScreenWidth(context),
),
child: MihPackageWindow(
fullscreen: false, fullscreen: false,
windowTitle: null, windowTitle: null,
onWindowTapClose: null, onWindowTapClose: null,
@@ -703,7 +774,8 @@ class MihAlertServices {
message, message,
style: TextStyle( style: TextStyle(
color: MihColors.getPrimaryColor( color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@@ -731,6 +803,7 @@ class MihAlertServices {
], ],
), ),
), ),
),
); );
}, },
); );
@@ -746,7 +819,11 @@ class MihAlertServices {
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (context) { builder: (context) {
return MihPackageWindow( return Padding(
padding: EdgeInsets.symmetric(
horizontal: getPadingBasedOnScreenWidth(context),
),
child: MihPackageWindow(
fullscreen: false, fullscreen: false,
windowTitle: null, windowTitle: null,
onWindowTapClose: null, onWindowTapClose: null,
@@ -779,7 +856,8 @@ class MihAlertServices {
message, message,
style: TextStyle( style: TextStyle(
color: MihColors.getPrimaryColor( color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@@ -796,6 +874,7 @@ class MihAlertServices {
], ],
), ),
), ),
),
); );
}, },
); );
@@ -810,7 +889,11 @@ class MihAlertServices {
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (context) { builder: (context) {
return MihPackageWindow( return Padding(
padding: EdgeInsets.symmetric(
horizontal: getPadingBasedOnScreenWidth(context),
),
child: MihPackageWindow(
fullscreen: false, fullscreen: false,
windowTitle: null, windowTitle: null,
onWindowTapClose: null, onWindowTapClose: null,
@@ -843,7 +926,8 @@ class MihAlertServices {
message, message,
style: TextStyle( style: TextStyle(
color: MihColors.getSecondaryColor( color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@@ -897,6 +981,7 @@ class MihAlertServices {
], ],
), ),
), ),
),
); );
}, },
); );
@@ -911,7 +996,11 @@ class MihAlertServices {
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (context) { builder: (context) {
return MihPackageWindow( return Padding(
padding: EdgeInsets.symmetric(
horizontal: getPadingBasedOnScreenWidth(context),
),
child: MihPackageWindow(
fullscreen: false, fullscreen: false,
windowTitle: null, windowTitle: null,
onWindowTapClose: null, onWindowTapClose: null,
@@ -931,7 +1020,8 @@ class MihAlertServices {
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: MihColors.getPrimaryColor( color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontSize: 25, fontSize: 25,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@@ -972,6 +1062,7 @@ class MihAlertServices {
], ],
), ),
), ),
),
); );
}, },
); );
@@ -987,7 +1078,11 @@ class MihAlertServices {
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (context) { builder: (context) {
return MihPackageWindow( return Padding(
padding: EdgeInsets.symmetric(
horizontal: getPadingBasedOnScreenWidth(context),
),
child: MihPackageWindow(
fullscreen: false, fullscreen: false,
windowTitle: null, windowTitle: null,
onWindowTapClose: null, onWindowTapClose: null,
@@ -1007,7 +1102,8 @@ class MihAlertServices {
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: MihColors.getPrimaryColor( color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontSize: 25, fontSize: 25,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@@ -1037,6 +1133,7 @@ class MihAlertServices {
], ],
), ),
), ),
),
); );
}, },
); );
@@ -1051,7 +1148,11 @@ class MihAlertServices {
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (context) { builder: (context) {
return MihPackageWindow( return Padding(
padding: EdgeInsets.symmetric(
horizontal: getPadingBasedOnScreenWidth(context),
),
child: MihPackageWindow(
fullscreen: false, fullscreen: false,
windowTitle: null, windowTitle: null,
onWindowTapClose: null, onWindowTapClose: null,
@@ -1071,7 +1172,8 @@ class MihAlertServices {
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: MihColors.getSecondaryColor( color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontSize: 25, fontSize: 25,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@@ -1096,7 +1198,8 @@ class MihAlertServices {
context.pop(); context.pop();
}, },
buttonColor: MihColors.getSecondaryColor( buttonColor: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
width: 300, width: 300,
elevation: 10, elevation: 10,
child: Text( child: Text(
@@ -1114,6 +1217,7 @@ class MihAlertServices {
], ],
), ),
), ),
),
); );
}, },
); );
@@ -1129,7 +1233,11 @@ class MihAlertServices {
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (context) { builder: (context) {
return MihPackageWindow( return Padding(
padding: EdgeInsets.symmetric(
horizontal: getPadingBasedOnScreenWidth(context),
),
child: MihPackageWindow(
fullscreen: false, fullscreen: false,
windowTitle: null, windowTitle: null,
onWindowTapClose: null, onWindowTapClose: null,
@@ -1149,7 +1257,8 @@ class MihAlertServices {
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: MihColors.getSecondaryColor( color: MihColors.getSecondaryColor(
MzansiInnovationHub.of(context)!.theme.mode == "Dark"), MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"),
fontSize: 25, fontSize: 25,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@@ -1179,6 +1288,7 @@ class MihAlertServices {
], ],
), ),
), ),
),
); );
}, },
); );