mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-10 00:25:20 +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> {
|
||||
static final Set<String> knownExceptions = {};
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
if (knownExceptions.contains(widget.details.exception.toString())) {
|
||||
return;
|
||||
}
|
||||
knownExceptions.add(widget.details.exception.toString());
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
ErrorReporter(context, 'Error Widget').onErrorCallback(
|
||||
widget.details.exception,
|
||||
|
@ -32,15 +37,6 @@ class _FluffyChatErrorWidgetState extends State<FluffyChatErrorWidget> {
|
|||
child: Material(
|
||||
color: Colors.white.withOpacity(0.9),
|
||||
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