Alteração do acesso às settings, mudança visual na interface de entrar numa turma
This commit is contained in:
@@ -5,6 +5,7 @@ import '../../../../core/theme/app_colors.dart';
|
||||
import '../../../../core/theme/app_theme_extension.dart';
|
||||
import '../../../../core/services/theme_service.dart';
|
||||
import '../../../../core/providers/theme_provider.dart';
|
||||
import '../../../../core/services/auth_service.dart';
|
||||
|
||||
/// Settings page for app configuration
|
||||
class SettingsPage extends ConsumerStatefulWidget {
|
||||
@@ -22,10 +23,20 @@ class _SettingsPageState extends ConsumerState<SettingsPage> {
|
||||
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvokedWithResult: (didPop, result) {
|
||||
onPopInvokedWithResult: (didPop, result) async {
|
||||
if (!didPop) {
|
||||
// Navigate to student dashboard on back button
|
||||
context.go('/student-dashboard');
|
||||
// Navigate to appropriate dashboard based on user role
|
||||
final user = AuthService.currentUser;
|
||||
if (user != null) {
|
||||
final role = await AuthService.getUserRole(user.uid);
|
||||
if (role == 'teacher') {
|
||||
context.go('/teacher-dashboard');
|
||||
} else {
|
||||
context.go('/student-dashboard');
|
||||
}
|
||||
} else {
|
||||
context.go('/student-dashboard');
|
||||
}
|
||||
}
|
||||
},
|
||||
child: Scaffold(
|
||||
@@ -56,7 +67,22 @@ class _SettingsPageState extends ConsumerState<SettingsPage> {
|
||||
Icons.arrow_back,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
onPressed: () => context.go('/student-dashboard'),
|
||||
onPressed: () async {
|
||||
// Navigate to appropriate dashboard based on user role
|
||||
final user = AuthService.currentUser;
|
||||
if (user != null) {
|
||||
final role = await AuthService.getUserRole(
|
||||
user.uid,
|
||||
);
|
||||
if (role == 'teacher') {
|
||||
context.go('/teacher-dashboard');
|
||||
} else {
|
||||
context.go('/student-dashboard');
|
||||
}
|
||||
} else {
|
||||
context.go('/student-dashboard');
|
||||
}
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
|
||||
Reference in New Issue
Block a user