checkpoint
This commit is contained in:
@@ -64,6 +64,22 @@ class SettingsPage extends ConsumerWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
IconButton.filled(
|
||||
icon: const Icon(Icons.logout),
|
||||
onPressed: () async {
|
||||
final authService = ref.read(authServiceProvider);
|
||||
await authService.logout();
|
||||
if (context.mounted) {
|
||||
// ignore: unused_result
|
||||
ref.refresh(isAuthenticatedProvider);
|
||||
if (context.mounted) {
|
||||
Navigator.of(context).pushReplacementNamed('/');
|
||||
}
|
||||
}
|
||||
},
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
tooltip: 'Logout',
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -90,7 +106,13 @@ class SettingsPage extends ConsumerWidget {
|
||||
const SizedBox(height: 16),
|
||||
ListTile(
|
||||
title: const Text('Language'),
|
||||
subtitle: Text(language == 'fr' ? 'Franais' : 'English'),
|
||||
subtitle: Text(
|
||||
language == 'system'
|
||||
? 'System'
|
||||
: language == 'fr'
|
||||
? 'Français'
|
||||
: 'English'
|
||||
),
|
||||
trailing: DropdownButton<String>(
|
||||
value: language,
|
||||
onChanged: (String? newValue) {
|
||||
@@ -99,13 +121,17 @@ class SettingsPage extends ConsumerWidget {
|
||||
}
|
||||
},
|
||||
items: const [
|
||||
DropdownMenuItem(
|
||||
value: 'system',
|
||||
child: Text('System'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 'en',
|
||||
child: Text('English'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: 'fr',
|
||||
child: Text('Franais'),
|
||||
child: Text('Français'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -148,42 +174,6 @@ class SettingsPage extends ConsumerWidget {
|
||||
),
|
||||
),
|
||||
const Divider(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Account',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: ElevatedButton.icon(
|
||||
icon: const Icon(Icons.logout),
|
||||
label: const Text('Logout'),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Theme.of(context).colorScheme.error,
|
||||
foregroundColor: Theme.of(context).colorScheme.onError,
|
||||
),
|
||||
onPressed: () async {
|
||||
final authService = ref.read(authServiceProvider);
|
||||
await authService.logout();
|
||||
if (context.mounted) {
|
||||
// ignore: unused_result
|
||||
ref.refresh(isAuthenticatedProvider);
|
||||
if (context.mounted) {
|
||||
Navigator.of(context).pushReplacementNamed('/');
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Divider(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
|
||||
Reference in New Issue
Block a user