157 lines
4.8 KiB
Dart
157 lines
4.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_animate/flutter_animate.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import '../../../classes/presentation/pages/join_class_page.dart';
|
|
import 'dashboard_action_card.dart';
|
|
|
|
/// Quick access cards for Tutor IA and Quiz
|
|
class QuickAccessWidget extends StatelessWidget {
|
|
const QuickAccessWidget({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
'Acesso Rápido',
|
|
style: TextStyle(
|
|
color: Theme.of(context).colorScheme.onSurface,
|
|
fontSize: 20,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
Column(
|
|
children: [
|
|
IntrinsicHeight(
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
Expanded(
|
|
flex: 2,
|
|
child: _buildTutorIACard(context),
|
|
),
|
|
const SizedBox(width: 16),
|
|
Expanded(
|
|
flex: 2,
|
|
child: _buildQuizCard(context),
|
|
),
|
|
const SizedBox(width: 16),
|
|
Expanded(
|
|
flex: 2,
|
|
child: _buildAchievementsCard(context),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 16),
|
|
_buildQuizManagementCard(context),
|
|
const SizedBox(height: 16),
|
|
_buildJoinClassCard(context),
|
|
],
|
|
)
|
|
.animate()
|
|
.slideY(
|
|
duration: const Duration(milliseconds: 800),
|
|
curve: Curves.easeOut,
|
|
)
|
|
.then(delay: const Duration(milliseconds: 200));
|
|
}
|
|
|
|
Widget _buildTutorIACard(BuildContext context) {
|
|
return DashboardActionCard(
|
|
title: 'Tutor IA',
|
|
subtitle: 'Assistente de estudos',
|
|
icon: Icons.psychology,
|
|
useGradient: true,
|
|
minHeight: 150,
|
|
onTap: () => context.go('/ai-tutor'),
|
|
)
|
|
.animate()
|
|
.scale(
|
|
duration: const Duration(milliseconds: 600),
|
|
curve: Curves.elasticOut,
|
|
)
|
|
.then(delay: const Duration(milliseconds: 100));
|
|
}
|
|
|
|
Widget _buildQuizCard(BuildContext context) {
|
|
final cs = Theme.of(context).colorScheme;
|
|
return DashboardActionCardSurface(
|
|
title: 'Quiz',
|
|
subtitle: 'Testa os teus conhecimentos',
|
|
icon: Icons.quiz,
|
|
minHeight: 150,
|
|
iconColor: cs.secondary,
|
|
onTap: () => context.go('/quiz'),
|
|
)
|
|
.animate()
|
|
.scale(
|
|
duration: const Duration(milliseconds: 600),
|
|
curve: Curves.elasticOut,
|
|
)
|
|
.then(delay: const Duration(milliseconds: 200));
|
|
}
|
|
|
|
Widget _buildAchievementsCard(BuildContext context) {
|
|
final cs = Theme.of(context).colorScheme;
|
|
return DashboardActionCardSurface(
|
|
title: 'Conquistas',
|
|
subtitle: 'Ver medals',
|
|
icon: Icons.emoji_events,
|
|
minHeight: 150,
|
|
iconColor: Colors.amber,
|
|
onTap: () => context.go('/student/achievements'),
|
|
)
|
|
.animate()
|
|
.scale(
|
|
duration: const Duration(milliseconds: 600),
|
|
curve: Curves.elasticOut,
|
|
)
|
|
.then(delay: const Duration(milliseconds: 200));
|
|
}
|
|
|
|
Widget _buildQuizManagementCard(BuildContext context) {
|
|
final cs = Theme.of(context).colorScheme;
|
|
return DashboardActionCardSurface(
|
|
title: 'Gerenciar Quizzes',
|
|
subtitle: 'Ver histórico ou eliminar',
|
|
icon: Icons.manage_history,
|
|
minHeight: 80,
|
|
iconColor: cs.tertiary,
|
|
onTap: () => context.go('/quiz-management'),
|
|
)
|
|
.animate()
|
|
.slideY(
|
|
duration: const Duration(milliseconds: 800),
|
|
curve: Curves.easeOut,
|
|
)
|
|
.then(delay: const Duration(milliseconds: 200));
|
|
}
|
|
|
|
Widget _buildJoinClassCard(BuildContext context) {
|
|
return DashboardActionCard(
|
|
title: 'Entrar numa Turma',
|
|
subtitle: 'Junta-te a uma turma com o código',
|
|
icon: Icons.group_add,
|
|
layout: DashboardActionCardLayout.horizontal,
|
|
minHeight: 0,
|
|
onTap: () {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(builder: (_) => const JoinClassPage()),
|
|
);
|
|
},
|
|
)
|
|
.animate()
|
|
.scale(
|
|
duration: const Duration(milliseconds: 600),
|
|
curve: Curves.elasticOut,
|
|
)
|
|
.then(delay: const Duration(milliseconds: 300));
|
|
}
|
|
}
|