mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-17 09:47:35 +00:00
Merge pull request #749 from cake-tech/prevent-multiple-UI-error-alerts
Prevent multiple Error dialogs at once
This commit is contained in:
commit
1ca0539883
1 changed files with 10 additions and 2 deletions
|
@ -50,6 +50,7 @@ import 'package:cake_wallet/wallet_type_utils.dart';
|
|||
final navigatorKey = GlobalKey<NavigatorState>();
|
||||
final rootKey = GlobalKey<RootState>();
|
||||
final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>();
|
||||
bool hasError = false;
|
||||
|
||||
Future<void> main() async {
|
||||
|
||||
|
@ -208,9 +209,14 @@ void _sendExceptionFile() async {
|
|||
void _onError(FlutterErrorDetails errorDetails) {
|
||||
_saveException(errorDetails.exception.toString(), errorDetails.stack);
|
||||
|
||||
if (hasError) {
|
||||
return;
|
||||
}
|
||||
hasError = true;
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(timeStamp) {
|
||||
showPopUp<void>(
|
||||
(timeStamp) async {
|
||||
await showPopUp<void>(
|
||||
context: navigatorKey.currentContext!,
|
||||
builder: (context) {
|
||||
return AlertWithTwoActions(
|
||||
|
@ -229,6 +235,8 @@ void _onError(FlutterErrorDetails errorDetails) {
|
|||
);
|
||||
},
|
||||
);
|
||||
|
||||
hasError = false;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue