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'; /// Quick access cards for Tutor IA and Quiz with fixed overflow 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), Row( children: [ // Tutor IA Card (Primary) Expanded(flex: 3, child: _buildTutorIACard(context)), const SizedBox(width: 16), // Quiz Card (Secondary) Expanded(flex: 2, child: _buildQuizCard(context)), ], ), const SizedBox(height: 16), // Join Class Card _buildJoinClassCard(context), ], ) .animate() .slideY( duration: const Duration(milliseconds: 800), curve: Curves.easeOut, ) .then(delay: const Duration(milliseconds: 200)); } Widget _buildTutorIACard(BuildContext context) { return Container( height: 150, decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment.topLeft, end: Alignment.bottomRight, colors: [ Theme.of(context).colorScheme.primary, Theme.of(context).colorScheme.primary.withOpacity(0.8), ], ), borderRadius: BorderRadius.circular(16), boxShadow: [ BoxShadow( color: Theme.of(context).colorScheme.primary.withOpacity(0.3), blurRadius: 15, offset: const Offset(0, 8), ), ], ), child: Material( color: Colors.transparent, child: InkWell( borderRadius: BorderRadius.circular(16), onTap: () { print('DEBUG: AI Tutor card clicked!'); try { context.go('/ai-tutor'); print('DEBUG: Navigation to AI Tutor successful'); } catch (e) { print('DEBUG: Navigation error: $e'); } }, child: Padding( padding: const EdgeInsets.all(20), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( children: [ Container( padding: const EdgeInsets.all(7), decoration: BoxDecoration( color: Colors.white.withOpacity(0.2), borderRadius: BorderRadius.circular(10), ), child: const Icon( Icons.psychology, color: Colors.white, size: 24, ), ), const Spacer(), Container( padding: const EdgeInsets.symmetric( horizontal: 10, vertical: 4, ), decoration: BoxDecoration( color: Theme.of(context).colorScheme.secondary, borderRadius: BorderRadius.circular(12), ), child: const Text( 'NOVO', style: TextStyle( color: Colors.white, fontSize: 10, fontWeight: FontWeight.bold, ), ), ), ], ), const SizedBox(height: 12), const Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Tutor IA', style: TextStyle( color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold, ), ), //SizedBox(height: 4), Text( 'Assistente de estudos', maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( color: Colors.white, fontSize: 12, height: 1.2, ), ), ], ), ], ), ), ), ), ) .animate() .scale( duration: const Duration(milliseconds: 600), curve: Curves.elasticOut, ) .then(delay: const Duration(milliseconds: 100)); } Widget _buildQuizCard(BuildContext context) { return Container( height: 150, decoration: BoxDecoration( color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.circular(16), border: Border.all( color: Theme.of(context).colorScheme.outline.withOpacity(0.2), width: 1, ), boxShadow: [ BoxShadow( color: Theme.of(context).colorScheme.shadow.withOpacity(0.05), blurRadius: 10, offset: const Offset(0, 4), ), ], ), child: Material( color: Colors.transparent, child: InkWell( borderRadius: BorderRadius.circular(16), onTap: () => context.go('/quiz'), child: Padding( padding: const EdgeInsets.all(14), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( padding: const EdgeInsets.all(10), decoration: BoxDecoration( color: Theme.of( context, ).colorScheme.secondary.withOpacity(0.1), borderRadius: BorderRadius.circular(10), ), child: Icon( Icons.quiz, color: Theme.of(context).colorScheme.secondary, size: 24, ), ), const SizedBox(height: 12), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Quiz', style: TextStyle( color: Theme.of(context).colorScheme.onSurface, fontSize: 16, fontWeight: FontWeight.bold, ), ), const SizedBox(height: 4), Text( 'Testa os teus conhecimentos', maxLines: 2, overflow: TextOverflow.ellipsis, style: TextStyle( color: Theme.of( context, ).colorScheme.onSurfaceVariant, fontSize: 12, height: 1.2, ), ), ], ), ], ), ), ), ), ) .animate() .scale( duration: const Duration(milliseconds: 600), curve: Curves.elasticOut, ) .then(delay: const Duration(milliseconds: 200)); } Widget _buildJoinClassCard(BuildContext context) { return Container( height: 86, decoration: BoxDecoration( color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.circular(16), border: Border.all( color: Theme.of(context).colorScheme.outline.withOpacity(0.2), width: 1, ), boxShadow: [ BoxShadow( color: Theme.of(context).colorScheme.shadow.withOpacity(0.05), blurRadius: 10, offset: const Offset(0, 4), ), ], ), child: Material( color: Colors.transparent, child: InkWell( borderRadius: BorderRadius.circular(16), onTap: () { Navigator.push( context, MaterialPageRoute(builder: (_) => const JoinClassPage()), ); }, child: Padding( padding: const EdgeInsets.all(16), child: Row( children: [ Container( padding: const EdgeInsets.all(10), decoration: BoxDecoration( color: Theme.of( context, ).colorScheme.primary.withOpacity(0.1), borderRadius: BorderRadius.circular(10), ), child: Icon( Icons.group_add, color: Theme.of(context).colorScheme.primary, size: 24, ), ), const SizedBox(width: 16), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ Text( 'Entrar numa Turma', style: TextStyle( color: Theme.of(context).colorScheme.onSurface, fontSize: 16, fontWeight: FontWeight.bold, ), ), const SizedBox(height: 4), Text( 'Junta-te a uma turma com o código', maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( color: Theme.of( context, ).colorScheme.onSurfaceVariant, fontSize: 13, ), ), ], ), ), Icon( Icons.arrow_forward_ios, color: Theme.of(context).colorScheme.primary, size: 16, ), ], ), ), ), ), ) .animate() .scale( duration: const Duration(milliseconds: 600), curve: Curves.elasticOut, ) .then(delay: const Duration(milliseconds: 300)); } }