Finalização de detalhes e pequenas adições em dashboards de alunos e professores
This commit is contained in:
@@ -187,24 +187,27 @@ class _ProgressHeroWidgetState extends State<ProgressHeroWidget> {
|
||||
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: overallProgress,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
AppThemeExtras.of(context).heroProgressStart,
|
||||
AppThemeExtras.of(context).heroProgressEnd,
|
||||
],
|
||||
GestureDetector(
|
||||
onTap: () => _showProgressExplanation(context),
|
||||
child: Container(
|
||||
height: 12,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.3),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: FractionallySizedBox(
|
||||
alignment: Alignment.centerLeft,
|
||||
widthFactor: overallProgress,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
AppThemeExtras.of(context).heroProgressStart,
|
||||
AppThemeExtras.of(context).heroProgressEnd,
|
||||
],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -215,10 +218,14 @@ class _ProgressHeroWidgetState extends State<ProgressHeroWidget> {
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _buildStatCard(
|
||||
icon: Icons.access_time,
|
||||
value: '${(studyTimeMinutes / 60).toStringAsFixed(1)}h',
|
||||
label: 'Tempo de Estudo',
|
||||
child: GestureDetector(
|
||||
onTap: () => _showStudyTimeDetails(context, userStats),
|
||||
child: _buildStatCard(
|
||||
icon: Icons.access_time,
|
||||
value:
|
||||
'${(studyTimeMinutes / 60).toStringAsFixed(1)}h',
|
||||
label: 'Tempo de Estudo',
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
@@ -362,4 +369,111 @@ class _ProgressHeroWidgetState extends State<ProgressHeroWidget> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _showProgressExplanation(BuildContext context) {
|
||||
final cs = Theme.of(context).colorScheme;
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
||||
title: Row(
|
||||
children: [
|
||||
Icon(Icons.info_outline, color: cs.primary),
|
||||
const SizedBox(width: 8),
|
||||
const Text('Progresso Geral'),
|
||||
],
|
||||
),
|
||||
content: const Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'O Progresso Geral representa a média dos níveis de domínio dos conceitos que já dominaste.',
|
||||
style: TextStyle(fontSize: 14),
|
||||
),
|
||||
SizedBox(height: 12),
|
||||
Text(
|
||||
'Como é calculado:',
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Text(
|
||||
'• Cada conceito tem um nível de 0 a 100\n'
|
||||
'• O progresso é a média de todos os conceitos dominados\n'
|
||||
'• Quanto mais alto, melhor o teu domínio',
|
||||
style: TextStyle(fontSize: 13, color: Colors.grey),
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
child: const Text('Entendi'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _showStudyTimeDetails(BuildContext context, UserStats? userStats) {
|
||||
final cs = Theme.of(context).colorScheme;
|
||||
final totalMinutes = userStats?.totalStudyTime ?? 0;
|
||||
final weeklyMinutes = userStats?.weeklyStudyTime ?? 0;
|
||||
final monthlyMinutes = userStats?.monthlyStudyTime ?? 0;
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
||||
title: Row(
|
||||
children: [
|
||||
Icon(Icons.access_time, color: cs.primary),
|
||||
const SizedBox(width: 8),
|
||||
const Text('Tempo de Estudo'),
|
||||
],
|
||||
),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildTimeRow('Total', totalMinutes, cs),
|
||||
const SizedBox(height: 12),
|
||||
_buildTimeRow('Esta semana', weeklyMinutes, cs),
|
||||
const SizedBox(height: 12),
|
||||
_buildTimeRow('Este mês', monthlyMinutes, cs),
|
||||
const SizedBox(height: 16),
|
||||
const Text(
|
||||
'O tempo é contado automaticamente quando completas quizzes.',
|
||||
style: TextStyle(fontSize: 12, color: Colors.grey),
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
child: const Text('Fechar'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTimeRow(String label, int minutes, ColorScheme cs) {
|
||||
final hours = minutes ~/ 60;
|
||||
final mins = minutes % 60;
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(label, style: TextStyle(fontSize: 14, color: cs.onSurface)),
|
||||
Text(
|
||||
hours > 0 ? '${hours}h ${mins}min' : '${mins}min',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: cs.primary,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user