correção de bugs, creação propria para turmas, e preparação para criar quizzes

This commit is contained in:
2026-05-15 12:40:38 +01:00
parent 62b9a107bc
commit 2775205f9e
14 changed files with 970 additions and 604 deletions

View File

@@ -19,14 +19,23 @@ class _StudentDashboardPageState extends State<StudentDashboardPage> {
@override
void initState() {
super.initState();
_loadUserData();
_checkRoleAndLoadData();
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
// Reload user data when dependencies change (e.g., after navigation)
_loadUserData();
Future<void> _checkRoleAndLoadData() async {
final user = AuthService.currentUser;
if (user == null) {
if (mounted) context.go('/role-selection');
return;
}
final role = await AuthService.getUserRole(user.uid);
if (role != 'student') {
if (mounted) {
context.go('/role-selection');
}
return;
}
await _loadUserData();
}
Future<void> _loadUserData() async {

View File

@@ -19,13 +19,23 @@ class _TeacherDashboardPageState extends State<TeacherDashboardPage> {
@override
void initState() {
super.initState();
_loadUserData();
_checkRoleAndLoadData();
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
_loadUserData();
Future<void> _checkRoleAndLoadData() async {
final user = AuthService.currentUser;
if (user == null) {
if (mounted) context.go('/role-selection');
return;
}
final role = await AuthService.getUserRole(user.uid);
if (role != 'teacher') {
if (mounted) {
context.go('/role-selection');
}
return;
}
await _loadUserData();
}
Future<void> _loadUserData() async {