import 'package:flutter/material.dart'; import 'package:flutter_animate/flutter_animate.dart'; /// Hero section for teacher dashboard showing class overview class TeacherHeroWidget extends StatelessWidget { final String userName; final int totalStudents; final int activeQuizzes; final int uploadedContent; final double classAverageProgress; const TeacherHeroWidget({ super.key, required this.userName, this.totalStudents = 24, this.activeQuizzes = 3, this.uploadedContent = 12, this.classAverageProgress = 0.72, }); @override Widget build(BuildContext context) { return Container( margin: const EdgeInsets.only(bottom: 24), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ // Header Row( children: [ Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Visão Geral da Turma', maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( color: Theme.of(context).colorScheme.onSurface, fontSize: 20, fontWeight: FontWeight.bold, ), ), const SizedBox(height: 4), Text( 'Acompanhe o progresso dos seus alunos', maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( color: Theme.of(context).colorScheme.onSurfaceVariant, fontSize: 13, ), ), ], ), ), Container( padding: const EdgeInsets.symmetric( horizontal: 12, vertical: 6, ), decoration: BoxDecoration( color: Theme.of(context).colorScheme.secondary, borderRadius: BorderRadius.circular(20), ), child: Row( mainAxisSize: MainAxisSize.min, children: [ const Icon(Icons.people, color: Colors.white, size: 16), const SizedBox(width: 4), Text( '$totalStudents alunos', style: const TextStyle( color: Colors.white, fontSize: 12, fontWeight: FontWeight.bold, ), ), ], ), ), ], ), const SizedBox(height: 20), // Main Class Progress Card Container( padding: const EdgeInsets.all(24), 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(20), boxShadow: [ BoxShadow( color: Theme.of(context).colorScheme.shadow.withOpacity(0.1), blurRadius: 20, offset: const Offset(0, 10), ), ], ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ // Overall Progress Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ const Flexible( child: Text( 'Progresso Médio da Turma', maxLines: 2, overflow: TextOverflow.ellipsis, style: TextStyle( color: Colors.white, fontSize: 15, fontWeight: FontWeight.bold, ), ), ), Text( '${(classAverageProgress * 100).toInt()}%', style: const TextStyle( color: Colors.white, fontSize: 24, fontWeight: FontWeight.bold, ), ), ], ), const SizedBox(height: 16), // Progress Bar Container( height: 12, decoration: BoxDecoration( color: Colors.white.withOpacity(0.3), borderRadius: BorderRadius.circular(6), ), child: FractionallySizedBox( alignment: Alignment.centerLeft, widthFactor: classAverageProgress, child: Container( decoration: BoxDecoration( gradient: const LinearGradient( colors: [Colors.white, Color(0xFFF8F9FA)], ), borderRadius: BorderRadius.circular(6), ), ), ), ), const SizedBox(height: 20), // Stats Grid Row( children: [ Expanded( child: _buildStatCard( icon: Icons.quiz, value: '$activeQuizzes', label: 'Quizzes Ativos', ), ), const SizedBox(width: 12), Expanded( child: _buildStatCard( icon: Icons.upload_file, value: '$uploadedContent', label: 'Conteúdos', ), ), ], ), ], ), ).animate().scale( duration: const Duration(milliseconds: 600), curve: Curves.elasticOut, ), const SizedBox(height: 20), // Recent Activity Container( padding: const EdgeInsets.all(20), decoration: BoxDecoration( color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.circular(16), border: Border.all( color: Theme.of( context, ).colorScheme.outline.withOpacity(0.2), ), boxShadow: [ BoxShadow( color: Theme.of( context, ).colorScheme.shadow.withOpacity(0.05), blurRadius: 10, offset: const Offset(0, 4), ), ], ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Icon( Icons.trending_up, color: Theme.of(context).colorScheme.secondary, size: 20, ), const SizedBox(width: 8), Text( 'Atividade Recente', style: TextStyle( color: Theme.of(context).colorScheme.onSurface, fontSize: 16, fontWeight: FontWeight.bold, ), ), ], ), const SizedBox(height: 12), _buildActivityItem( context, '15 alunos completaram o quiz de Derivadas', 'Hoje, 14:30', Theme.of(context).colorScheme.primary, ), const SizedBox(height: 8), _buildActivityItem( context, 'Novo conteúdo: Regra da Cadeia', 'Ontem, 09:15', Theme.of(context).colorScheme.secondary, ), const SizedBox(height: 8), _buildActivityItem( context, '3 alunos precisam de apoio em Limites', 'Ontem, 16:45', Theme.of(context).colorScheme.error, ), ], ), ) .animate() .slideX( duration: const Duration(milliseconds: 800), curve: Curves.easeOut, ) .then(delay: const Duration(milliseconds: 200)), ], ), ); } Widget _buildStatCard({ required IconData icon, required String value, required String label, }) { return Container( padding: const EdgeInsets.all(16), decoration: BoxDecoration( color: Colors.white.withOpacity(0.2), borderRadius: BorderRadius.circular(12), border: Border.all(color: Colors.white.withOpacity(0.3), width: 1), ), child: Column( children: [ Icon(icon, color: Colors.white, size: 24), const SizedBox(height: 8), Text( value, style: const TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold, ), ), const SizedBox(height: 4), Text( label, style: const TextStyle(color: Colors.white, fontSize: 11), textAlign: TextAlign.center, maxLines: 2, overflow: TextOverflow.ellipsis, ), ], ), ); } Widget _buildActivityItem( BuildContext context, String text, String time, Color color, ) { return Row( children: [ Container( width: 8, height: 8, decoration: BoxDecoration(color: color, shape: BoxShape.circle), ), const SizedBox(width: 12), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( text, style: TextStyle( color: Theme.of(context).colorScheme.onSurfaceVariant, fontSize: 14, ), ), const SizedBox(height: 2), Text( time, style: TextStyle( color: Theme.of( context, ).colorScheme.onSurfaceVariant.withOpacity(0.7), fontSize: 12, ), ), ], ), ), ], ); } }