110 lines
3.3 KiB
Dart
110 lines
3.3 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),
|
|
IntrinsicHeight(
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
Expanded(
|
|
flex: 3,
|
|
child: _buildTutorIACard(context),
|
|
),
|
|
const SizedBox(width: 16),
|
|
Expanded(
|
|
flex: 2,
|
|
child: _buildQuizCard(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 _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));
|
|
}
|
|
}
|