Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

close Progress dialog caused opening widget closed unexpectedly #34

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions lib/progress_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ class ProgressDialog {
// Value assignment is done later.
ValueChanged<DialogStatus>? _onStatusChanged;

ProgressDialog({required context}) {
/// [_useRootNavigator] open dialog in RootNavigator
// Can only be accessed with the constructor.
late bool _useRootNavigator;

ProgressDialog({required context, bool? useRootNavigator}) {
emreesen27 marked this conversation as resolved.
Show resolved Hide resolved
this._context = context;
this._useRootNavigator = useRootNavigator ?? true;
}

/// [update] Pass the new value to this method to update the status.
Expand All @@ -57,7 +62,7 @@ class ProgressDialog {

void _closeDialog() {
if (_dialogIsOpen) {
Navigator.pop(_context);
Navigator.of(_context, rootNavigator: _useRootNavigator).pop();
_dialogIsOpen = false;
_setDialogStatus(DialogStatus.closed);
}
Expand Down Expand Up @@ -151,6 +156,7 @@ class ProgressDialog {
barrierDismissible: barrierDismissible,
barrierColor: barrierColor,
context: _context,
useRootNavigator: _useRootNavigator,
builder: (context) => WillPopScope(
child: AlertDialog(
backgroundColor: backgroundColor,
Expand Down
Loading