From 5f628f62dd96a86c86442c8a21879b01a6fc4b9a Mon Sep 17 00:00:00 2001 From: yaso Date: Wed, 23 Oct 2024 12:17:04 +0200 Subject: [PATCH] add GPS error nessage when access is denied. --- .../mih_error_message.dart | 91 ++++++++++++++++++- 1 file changed, 90 insertions(+), 1 deletion(-) diff --git a/Frontend/patient_manager/lib/mih_components/mih_pop_up_messages/mih_error_message.dart b/Frontend/patient_manager/lib/mih_components/mih_pop_up_messages/mih_error_message.dart index c983b972..0c3d43b1 100644 --- a/Frontend/patient_manager/lib/mih_components/mih_pop_up_messages/mih_error_message.dart +++ b/Frontend/patient_manager/lib/mih_components/mih_pop_up_messages/mih_error_message.dart @@ -694,7 +694,7 @@ class _MIHErrorMessageState extends State { fontWeight: FontWeight.bold, ), ), - const SizedBox(height: 15), + const SizedBox(height: 10), Text( "Here are a few things you can try:", style: TextStyle( @@ -739,6 +739,94 @@ class _MIHErrorMessageState extends State { ); } + void setLocationError() { + messageTypes["Location Denied"] = Stack( + children: [ + Container( + padding: EdgeInsets.all(popUpPaddingSize), + width: popUpWidth, + height: popUpheight, + decoration: BoxDecoration( + color: MzanziInnovationHub.of(context)!.theme.primaryColor(), + borderRadius: BorderRadius.circular(25.0), + border: Border.all( + color: MzanziInnovationHub.of(context)!.theme.errorColor(), + width: 5.0), + ), + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + Icons.warning_amber_rounded, + size: popUpIconSize, + color: MzanziInnovationHub.of(context)!.theme.errorColor(), + ), + //const SizedBox(height: 15), + Text( + "Location Services Not Enabled", + textAlign: TextAlign.center, + style: TextStyle( + color: MzanziInnovationHub.of(context)!.theme.errorColor(), + fontSize: popUpTitleSize, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(height: 15), + Text( + "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( + color: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + fontSize: popUpBodySize, + fontWeight: FontWeight.bold, + ), + ), + // const SizedBox(height: 15), + // Text( + // "Here are a few things you can try:", + // style: TextStyle( + // color: MzanziInnovationHub.of(context)!.theme.errorColor(), + // fontSize: popUpSubtitleSize, + // fontWeight: FontWeight.bold, + // ), + // ), + // const SizedBox(height: 10), + // Text( + // "1) Check your Wi-Fi signal strength or try connecting to a different network.\n2) Restart your device (computer, phone, etc.) and your router/modem.\n3) If you're using cellular data, ensure you have a strong signal and haven't reached your data limit.", + // textAlign: TextAlign.left, + // style: TextStyle( + // color: + // MzanziInnovationHub.of(context)!.theme.secondaryColor(), + // fontSize: popUpBodySize, + // fontWeight: FontWeight.bold, + // ), + // ), + const SizedBox(height: 10), + ], + ), + ), + ), + Positioned( + top: 5, + right: 5, + width: 50, + height: 50, + child: IconButton( + onPressed: () { + Navigator.pop(context); + }, + icon: Icon( + Icons.close, + color: MzanziInnovationHub.of(context)!.theme.errorColor(), + size: 35, + ), + ), + ), + ], + ); + } + Widget? getErrorMessage(String type) { return messageTypes[type]; } @@ -760,6 +848,7 @@ class _MIHErrorMessageState extends State { setPasswordRequirementsError(); setInvalidEmailError(); setInvalidUsernameError(); + setLocationError(); //print(size); // setState(() { // width = size.width;