mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-23 11:15:33 +00:00
Check if widget is mounted before showing popups
This commit is contained in:
parent
a8025ffbec
commit
bf407bedec
3 changed files with 22 additions and 20 deletions
|
@ -365,17 +365,15 @@ class SendPage extends BasePage {
|
|||
reaction((_) => sendViewModel.state, (ExecutionState state) {
|
||||
if (state is FailureState) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (context.mounted) {
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
alertTitle: S.of(context).error,
|
||||
alertContent: state.error,
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () => Navigator.of(context).pop());
|
||||
});
|
||||
}
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
alertTitle: S.of(context).error,
|
||||
alertContent: state.error,
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () => Navigator.of(context).pop());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -120,6 +120,7 @@ class ExceptionHandler {
|
|||
static bool _ignoreError(String error) {
|
||||
return error.contains("errno = 103") || // SocketException: Software caused connection abort
|
||||
error.contains("errno = 9") || // SocketException: Bad file descriptor
|
||||
error.contains("errno = 32") || // SocketException: Write failed (OS Error: Broken pipe)
|
||||
error.contains("errno = 54"); // SocketException: Connection reset by peer
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,13 +8,16 @@ Future<T?> showPopUp<T>({
|
|||
bool useSafeArea = false,
|
||||
bool useRootNavigator = true,
|
||||
RouteSettings? routeSettings
|
||||
}) {
|
||||
return showDialog<T>(
|
||||
context: context,
|
||||
builder: builder,
|
||||
barrierDismissible: barrierDismissible,
|
||||
barrierColor: barrierColor,
|
||||
useSafeArea: useSafeArea,
|
||||
useRootNavigator: useRootNavigator,
|
||||
routeSettings: routeSettings);
|
||||
}) async {
|
||||
if (context.mounted) {
|
||||
return showDialog<T>(
|
||||
context: context,
|
||||
builder: builder,
|
||||
barrierDismissible: barrierDismissible,
|
||||
barrierColor: barrierColor,
|
||||
useSafeArea: useSafeArea,
|
||||
useRootNavigator: useRootNavigator,
|
||||
routeSettings: routeSettings);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue