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: const Color(0xFF2D3748), 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: const LinearGradient( begin: Alignment.topLeft, end: Alignment.bottomRight, colors: [Color(0xFF82C9BD), Color(0xFF6BA8A0)], ), borderRadius: BorderRadius.circular(16), boxShadow: [ BoxShadow( color: const Color(0xFF82C9BD).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: const Color(0xFFF68D2D), 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: Colors.white, borderRadius: BorderRadius.circular(16), border: Border.all(color: const Color(0xFFE2E8F0), width: 1), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.05), blurRadius: 10, offset: const Offset(0, 4), ), ], ), 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(14), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( padding: const EdgeInsets.all(10), decoration: BoxDecoration( color: const Color(0xFFF68D2D).withOpacity(0.1), borderRadius: BorderRadius.circular(10), ), child: const Icon( Icons.quiz, color: Color(0xFFF68D2D), size: 24, ), ), const SizedBox(height: 12), const Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Quiz', style: TextStyle( color: Color(0xFF2D3748), fontSize: 16, fontWeight: FontWeight.bold, ), ), SizedBox(height: 4), Text( 'Teste conhecimentos', maxLines: 2, overflow: TextOverflow.ellipsis, style: TextStyle( color: Color(0xFF718096), 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: 80, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(16), border: Border.all(color: const Color(0xFFE2E8F0), width: 1), boxShadow: [ BoxShadow( color: Colors.black.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: const Color(0xFF82C9BD).withOpacity(0.1), borderRadius: BorderRadius.circular(10), ), child: const Icon( Icons.group_add, color: Color(0xFF82C9BD), size: 24, ), ), const SizedBox(width: 16), const Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ Text( 'Entrar numa Turma', style: TextStyle( color: Color(0xFF2D3748), fontSize: 16, fontWeight: FontWeight.bold, ), ), SizedBox(height: 4), Text( 'Junta-te a uma turma com o código', maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( color: Color(0xFF718096), fontSize: 13, ), ), ], ), ), const Icon( Icons.arrow_forward_ios, color: Color(0xFF82C9BD), size: 16, ), ], ), ), ), ), ) .animate() .scale( duration: const Duration(milliseconds: 600), curve: Curves.elasticOut, ) .then(delay: const Duration(milliseconds: 300)); } }