Skip to content

Commit

Permalink
Replace WillPopScope with PopScope, closes darioielardi#331
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillergood committed Jun 15, 2024
1 parent 6608449 commit 784377b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
];
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
if (isDialOpen.value) {
isDialOpen.value = false;
return false;
return PopScope(
onPopInvoked: (bool didPop) async {
if(didPop) {
if (isDialOpen.value) {
isDialOpen.value = false;
}
}
return true;
},
child: Scaffold(
appBar: AppBar(
Expand Down
12 changes: 6 additions & 6 deletions lib/src/speed_dial.dart
Original file line number Diff line number Diff line change
Expand Up @@ -492,14 +492,14 @@ class _SpeedDialState extends State<SpeedDial>
@override
Widget build(BuildContext context) {
return (kIsWeb || !Platform.isIOS) && widget.closeDialOnPop
? WillPopScope(
? PopScope(
child: _renderButton(),
onWillPop: () async {
if (_open) {
_toggleChildren();
return false;
onPopInvoked: (bool didPop) async {
if (didPop) {
if (_open) {
_toggleChildren();
}
}
return true;
},
)
: _renderButton();
Expand Down

0 comments on commit 784377b

Please sign in to comment.