Pequenas adições em teacher dashboard

This commit is contained in:
2026-05-17 23:34:21 +01:00
parent 4a5209b239
commit ad825f47d7
3 changed files with 405 additions and 99 deletions

View File

@@ -61,29 +61,23 @@ class _ClassStudentsPageState extends State<ClassStudentsPage> {
@override
Widget build(BuildContext context) {
final cs = Theme.of(context).colorScheme;
if (_isCheckingAccess) {
return const Scaffold(
backgroundColor: Color(0xFFF8F9FA),
body: Center(
child: CircularProgressIndicator(color: Color(0xFF82C9BD)),
),
return Scaffold(
backgroundColor: cs.surface,
body: Center(child: CircularProgressIndicator(color: cs.primary)),
);
}
if (!_accessGranted) {
return Scaffold(
backgroundColor: const Color(0xFFF8F9FA),
backgroundColor: cs.surface,
appBar: AppBar(
backgroundColor: const Color(0xFF82C9BD),
backgroundColor: cs.surface,
foregroundColor: cs.onSurface,
elevation: 0,
leading: IconButton(
icon: const Icon(Icons.arrow_back, color: Colors.white),
onPressed: () => Navigator.of(context).pop(),
),
title: const Text(
'Acesso Negado',
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
),
title: const Text('Acesso Negado'),
),
body: Center(
child: Padding(
@@ -91,16 +85,12 @@ class _ClassStudentsPageState extends State<ClassStudentsPage> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(
Icons.lock_outline,
size: 64,
color: Color(0xFF82C9BD),
),
Icon(Icons.lock_outline, size: 64, color: cs.primary),
const SizedBox(height: 24),
const Text(
Text(
'Sem permissão',
style: TextStyle(
color: Color(0xFF2D3748),
color: cs.onSurface,
fontSize: 20,
fontWeight: FontWeight.bold,
),
@@ -108,7 +98,7 @@ class _ClassStudentsPageState extends State<ClassStudentsPage> {
const SizedBox(height: 12),
Text(
'Só podes ver os alunos das tuas próprias disciplinas.',
style: TextStyle(color: Colors.grey[600], fontSize: 14),
style: TextStyle(color: cs.onSurfaceVariant, fontSize: 14),
textAlign: TextAlign.center,
),
],
@@ -119,31 +109,28 @@ class _ClassStudentsPageState extends State<ClassStudentsPage> {
}
return Scaffold(
backgroundColor: const Color(0xFFF8F9FA),
backgroundColor: cs.surface,
appBar: AppBar(
backgroundColor: const Color(0xFF82C9BD),
backgroundColor: cs.surface,
foregroundColor: cs.onSurface,
elevation: 0,
leading: IconButton(
icon: const Icon(Icons.arrow_back, color: Colors.white),
onPressed: () => Navigator.of(context).pop(),
),
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.className,
style: const TextStyle(
color: Colors.white,
style: TextStyle(
color: cs.onSurface,
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
const Text(
Text(
'Alunos Matriculados',
style: TextStyle(
color: Colors.white70,
color: cs.onSurfaceVariant,
fontSize: 13,
fontWeight: FontWeight.w300,
fontWeight: FontWeight.w400,
),
),
],
@@ -157,9 +144,7 @@ class _ClassStudentsPageState extends State<ClassStudentsPage> {
.snapshots(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(
child: CircularProgressIndicator(color: Color(0xFF82C9BD)),
);
return Center(child: CircularProgressIndicator(color: cs.primary));
}
if (snapshot.hasError) {
@@ -167,11 +152,15 @@ class _ClassStudentsPageState extends State<ClassStudentsPage> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.error_outline, size: 48, color: Colors.grey[400]),
Icon(
Icons.error_outline,
size: 48,
color: cs.onSurfaceVariant,
),
const SizedBox(height: 16),
Text(
'Erro ao carregar alunos',
style: TextStyle(color: Colors.grey[600], fontSize: 16),
style: TextStyle(color: cs.onSurfaceVariant, fontSize: 16),
),
],
),
@@ -182,33 +171,44 @@ class _ClassStudentsPageState extends State<ClassStudentsPage> {
if (enrollments.isEmpty) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.people_outline, size: 64, color: Colors.grey[300]),
const SizedBox(height: 24),
Text(
'Nenhum aluno entrou nesta disciplina ainda.',
style: TextStyle(color: Colors.grey[600], fontSize: 16),
textAlign: TextAlign.center,
),
const SizedBox(height: 8),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 32.0),
child: Text(
'Partilha o código da disciplina para os alunos se juntarem.',
style: TextStyle(color: Colors.grey[500], fontSize: 13),
child: Padding(
padding: const EdgeInsets.all(32),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.people_outline,
size: 64,
color: cs.onSurfaceVariant.withValues(alpha: 0.4),
),
const SizedBox(height: 24),
Text(
'Nenhum aluno entrou nesta disciplina ainda.',
style: TextStyle(
color: cs.onSurfaceVariant,
fontSize: 16,
),
textAlign: TextAlign.center,
),
),
],
const SizedBox(height: 8),
Text(
'Partilha o código da disciplina para os alunos se juntarem.',
style: TextStyle(
color: cs.onSurfaceVariant.withValues(alpha: 0.7),
fontSize: 13,
),
textAlign: TextAlign.center,
),
],
),
),
);
}
return ListView.builder(
padding: const EdgeInsets.all(16.0),
return ListView.separated(
padding: const EdgeInsets.all(16),
itemCount: enrollments.length,
separatorBuilder: (_, __) => const SizedBox(height: 12),
itemBuilder: (context, index) {
final enrollment =
enrollments[index].data() as Map<String, dynamic>;
@@ -217,52 +217,51 @@ class _ClassStudentsPageState extends State<ClassStudentsPage> {
final joinedAt = enrollment['joinedAt'] as Timestamp?;
return Container(
margin: const EdgeInsets.only(bottom: 12.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16.0),
color: cs.surface,
borderRadius: BorderRadius.circular(16),
border: Border.all(color: cs.outline.withValues(alpha: 0.15)),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.05),
blurRadius: 10,
offset: const Offset(0, 4),
color: cs.shadow.withValues(alpha: 0.05),
blurRadius: 8,
offset: const Offset(0, 2),
),
],
),
child: ListTile(
contentPadding: const EdgeInsets.all(16.0),
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
),
leading: Container(
width: 48,
height: 48,
decoration: BoxDecoration(
color: const Color(0xFF82C9BD).withOpacity(0.1),
borderRadius: BorderRadius.circular(12.0),
),
child: const Icon(
Icons.person,
color: Color(0xFF82C9BD),
size: 24,
color: cs.primary.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(12),
),
child: Icon(Icons.person, color: cs.primary, size: 24),
),
title: Text(
studentName,
style: const TextStyle(
color: Color(0xFF2D3748),
fontSize: 16,
style: TextStyle(
color: cs.onSurface,
fontSize: 15,
fontWeight: FontWeight.w600,
),
),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 4),
Text(
joinedAt != null
? 'Entrou em ${_formatDate(joinedAt.toDate())}'
: 'Data desconhecida',
style: TextStyle(color: Colors.grey[600], fontSize: 13),
subtitle: Padding(
padding: const EdgeInsets.only(top: 4),
child: Text(
joinedAt != null
? 'Entrou em ${_formatDate(joinedAt.toDate())}'
: 'Data desconhecida',
style: TextStyle(
color: cs.onSurfaceVariant,
fontSize: 13,
),
],
),
),
),
);