fluffychat/lib/widgets/error_widget.dart
ggurdin 49e586a7ad
Fluffychat merge (#1685)
chore: Merge upstream changes

---------

Signed-off-by: Krille <c.kussowski@famedly.com>
Co-authored-by: krille-chan <christian-kussowski@posteo.de>
Co-authored-by: Krille <c.kussowski@famedly.com>
Co-authored-by: Linerly <linerly@proton.me>
Co-authored-by: Priit Jõerüüt <hwlate@joeruut.com>
Co-authored-by: 大王叫我来巡山 <hamburger2048@users.noreply.hosted.weblate.org>
Co-authored-by: fadelkon <fadelkon@posteo.net>
Co-authored-by: Aindriú Mac Giolla Eoin <aindriu80@gmail.com>
Co-authored-by: Edgars Andersons <Edgars+Weblate@gaitenis.id.lv>
Co-authored-by: josé m <correoxm@disroot.org>
Co-authored-by: Bezruchenko Simon <worcposj44@gmail.com>
Co-authored-by: Christian <christian-pauly@posteo.de>
Co-authored-by: - <hitekex@yandex.ru>
Co-authored-by: Angelo Schirinzi <Odi-3@users.noreply.hosted.weblate.org>
Co-authored-by: xabirequejo <xabi.rn@gmail.com>
Co-authored-by: Piotr Orzechowski <piotr@orzechowski.tech>
Co-authored-by: Rex_sa <rex.sa@pm.me>
Co-authored-by: Tewuzij <tenajeza@outlook.com>
Co-authored-by: goknarbahceli <goknarbahceli@proton.me>
Co-authored-by: தமிழ்நேரம் <anishprabu.t@gmail.com>
Co-authored-by: Erin <erin@erindesu.cz>
Co-authored-by: EpicKiwi <me@epickiwi.fr>
Co-authored-by: Christian Tietze <me@christiantietze.de>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-02-03 12:36:46 -05:00

49 lines
1.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:fluffychat/utils/error_reporter.dart';
class FluffyChatErrorWidget extends StatefulWidget {
final FlutterErrorDetails details;
const FluffyChatErrorWidget(this.details, {super.key});
@override
State<FluffyChatErrorWidget> createState() => _FluffyChatErrorWidgetState();
}
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((_) {
// #Pangea
// related sentry issue: https://pangea-chat.sentry.io/issues/5970490357
if (!context.mounted) return;
// Pangea#
ErrorReporter(context, 'Error Widget').onErrorCallback(
widget.details.exception,
widget.details.stack,
);
});
}
@override
Widget build(BuildContext context) {
return Material(
color: Colors.orange,
child: Placeholder(
child: Center(
child: Material(
color: Colors.white.withAlpha(230),
borderRadius: BorderRadius.circular(8),
),
),
),
);
}
}