mirror of
https://github.com/Auties00/Reboot-Launcher.git
synced 2026-01-13 11:12:23 +01:00
10.0.5
This commit is contained in:
37
gui/lib/src/widget/message/error.dart
Normal file
37
gui/lib/src/widget/message/error.dart
Normal file
@@ -0,0 +1,37 @@
|
||||
import 'package:fluent_ui/fluent_ui.dart';
|
||||
import 'package:reboot_common/common.dart';
|
||||
import 'package:reboot_launcher/src/messenger/dialog.dart';
|
||||
import 'package:reboot_launcher/src/page/pages.dart';
|
||||
import 'package:reboot_launcher/src/util/translations.dart';
|
||||
|
||||
String? lastError;
|
||||
|
||||
void onError(Object exception, StackTrace? stackTrace, bool framework) {
|
||||
log("[ERROR] $exception");
|
||||
log("[STACKTRACE] $stackTrace");
|
||||
if(pageKey.currentContext == null || pageKey.currentState?.mounted == false){
|
||||
return;
|
||||
}
|
||||
|
||||
if(lastError == exception.toString()){
|
||||
return;
|
||||
}
|
||||
|
||||
lastError = exception.toString();
|
||||
if(inDialog){
|
||||
final context = pageKey.currentContext;
|
||||
if(context != null) {
|
||||
Navigator.of(context).pop(false);
|
||||
inDialog = false;
|
||||
}
|
||||
}
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) => showRebootDialog(
|
||||
builder: (context) =>
|
||||
ErrorDialog(
|
||||
exception: exception,
|
||||
stackTrace: stackTrace,
|
||||
errorMessageBuilder: (exception) => translations.uncaughtErrorMessage(exception.toString())
|
||||
)
|
||||
));
|
||||
}
|
||||
Reference in New Issue
Block a user