From e40074047fa400b1ada844f7ae863c7a5057be91 Mon Sep 17 00:00:00 2001 From: Yassin Date: Sat, 30 Nov 2024 14:30:07 +0200 Subject: [PATCH] refactor: remove the successful download for quran dialog --- .../quran/widget/download_quran_popup.dart | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/lib/src/pages/quran/widget/download_quran_popup.dart b/lib/src/pages/quran/widget/download_quran_popup.dart index a1e0db5ca..3979bdc34 100644 --- a/lib/src/pages/quran/widget/download_quran_popup.dart +++ b/lib/src/pages/quran/widget/download_quran_popup.dart @@ -50,7 +50,7 @@ class _DownloadQuranDialogState extends ConsumerState { // UpdateAvailable() => _buildUpdateAvailableDialog(context, state), Downloading() => _buildDownloadingDialog(context, state), Extracting() => _buildExtractingDialog(context, state), - Success() => _buildSuccessDialog(context, state), + Success() => _successDialog(context), CancelDownload() => Container(), // NoUpdate() => _buildNoUpdateDialog(context, state), _ => Container(), @@ -126,19 +126,6 @@ class _DownloadQuranDialogState extends ConsumerState { ); } - Widget _buildSuccessDialog(BuildContext context, Success state) { - return AlertDialog( - title: Text(S.of(context).quranDownloaded), - actions: [ - TextButton( - autofocus: true, - onPressed: () => Navigator.pop(context), - child: Text(S.of(context).ok), - ), - ], - ); - } - Widget _buildNoUpdateDialog(BuildContext context, NoUpdate state) { return AlertDialog( title: Text(S.of(context).updatedQuran), @@ -232,4 +219,14 @@ class _DownloadQuranDialogState extends ConsumerState { ], ); } + + Widget _successDialog(BuildContext context) { + Future.microtask(() { + // Close the current dialog + if (Navigator.canPop(context)) { + Navigator.pop(context); + } + }); + return Container(); + } }