Histórico a funcionar

This commit is contained in:
2026-05-17 23:24:27 +01:00
parent 058bbaaea2
commit 4a5209b239
3 changed files with 447 additions and 150 deletions

View File

@@ -327,7 +327,8 @@ class _TutorChatPageState extends State<TutorChatPage>
void _addWelcomeMessage() {
final welcomeMessage = {
'content': '''**Olá! Sou o GOAT, o teu Assistente IA oficial do Teach it.** 🐐
'content':
'''**Olá! Sou a Alt, o teu Assistente IA oficial do Teach it.**
Estou aqui para te ajudar a aprender de forma confiante e motivadora!

View File

@@ -36,7 +36,8 @@ class _TutorChatPageSimpleState extends State<TutorChatPageSimple>
}
Future<void> _loadAvailableMaterials() async {
final materials = await MaterialsRAGService.getAvailableMaterialsForStudent();
final materials =
await MaterialsRAGService.getAvailableMaterialsForStudent();
if (mounted) {
setState(() => _availableMaterials = materials);
}
@@ -86,7 +87,7 @@ class _TutorChatPageSimpleState extends State<TutorChatPageSimple>
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'AI Study Assistant',
'Assistente de Estudo AI',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
@@ -374,13 +375,21 @@ class _TutorChatPageSimpleState extends State<TutorChatPageSimple>
),
decoration: BoxDecoration(
color: _selectedMaterialIds.isEmpty
? Theme.of(context).colorScheme.outline.withOpacity(0.15)
: Theme.of(context).colorScheme.primary.withOpacity(0.12),
? Theme.of(
context,
).colorScheme.outline.withOpacity(0.15)
: Theme.of(
context,
).colorScheme.primary.withOpacity(0.12),
borderRadius: BorderRadius.circular(20),
border: Border.all(
color: _selectedMaterialIds.isEmpty
? Theme.of(context).colorScheme.outline.withOpacity(0.4)
: Theme.of(context).colorScheme.primary.withOpacity(0.5),
? Theme.of(
context,
).colorScheme.outline.withOpacity(0.4)
: Theme.of(
context,
).colorScheme.primary.withOpacity(0.5),
),
),
child: Row(
@@ -390,7 +399,9 @@ class _TutorChatPageSimpleState extends State<TutorChatPageSimple>
Icons.attach_file,
size: 14,
color: _selectedMaterialIds.isEmpty
? Theme.of(context).colorScheme.onSurfaceVariant
? Theme.of(
context,
).colorScheme.onSurfaceVariant
: Theme.of(context).colorScheme.primary,
),
const SizedBox(width: 4),
@@ -401,8 +412,12 @@ class _TutorChatPageSimpleState extends State<TutorChatPageSimple>
style: TextStyle(
fontSize: 12,
color: _selectedMaterialIds.isEmpty
? Theme.of(context).colorScheme.onSurfaceVariant
: Theme.of(context).colorScheme.primary,
? Theme.of(
context,
).colorScheme.onSurfaceVariant
: Theme.of(
context,
).colorScheme.primary,
fontWeight: FontWeight.w500,
),
),
@@ -410,10 +425,10 @@ class _TutorChatPageSimpleState extends State<TutorChatPageSimple>
),
),
),
if (_selectedMaterialIds.isNotEmpty) ...
_selectedMaterialIds.map((id) {
final name = _availableMaterials
.firstWhere(
if (_selectedMaterialIds.isNotEmpty)
..._selectedMaterialIds.map((id) {
final name =
_availableMaterials.firstWhere(
(m) => m['id'] == id,
orElse: () => {'id': id, 'name': id},
)['name'] ??
@@ -460,34 +475,34 @@ class _TutorChatPageSimpleState extends State<TutorChatPageSimple>
// Text field
Expanded(
child: TextField(
controller: _messageController,
style: TextStyle(
fontSize: 16,
color: Theme.of(context).colorScheme.onSurface,
fontWeight: FontWeight.w500,
),
decoration: InputDecoration(
border: InputBorder.none,
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 14,
),
hintText: 'Faz a tua pergunta!',
hintStyle: TextStyle(
color: Theme.of(context).colorScheme.onSurfaceVariant,
fontWeight: FontWeight.w400,
fontSize: 16,
controller: _messageController,
style: TextStyle(
fontSize: 16,
color: Theme.of(context).colorScheme.onSurface,
fontWeight: FontWeight.w500,
),
decoration: InputDecoration(
border: InputBorder.none,
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 14,
),
hintText: 'Faz a tua pergunta!',
hintStyle: TextStyle(
color: Theme.of(context).colorScheme.onSurfaceVariant,
fontWeight: FontWeight.w400,
fontSize: 16,
),
),
onSubmitted: (_) => _handleSendMessage(),
textInputAction: TextInputAction.send,
onChanged: (value) {
setState(() {});
},
),
),
onSubmitted: (_) => _handleSendMessage(),
textInputAction: TextInputAction.send,
onChanged: (value) {
setState(() {});
},
),
),
// Send button
// Send button
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: Container(
@@ -508,7 +523,9 @@ class _TutorChatPageSimpleState extends State<TutorChatPageSimple>
: null,
color: _messageController.text.isNotEmpty
? null
: Theme.of(context).colorScheme.outline.withOpacity(0.3),
: Theme.of(
context,
).colorScheme.outline.withOpacity(0.3),
borderRadius: BorderRadius.circular(22),
boxShadow: _messageController.text.isNotEmpty
? [
@@ -523,7 +540,8 @@ class _TutorChatPageSimpleState extends State<TutorChatPageSimple>
: null,
),
child: IconButton(
onPressed: _messageController.text.isNotEmpty && !_isLoading
onPressed:
_messageController.text.isNotEmpty && !_isLoading
? _handleSendMessage
: null,
icon: _isLoading