tela de verificação de turma, possibilidade de alunos entrarem em turmas
This commit is contained in:
@@ -404,6 +404,74 @@ This document tracks the overall progress of the AI Study Assistant project deve
|
||||
|
||||
### **Last 24 Hours:**
|
||||
|
||||
- ✅ **ETAPA 5: Student Classes List** - Students can now view their enrolled classes on the home page
|
||||
- New `StudentClassesListWidget` component at `lib/features/dashboard/presentation/widgets/student_classes_list_widget.dart`
|
||||
- Query: `.collection('enrollments').where('studentId', isEqualTo: currentUser.uid).orderBy('joinedAt', descending: true)`
|
||||
- For each enrollment document, uses `FutureBuilder` to fetch the corresponding class from `classes` collection
|
||||
- Layout identical to `TeacherClassesListWidget`:
|
||||
- Horizontal `ListView.builder` with `scrollDirection: Axis.horizontal`
|
||||
- 2-row grid layout: Column with cards at index * 2 and index * 2 + 1
|
||||
- Card size: 200x150 pixels
|
||||
- Card styling: White background, 16px border radius, subtle shadow
|
||||
- Card content: Icon (school), class name (bold), class code (grey)
|
||||
- Title: "As Minhas Turmas" with `textTheme.titleLarge` style
|
||||
- Loading state: `CircularProgressIndicator` centered in card while loading class data
|
||||
- Empty state: "Ainda não entraste em nenhuma turma."
|
||||
- Widget inserted in `StudentDashboardPage` between `QuickAccessWidget` and `ProfileSectionWidget`
|
||||
- **System is now bidirectional:**
|
||||
- Professor creates classes → Students can join
|
||||
- Professor sees list of students in each class (ETAPA 3)
|
||||
- Students see list of classes they joined (ETAPA 5)
|
||||
- Both use same visual patterns for consistency
|
||||
- Testing: After joining a class (ETAPA 4), the class appears immediately in the student's home list
|
||||
|
||||
- ✅ **ETAPA 4: Join Class Feature** - Students can now join classes using class codes
|
||||
- New `JoinClassPage` component at `lib/features/classes/presentation/pages/join_class_page.dart`
|
||||
- Query: `.collection('classes').where('code', isEqualTo: enteredCode).limit(1)`
|
||||
- Input: TextField with uppercase formatting, 6 character limit, centered text, letter spacing
|
||||
- Validation flow:
|
||||
1. Check if code is empty → show error "Insere o código da turma"
|
||||
2. Query Firestore for class with matching code
|
||||
3. If no class found → show error "Código de turma inválido"
|
||||
4. Check if student already enrolled → show error "Já estás inscrito nesta turma"
|
||||
5. Create enrollment document in `enrollments` collection
|
||||
- Enrollment document structure:
|
||||
```dart
|
||||
{
|
||||
'classId': classDoc.id,
|
||||
'studentId': currentUser.uid,
|
||||
'studentName': currentUser.displayName ?? email.split('@')[0] ?? 'Aluno',
|
||||
'joinedAt': FieldValue.serverTimestamp(),
|
||||
}
|
||||
```
|
||||
- Success feedback: Green SnackBar "Entraste na turma com sucesso!" (2 seconds)
|
||||
- Error feedback: Red SnackBar with specific error message (3 seconds)
|
||||
- Auto-navigates back to Student Dashboard after successful join
|
||||
- Loading state: CircularProgressIndicator in button while processing
|
||||
- Visual design: Teal AppBar (#82C9BD), centered group_add icon, clean white input card
|
||||
- New "Entrar numa Turma" card added to `QuickAccessWidget` in Student Dashboard
|
||||
- Card design: Horizontal layout with `Icons.group_add`, white background, rounded corners (16px)
|
||||
- Testing in Firebase Console:
|
||||
1. Go to Firestore Database → classes collection
|
||||
2. Copy the `code` field from any class document
|
||||
3. In app: Student Dashboard → "Entrar numa Turma"
|
||||
4. Paste code and tap "Entrar na Turma"
|
||||
5. Check enrollments collection for new document with correct data
|
||||
|
||||
- ✅ **ETAPA 3: Class Students View** - Teachers can now view enrolled students in each class
|
||||
- New `ClassStudentsPage` component at `lib/features/classes/presentation/pages/class_students_page.dart`
|
||||
- Query: `.collection('enrollments').where('classId', isEqualTo: classId).orderBy('joinedAt', descending: true)`
|
||||
- StreamBuilder for real-time updates when students join
|
||||
- ListTile design with student icon, name, and formatted join date
|
||||
- Empty state: "Nenhum aluno entrou nesta turma ainda."
|
||||
- Loading state with `CircularProgressIndicator`
|
||||
- Error state with error icon and message
|
||||
- Date formatting using `intl` package (Portuguese format: dd/MM/yyyy)
|
||||
- Navigation via `GestureDetector` onTap in `TeacherClassesListWidget`
|
||||
- MaterialPageRoute navigation passing `classId` and `className` as parameters
|
||||
- AppBar with back button and two-line title (class name + subtitle)
|
||||
- Consistent visual design: teal colors (#82C9BD), white cards, rounded corners (16px), subtle shadows
|
||||
|
||||
- ✅ **ETAPA 2: Classes List Display** - Teachers can now view their created classes
|
||||
- New `TeacherClassesListWidget` component
|
||||
- "As Minhas Turmas" section added to Teacher Dashboard
|
||||
|
||||
Reference in New Issue
Block a user