-
-
Notifications
You must be signed in to change notification settings - Fork 504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #1378 Update Talawa to give a meaningful message if the URL isn't available. #1380
Merged
palisadoes
merged 22 commits into
PalisadoesFoundation:develop
from
Ayush0Chaudhary:Ayush0Chaudhary/url-err-handling
Jan 27, 2023
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
9c563eb
feat: Add proper error handling if url not available.
Ayush0Chaudhary fc5bd1a
Fix #1378 Update Talawa to give a meaningful message if the URL isn't…
Ayush0Chaudhary 32863e8
fixes the failed checks.
Ayush0Chaudhary 9a91238
Make the suggested changes
Ayush0Chaudhary efe6e04
Add error widget
Ayush0Chaudhary 8bce450
Add custom error snackbar for Talawa
Ayush0Chaudhary 3f8a9da
Make the notif bar scrollable.
Ayush0Chaudhary 14507d5
Remove the useless part
Ayush0Chaudhary 962423d
Add dialog box with scroll instead of snackbar
Ayush0Chaudhary bca1fc7
added the custom widget
Ayush0Chaudhary 828a750
added the custom widget
Ayush0Chaudhary 7548d22
Completed the request changes.
Ayush0Chaudhary 9d43643
removed all the warnings
Ayush0Chaudhary dd7552e
Merge branch 'develop' into Ayush0Chaudhary/url-err-handling
Ayush0Chaudhary e4b9b80
changed the app-setting test
Ayush0Chaudhary 01432d1
Add test for custom error widget and did err-handling in qrScan
Ayush0Chaudhary 732f22e
removed all warnings
Ayush0Chaudhary be4e8a3
Update build.gradle
Ayush0Chaudhary 9a897dc
Delete google-services.json
Ayush0Chaudhary f0a960e
Update build.gradle
Ayush0Chaudhary 451f658
Delete GoogleService-Info.plist
Ayush0Chaudhary 21b2544
Delete firebase_app_id_file.json
Ayush0Chaudhary File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'package:talawa/widgets/talawa_error_dialog.dart'; | ||
import 'package:talawa/widgets/talawa_error_widget.dart'; | ||
|
||
class NavigationService { | ||
GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>(); | ||
|
||
|
@@ -62,6 +65,31 @@ class NavigationService { | |
); | ||
} | ||
|
||
void showTalawaErrorWidget( | ||
String errorMessage, { | ||
Duration duration = const Duration(seconds: 2), | ||
}) { | ||
ScaffoldMessenger.of(navigatorKey.currentContext!).showSnackBar(SnackBar( | ||
padding: EdgeInsets.zero, | ||
content: TalawaErrorWidget( | ||
errorMessage: errorMessage, | ||
), | ||
// backgroundColor: Colors.grey, | ||
backgroundColor: const Color.fromRGBO(65, 65, 66, 1), | ||
)); | ||
} | ||
|
||
void showTalawaErrorDialog(String errorMessage) { | ||
showDialog( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do the same with this error dialog please. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done the same for it too. |
||
context: navigatorKey.currentContext!, | ||
barrierColor: Colors.transparent, | ||
barrierDismissible: false, | ||
builder: (BuildContext context) { | ||
return TalawaErrorDialog(errorMessage); | ||
}, | ||
); | ||
} | ||
|
||
void pop() { | ||
return navigatorKey.currentState!.pop(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import 'package:auto_size_text/auto_size_text.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class TalawaErrorDialog extends StatelessWidget { | ||
const TalawaErrorDialog(this.errorMessage, {Key? key}) : super(key: key); | ||
final String errorMessage; | ||
@override | ||
Widget build(BuildContext context) { | ||
return SizedBox( | ||
child: AlertDialog( | ||
title: const Text( | ||
"Error", | ||
style: TextStyle(color: Colors.red), | ||
), | ||
content: SizedBox( | ||
width: 200, | ||
height: 75, | ||
child: AutoSizeText( | ||
errorMessage, | ||
style: const TextStyle(fontSize: 20), | ||
maxLines: 3, | ||
), | ||
), | ||
actions: <Widget>[ | ||
TextButton( | ||
child: const Text('Close'), | ||
onPressed: () { | ||
Navigator.of(context).pop(); | ||
}, | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class TalawaErrorWidget extends StatelessWidget { | ||
const TalawaErrorWidget({Key? key, required this.errorMessage}) | ||
: super(key: key); | ||
final String errorMessage; | ||
@override | ||
Widget build(BuildContext context) { | ||
return Row( | ||
children: [ | ||
Container( | ||
width: 20, | ||
height: 80, | ||
decoration: const BoxDecoration(color: Colors.red), | ||
), | ||
const SizedBox( | ||
width: 10, | ||
), | ||
const Icon( | ||
Icons.error, | ||
color: Colors.red, | ||
size: 35, | ||
), | ||
const SizedBox( | ||
width: 10, | ||
), | ||
Expanded( | ||
flex: 1, | ||
child: SingleChildScrollView( | ||
scrollDirection: Axis.horizontal, | ||
child: Text( | ||
errorMessage, | ||
style: const TextStyle(color: Colors.white), | ||
), | ||
), | ||
) | ||
], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you refactor this into a reusable stateless widget that takes message as the parameter?
That way we can ensure snackbars are consistent across the app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You also probably want to change to a auto sized text as well, incase the message is long or complex
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the changes you asked for, please check the PR