-
Notifications
You must be signed in to change notification settings - Fork 9
feat: create custom error screen #297
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
base: main
Are you sure you want to change the base?
Conversation
wal33d006
left a comment
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.
Looks good to me, can we make it support CosmosTheme? Currently the background color and text colors are all fixed.
| brightness: themeStore.isDarkTheme ? Brightness.dark : Brightness.light, | ||
| child: Builder( | ||
| builder: (context) { | ||
| setErrorBuilder(context); |
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.
not really sure why we're setting a variable as part of the build method, and why this variable is static? Looks like flutter team at google was a bit drunk when implemented this O.o. :D Wouldn't it make more sense to have specialized widget that is responsible of building the Error UI ? I think ErrorWidget is more meant for general build errors and altering it's builder field you're updating the way all build errors are being displayed across the whole 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.
https://docs.flutter.dev/testing/errors, yes they were drunk, I figured it would be great if we had our own custom error screen app-wide, gets rid of the red screen of death and allows us to still copy error messages with one click of a button
| return result.fold( | ||
| (fail) { | ||
| logError(fail); | ||
| errorDetails = fail.toString(); |
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.
we're loosing a lot of info here by calling toString(), couldn't we simply make errorDetails a, lets say ErrorDetails type that consists of the dynamic error and optional StackTrace? stackTrace.
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.
Will update this to use ErrorDetails
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.
created CosmosErrorDetails
I have created a default error screen using flutter's inbuilt error widget and i have also passed the error from account creation to it.
Global Error UI: