fixed pop scope exit
This commit is contained in:
parent
90d836cf37
commit
4c1c516206
1 changed files with 7 additions and 1 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
// as of Flutter v3.3.10, the resolution order of multiple `WillPopScope` is random
|
// as of Flutter v3.3.10, the resolution order of multiple `WillPopScope` is random
|
||||||
|
@ -21,7 +22,12 @@ class AvesPopScope extends StatelessWidget {
|
||||||
|
|
||||||
final shouldPop = handlers.fold(true, (prev, v) => prev ? v(context) : false);
|
final shouldPop = handlers.fold(true, (prev, v) => prev ? v(context) : false);
|
||||||
if (shouldPop) {
|
if (shouldPop) {
|
||||||
Navigator.of(context).pop();
|
if (Navigator.canPop(context)) {
|
||||||
|
Navigator.maybeOf(context)?.pop();
|
||||||
|
} else {
|
||||||
|
// exit
|
||||||
|
SystemNavigator.pop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: child,
|
child: child,
|
||||||
|
|
Loading…
Reference in a new issue