Finalização de detalhes e pequenas adições em dashboards de alunos e professores
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
|
||||
import '../../../../core/theme/app_theme_extension.dart';
|
||||
import '../../../../core/services/auth_service.dart';
|
||||
import '../../../../core/services/gamification_service.dart';
|
||||
import '../../../../core/models/class_stats.dart';
|
||||
@@ -11,10 +10,12 @@ class TeacherAnalyticsPreviewWidget extends StatefulWidget {
|
||||
const TeacherAnalyticsPreviewWidget({super.key});
|
||||
|
||||
@override
|
||||
State<TeacherAnalyticsPreviewWidget> createState() => _TeacherAnalyticsPreviewWidgetState();
|
||||
State<TeacherAnalyticsPreviewWidget> createState() =>
|
||||
_TeacherAnalyticsPreviewWidgetState();
|
||||
}
|
||||
|
||||
class _TeacherAnalyticsPreviewWidgetState extends State<TeacherAnalyticsPreviewWidget> {
|
||||
class _TeacherAnalyticsPreviewWidgetState
|
||||
extends State<TeacherAnalyticsPreviewWidget> {
|
||||
List<StudentRanking> _topStudents = [];
|
||||
bool _loading = true;
|
||||
|
||||
@@ -36,7 +37,7 @@ class _TeacherAnalyticsPreviewWidgetState extends State<TeacherAnalyticsPreviewW
|
||||
.get();
|
||||
|
||||
List<StudentRanking> allStudents = [];
|
||||
|
||||
|
||||
// Buscar ranking de cada turma
|
||||
for (final classDoc in classesSnapshot.docs) {
|
||||
final classId = classDoc.id;
|
||||
@@ -67,232 +68,130 @@ class _TeacherAnalyticsPreviewWidgetState extends State<TeacherAnalyticsPreviewW
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final user = AuthService.currentUser;
|
||||
final userName = user?.displayName ?? 'Professor';
|
||||
final userEmail = user?.email ?? '';
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(top: 24),
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(
|
||||
color: Theme.of(context).colorScheme.outline.withOpacity(0.2),
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
_buildQuickStat(
|
||||
icon: Icons.check_circle,
|
||||
label: 'Alunos Ativos',
|
||||
value: '18/24',
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
_buildQuickStat(
|
||||
icon: Icons.warning_amber,
|
||||
label: 'Precisam Apoio',
|
||||
value: '3',
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
_buildQuickStat(
|
||||
icon: Icons.emoji_events,
|
||||
label: 'Média Turma',
|
||||
value: '72%',
|
||||
color: Theme.of(context).colorScheme.primary.withOpacity(0.8),
|
||||
),
|
||||
],
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Theme.of(context).colorScheme.shadow.withOpacity(0.05),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Profile Header
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 48,
|
||||
height: 48,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
AppThemeExtras.of(context).actionCardGradientStart,
|
||||
AppThemeExtras.of(context).actionCardGradientEnd,
|
||||
],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
),
|
||||
child: const Icon(Icons.school, color: Colors.white, size: 24),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Top Performing Students Preview
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.leaderboard,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Melhores Desempenhos',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Student List Preview
|
||||
if (_loading)
|
||||
const Center(child: CircularProgressIndicator())
|
||||
else if (_topStudents.isEmpty)
|
||||
const Center(
|
||||
child: Text(
|
||||
'Nenhum aluno encontrado',
|
||||
style: TextStyle(fontSize: 14),
|
||||
),
|
||||
)
|
||||
else
|
||||
..._topStudents.asMap().entries.map((entry) {
|
||||
final index = entry.key;
|
||||
final student = entry.value;
|
||||
final color = _getStudentColor(context, index);
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
child: _buildStudentPerformanceItem(
|
||||
context,
|
||||
student.studentName,
|
||||
student.overallScore.toInt(),
|
||||
color,
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Content Quality Alert
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: Theme.of(context).colorScheme.outline.withOpacity(0.2),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.info_outline,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
userName,
|
||||
'Qualidade do Conteúdo',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontSize: 18,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
userEmail,
|
||||
style: TextStyle(
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.onSurfaceVariant,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
if (userEmail.length > 20) ...[
|
||||
const SizedBox(width: 8),
|
||||
Icon(
|
||||
Icons.more_horiz,
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.onSurfaceVariant,
|
||||
size: 16,
|
||||
),
|
||||
],
|
||||
],
|
||||
Text(
|
||||
'12 conteúdos verificados • 2 pendentes de revisão',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.secondary.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.settings,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Quick Stats Row
|
||||
Row(
|
||||
children: [
|
||||
_buildQuickStat(
|
||||
icon: Icons.check_circle,
|
||||
label: 'Alunos Ativos',
|
||||
value: '18/24',
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
_buildQuickStat(
|
||||
icon: Icons.warning_amber,
|
||||
label: 'Precisam Apoio',
|
||||
value: '3',
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
_buildQuickStat(
|
||||
icon: Icons.emoji_events,
|
||||
label: 'Média Disciplina',
|
||||
value: '72%',
|
||||
color: Theme.of(context).colorScheme.primary.withOpacity(0.8),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Top Performing Students Preview
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.leaderboard,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Melhores Desempenhos',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Student List Preview
|
||||
if (_loading)
|
||||
const Center(child: CircularProgressIndicator())
|
||||
else if (_topStudents.isEmpty)
|
||||
const Center(
|
||||
child: Text(
|
||||
'Nenhum aluno encontrado',
|
||||
style: TextStyle(fontSize: 14),
|
||||
),
|
||||
)
|
||||
else
|
||||
..._topStudents.asMap().entries.map((entry) {
|
||||
final index = entry.key;
|
||||
final student = entry.value;
|
||||
final color = _getStudentColor(context, index);
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
child: _buildStudentPerformanceItem(
|
||||
context,
|
||||
student.studentName,
|
||||
student.overallScore.toInt(),
|
||||
color,
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Content Quality Alert
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: Theme.of(context).colorScheme.outline.withOpacity(0.2),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.info_outline,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Qualidade do Conteúdo',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
'12 conteúdos verificados • 2 pendentes de revisão',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user