mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-17 06:15:10 +00:00
fix: Error widget spamming with dialogs
This commit is contained in:
parent
dfb09f443b
commit
e8a8f8921d
1 changed files with 5 additions and 9 deletions
|
@ -11,10 +11,15 @@ class FluffyChatErrorWidget extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _FluffyChatErrorWidgetState extends State<FluffyChatErrorWidget> {
|
class _FluffyChatErrorWidgetState extends State<FluffyChatErrorWidget> {
|
||||||
|
static final Set<String> knownExceptions = {};
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
|
if (knownExceptions.contains(widget.details.exception.toString())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
knownExceptions.add(widget.details.exception.toString());
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
ErrorReporter(context, 'Error Widget').onErrorCallback(
|
ErrorReporter(context, 'Error Widget').onErrorCallback(
|
||||||
widget.details.exception,
|
widget.details.exception,
|
||||||
|
@ -32,15 +37,6 @@ class _FluffyChatErrorWidgetState extends State<FluffyChatErrorWidget> {
|
||||||
child: Material(
|
child: Material(
|
||||||
color: Colors.white.withOpacity(0.9),
|
color: Colors.white.withOpacity(0.9),
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Text(
|
|
||||||
'😲 Oh no! Something is broken 😲\n${widget.details.exception}',
|
|
||||||
maxLines: 5,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: const TextStyle(color: Colors.black),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue