Muitas coisas e já me esqueci delas todas, cenas principalmente no dashboard do aluno bug fixes e etc
This commit is contained in:
@@ -45,18 +45,21 @@ class _AnalyticsPageState extends State<AnalyticsPage>
|
||||
final user = AuthService.currentUser;
|
||||
if (user == null) return;
|
||||
|
||||
// Obter turmas do professor
|
||||
// Obter disciplinas do professor
|
||||
final classesSnapshot = await FirebaseFirestore.instance
|
||||
.collection('classes')
|
||||
.where('teacherId', isEqualTo: user.uid)
|
||||
.get();
|
||||
|
||||
final classStatsList = <ClassStats>[];
|
||||
|
||||
|
||||
for (final classDoc in classesSnapshot.docs) {
|
||||
final classId = classDoc.id;
|
||||
// Forçar atualização para obter dados mais recentes
|
||||
final stats = await GamificationService.getClassStats(classId, forceRefresh: true);
|
||||
final stats = await GamificationService.getClassStats(
|
||||
classId,
|
||||
forceRefresh: true,
|
||||
);
|
||||
if (stats != null) {
|
||||
classStatsList.add(stats);
|
||||
}
|
||||
@@ -105,7 +108,10 @@ class _AnalyticsPageState extends State<AnalyticsPage>
|
||||
Row(
|
||||
children: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.arrow_back, color: Colors.white),
|
||||
icon: const Icon(
|
||||
Icons.arrow_back,
|
||||
color: Colors.white,
|
||||
),
|
||||
onPressed: () => context.go('/teacher-dashboard'),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
@@ -123,7 +129,7 @@ class _AnalyticsPageState extends State<AnalyticsPage>
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Acompanhe o desempenho das turmas',
|
||||
'Acompanhe o desempenho das disciplinas',
|
||||
style: TextStyle(
|
||||
color: Colors.white.withValues(alpha: 0.8),
|
||||
fontSize: 16,
|
||||
@@ -147,7 +153,7 @@ class _AnalyticsPageState extends State<AnalyticsPage>
|
||||
indicatorColor: Colors.white,
|
||||
indicatorWeight: 2,
|
||||
tabs: const [
|
||||
Tab(text: 'Turmas'),
|
||||
Tab(text: 'Disciplinas'),
|
||||
Tab(text: 'Rankings'),
|
||||
],
|
||||
),
|
||||
@@ -159,10 +165,7 @@ class _AnalyticsPageState extends State<AnalyticsPage>
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children: [
|
||||
_buildClassesTab(),
|
||||
_buildRankingsTab(),
|
||||
],
|
||||
children: [_buildClassesTab(), _buildRankingsTab()],
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -174,7 +177,9 @@ class _AnalyticsPageState extends State<AnalyticsPage>
|
||||
|
||||
Widget _buildClassesTab() {
|
||||
if (_loading) {
|
||||
return const Center(child: CircularProgressIndicator(color: Colors.white));
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(color: Colors.white),
|
||||
);
|
||||
}
|
||||
|
||||
if (_classStats.isEmpty) {
|
||||
@@ -189,7 +194,7 @@ class _AnalyticsPageState extends State<AnalyticsPage>
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'Nenhuma turma encontrada',
|
||||
'Nenhuma disciplina encontrada',
|
||||
style: TextStyle(
|
||||
color: Colors.white.withValues(alpha: 0.7),
|
||||
fontSize: 18,
|
||||
@@ -197,7 +202,7 @@ class _AnalyticsPageState extends State<AnalyticsPage>
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Crie turmas para ver as analytics aqui',
|
||||
'Crie disciplinas para ver as analytics aqui',
|
||||
style: TextStyle(
|
||||
color: Colors.white.withValues(alpha: 0.5),
|
||||
fontSize: 14,
|
||||
@@ -238,13 +243,15 @@ class _AnalyticsPageState extends State<AnalyticsPage>
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Class Cards
|
||||
..._classStats.map((stats) => Padding(
|
||||
padding: const EdgeInsets.only(bottom: 16),
|
||||
child: ClassAnalyticsCard(
|
||||
classStats: stats,
|
||||
onTap: () => _showClassRanking(stats),
|
||||
..._classStats.map(
|
||||
(stats) => Padding(
|
||||
padding: const EdgeInsets.only(bottom: 16),
|
||||
child: ClassAnalyticsCard(
|
||||
classStats: stats,
|
||||
onTap: () => _showClassRanking(stats),
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -263,7 +270,7 @@ class _AnalyticsPageState extends State<AnalyticsPage>
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'Selecione uma turma',
|
||||
'Selecione uma disciplina',
|
||||
style: TextStyle(
|
||||
color: Colors.white.withValues(alpha: 0.7),
|
||||
fontSize: 18,
|
||||
@@ -271,7 +278,7 @@ class _AnalyticsPageState extends State<AnalyticsPage>
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Clique em uma turma na aba "Turmas" para ver o ranking',
|
||||
'Clique em uma disciplina na aba "Disciplinas" para ver o ranking',
|
||||
style: TextStyle(
|
||||
color: Colors.white.withValues(alpha: 0.5),
|
||||
fontSize: 14,
|
||||
@@ -285,7 +292,12 @@ class _AnalyticsPageState extends State<AnalyticsPage>
|
||||
return ClassRankingWidget(classId: _selectedClassId!);
|
||||
}
|
||||
|
||||
Widget _buildOverviewCard(String title, String value, IconData icon, Color color) {
|
||||
Widget _buildOverviewCard(
|
||||
String title,
|
||||
String value,
|
||||
IconData icon,
|
||||
Color color,
|
||||
) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
@@ -333,7 +345,9 @@ class _AnalyticsPageState extends State<AnalyticsPage>
|
||||
onAchievementCreated: (achievement) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Conquista "${achievement.name}" criada com sucesso!'),
|
||||
content: Text(
|
||||
'Conquista "${achievement.name}" criada com sucesso!',
|
||||
),
|
||||
backgroundColor: Colors.green,
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user