From 7313b9c4ae79ee99e22ca07a775b9815e42c53ce Mon Sep 17 00:00:00 2001 From: MinhDV Date: Fri, 29 Sep 2023 14:03:56 +0700 Subject: [PATCH] TW-555 Foward Image hide dialog --- lib/pages/forward/forward.dart | 2 ++ lib/utils/extension/navigator_state_extension.dart | 7 +++++++ 2 files changed, 9 insertions(+) create mode 100644 lib/utils/extension/navigator_state_extension.dart diff --git a/lib/pages/forward/forward.dart b/lib/pages/forward/forward.dart index e9684d6ab9..c9dc80cc8d 100644 --- a/lib/pages/forward/forward.dart +++ b/lib/pages/forward/forward.dart @@ -10,6 +10,7 @@ import 'package:fluffychat/pages/chat/send_file_dialog.dart'; import 'package:fluffychat/pages/forward/forward_view.dart'; import 'package:fluffychat/presentation/enum/chat_list/chat_list_enum.dart'; import 'package:fluffychat/presentation/extensions/client_extension.dart'; +import 'package:fluffychat/utils/extension/navigator_state_extension.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'package:matrix/matrix.dart'; @@ -106,6 +107,7 @@ class ForwardController extends State { switch (success.runtimeType) { case ForwardMessageSuccess: final dataOnSuccess = success as ForwardMessageSuccess; + Navigator.of(context).popAllDialogs(); context.go('/rooms/${dataOnSuccess.room.id}'); break; case ForwardMessageIsShareFileState: diff --git a/lib/utils/extension/navigator_state_extension.dart b/lib/utils/extension/navigator_state_extension.dart new file mode 100644 index 0000000000..73b07cd890 --- /dev/null +++ b/lib/utils/extension/navigator_state_extension.dart @@ -0,0 +1,7 @@ +import 'package:flutter/widgets.dart'; + +extension NavigatorStateExtension on NavigatorState { + void popAllDialogs() { + popUntil((route) => route is! RawDialogRoute); + } +}