-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Description
ListTile(
iconColor: Colors.white,
textColor: Colors.white,
leading: Icon(Icons.logout_outlined),
title: Text("Logout"),
onTap: () {
CoolAlert.show(
context: context,
type: CoolAlertType.confirm,
title: 'Logout',
text: 'Are you sure you want to logout?',
confirmBtnText: 'Yes',
confirmBtnColor: Colors.red,
cancelBtnText: 'No',
closeOnConfirmBtnTap: true,
onConfirmBtnTap: () async {
_prefs.setString(Prefs.adminUser, '');
_prefs.setBool(Prefs.isLoggedIn, false);
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => Login()));
});
},
)
Above is the code snippet from my app. When the 'Yes' button is clicked, it erases the SharedPreference data, but not navigates to the Login Screen. Why?
Metadata
Metadata
Assignees
Labels
No labels