- Dark / light mode a funcionar no lado do aluno

- Atualização dos ficheiros markdown.
This commit is contained in:
2026-05-14 22:07:03 +01:00
parent 55ec2521cf
commit 62b9a107bc
30 changed files with 2582 additions and 1839 deletions

View File

@@ -48,9 +48,9 @@ class _TutorChatPageSimpleState extends State<TutorChatPageSimple>
}
},
child: Scaffold(
backgroundColor: const Color(0xFFF8F9FA),
backgroundColor: Theme.of(context).colorScheme.background,
appBar: AppBar(
backgroundColor: Colors.white,
backgroundColor: Theme.of(context).colorScheme.surface,
elevation: 0,
title: Row(
children: [
@@ -58,8 +58,11 @@ class _TutorChatPageSimpleState extends State<TutorChatPageSimple>
width: 40,
height: 40,
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [Color(0xFF82C9BD), Color(0xFF6BA5A0)],
gradient: LinearGradient(
colors: [
Theme.of(context).colorScheme.primary,
Theme.of(context).colorScheme.primary.withOpacity(0.8),
],
),
borderRadius: BorderRadius.circular(20),
),
@@ -74,12 +77,15 @@ class _TutorChatPageSimpleState extends State<TutorChatPageSimple>
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.grey[800],
color: Theme.of(context).colorScheme.onSurface,
),
),
Text(
'Seu tutor educacional inteligente',
style: TextStyle(fontSize: 12, color: Colors.grey[600]),
style: TextStyle(
fontSize: 12,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
],
),
@@ -88,7 +94,10 @@ class _TutorChatPageSimpleState extends State<TutorChatPageSimple>
actions: [
IconButton(
onPressed: _handleLogout,
icon: Icon(Icons.logout, color: Colors.grey[700]),
icon: Icon(
Icons.logout,
color: Theme.of(context).colorScheme.onSurface,
),
tooltip: 'Sair',
),
],
@@ -98,14 +107,14 @@ class _TutorChatPageSimpleState extends State<TutorChatPageSimple>
// Messages area
Expanded(
child: Container(
decoration: const BoxDecoration(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Color(0xFFF8F9FA),
Color(0xFFE8F0FE),
Color(0xFFF8F9FA),
Theme.of(context).colorScheme.background,
Theme.of(context).colorScheme.primary.withOpacity(0.05),
Theme.of(context).colorScheme.background,
],
),
),
@@ -163,15 +172,24 @@ class _TutorChatPageSimpleState extends State<TutorChatPageSimple>
padding: const EdgeInsets.all(16.0),
decoration: BoxDecoration(
gradient: isUser
? const LinearGradient(
colors: [Color(0xFF82C9BD), Color(0xFF6BA5A0)],
? LinearGradient(
colors: [
Theme.of(context).colorScheme.primary,
Theme.of(
context,
).colorScheme.primary.withOpacity(0.8),
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
)
: LinearGradient(
colors: [
Colors.white.withOpacity(0.95),
Colors.white.withOpacity(0.9),
Theme.of(
context,
).colorScheme.surface.withOpacity(0.95),
Theme.of(
context,
).colorScheme.surface.withOpacity(0.9),
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
@@ -208,24 +226,32 @@ class _TutorChatPageSimpleState extends State<TutorChatPageSimple>
data: content,
styleSheet: MarkdownStyleSheet(
p: TextStyle(
color: const Color(0xFF2D3748),
color: Theme.of(
context,
).colorScheme.onSurface,
fontSize: 16,
height: 1.4,
),
strong: TextStyle(
color: const Color(0xFF2D3748),
color: Theme.of(
context,
).colorScheme.onSurface,
fontSize: 16,
fontWeight: FontWeight.bold,
height: 1.4,
),
em: TextStyle(
color: const Color(0xFF2D3748),
color: Theme.of(
context,
).colorScheme.onSurface,
fontSize: 16,
fontStyle: FontStyle.italic,
height: 1.4,
),
listBullet: TextStyle(
color: const Color(0xFF2D3748),
color: Theme.of(
context,
).colorScheme.onSurface,
fontSize: 16,
height: 1.4,
),
@@ -247,7 +273,10 @@ class _TutorChatPageSimpleState extends State<TutorChatPageSimple>
),
child: Text(
_formatTimestamp(timestamp),
style: TextStyle(fontSize: 11, color: Colors.grey[600]),
style: TextStyle(
fontSize: 11,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
),
],
@@ -267,13 +296,16 @@ class _TutorChatPageSimpleState extends State<TutorChatPageSimple>
width: 36,
height: 36,
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [Color(0xFF82C9BD), Color(0xFF6BA5A0)],
gradient: LinearGradient(
colors: [
Theme.of(context).colorScheme.primary,
Theme.of(context).colorScheme.primary.withOpacity(0.8),
],
),
borderRadius: BorderRadius.circular(18),
boxShadow: [
BoxShadow(
color: const Color(0xFF82C9BD).withOpacity(0.3),
color: Theme.of(context).colorScheme.primary.withOpacity(0.3),
blurRadius: 8,
offset: const Offset(0, 2),
),
@@ -295,7 +327,7 @@ class _TutorChatPageSimpleState extends State<TutorChatPageSimple>
bottom: bottomPadding + 16.0, // Add system navigation bar padding
),
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.95),
color: Theme.of(context).colorScheme.surface.withOpacity(0.95),
borderRadius: const BorderRadius.vertical(top: Radius.circular(20)),
boxShadow: [
BoxShadow(
@@ -308,8 +340,11 @@ class _TutorChatPageSimpleState extends State<TutorChatPageSimple>
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
color: Colors.white,
border: Border.all(color: const Color(0xFFE2E8F0), width: 1),
color: Theme.of(context).colorScheme.surface,
border: Border.all(
color: Theme.of(context).colorScheme.outline.withOpacity(0.5),
width: 1,
),
),
child: Row(
children: [
@@ -317,9 +352,9 @@ class _TutorChatPageSimpleState extends State<TutorChatPageSimple>
Expanded(
child: TextField(
controller: _messageController,
style: const TextStyle(
style: TextStyle(
fontSize: 16,
color: Color(0xFF1A1A1A), // Dark text for visibility
color: Theme.of(context).colorScheme.onSurface,
fontWeight: FontWeight.w500,
),
decoration: InputDecoration(
@@ -330,7 +365,7 @@ class _TutorChatPageSimpleState extends State<TutorChatPageSimple>
),
hintText: 'Faz a tua pergunta!',
hintStyle: TextStyle(
color: Colors.grey[400],
color: Theme.of(context).colorScheme.onSurfaceVariant,
fontWeight: FontWeight.w400,
fontSize: 16,
),
@@ -351,20 +386,27 @@ class _TutorChatPageSimpleState extends State<TutorChatPageSimple>
height: 44,
decoration: BoxDecoration(
gradient: _messageController.text.isNotEmpty
? const LinearGradient(
colors: [Color(0xFF82C9BD), Color(0xFF6BA5A0)],
? LinearGradient(
colors: [
Theme.of(context).colorScheme.primary,
Theme.of(
context,
).colorScheme.primary.withOpacity(0.8),
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
)
: null,
color: _messageController.text.isNotEmpty
? null
: Colors.grey[300],
: Theme.of(context).colorScheme.outline.withOpacity(0.3),
borderRadius: BorderRadius.circular(22),
boxShadow: _messageController.text.isNotEmpty
? [
BoxShadow(
color: const Color(0xFF82C9BD).withOpacity(0.3),
color: Theme.of(
context,
).colorScheme.primary.withOpacity(0.3),
blurRadius: 8,
offset: const Offset(0, 2),
),
@@ -398,7 +440,8 @@ class _TutorChatPageSimpleState extends State<TutorChatPageSimple>
void _addWelcomeMessage() {
final welcomeMessage = {
'content': '''**Olá! Sou o GOAT, o teu Assistente IA oficial do Teach it.** 🐐
'content':
'''**Olá! Sou o GOAT, o teu Assistente IA oficial do Teach it.** 🐐
Estou aqui para te ajudar a aprender de forma confiante e motivadora!
@@ -465,7 +508,8 @@ Envia-me a tua pergunta sobre qualquer assunto educacional e vou usar o material
} catch (e) {
// Fallback to error message if API fails
Logger.error('RAG AI Service error: $e');
final aiResponse = 'Desculpe, ocorreu um erro ao processar a pergunta. Tente novamente.';
final aiResponse =
'Desculpe, ocorreu um erro ao processar a pergunta. Tente novamente.';
setState(() {
_messages.add({