feat: implement sign out button
This commit is contained in:
parent
5870b29a9b
commit
eb90aa15ac
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import '../../services/notification_service.dart';
|
import '../../services/notification_service.dart';
|
||||||
import '../../services/user_service.dart';
|
import '../../services/user_service.dart';
|
||||||
|
import '../../services/auth_service.dart';
|
||||||
|
|
||||||
class ProfilePage extends StatefulWidget {
|
class ProfilePage extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
@ -449,7 +450,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _signOut() {
|
void _signOut() async {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
@ -462,10 +463,14 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||||||
child: Text('Cancel'),
|
child: Text('Cancel'),
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () async {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
SnackBar(content: Text('Signed out successfully')),
|
await AuthService.logout();
|
||||||
|
|
||||||
|
Navigator.of(context).pushNamedAndRemoveUntil(
|
||||||
|
'/',
|
||||||
|
(route) => false,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Text('Sign Out', style: TextStyle(color: Colors.red)),
|
child: Text('Sign Out', style: TextStyle(color: Colors.red)),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user