Function that handle click when using attributes : onConfirmBtnTap and onCancelBtnTap don't work and the alert window does not dispose or close
I try to use QuickAlert.confirm on a drawer. When I use function that handle click when using attributes : onConfirmBtnTap and onCancelBtnTap, it's doesn't work and the alert window does not dispose or close I use QuickAlert.show( context: context, type: QuickAlertType.confirm, title: "Confirm action", text: 'Do you want to log out?', confirmBtnText: 'oui', cancelBtnText: 'Non', confirmBtnColor: Colors.green, onConfirmBtnTap: (){ print("Yes"); logout(); Navigator.pop(context);
});
Expected behavior I want the function set to attribute onConfirmBtnTap to be executed and to dispose of the QuickAlert window.
Smartphone
- Device: [pixel]
- OS: [Android 11]
I managed to overcome this issue by adding Navigator.of(context, rootNavigator: true).pop();
See below:
onConfirmBtnTap: () async { Navigator.of(context, rootNavigator: true).pop(); Navigator.pop(context); });