Melhoria no funcionamento do histórico, Os nomes no dashboard do aluno carregam a primeira vez e ficam salvos para n ficarem sempre a carregar quando se volta ao dashboard, removi o butão de novo chat na interface de introdução da IA, mudei a aparencia dessa introdução e do histórico

This commit is contained in:
2026-05-23 16:20:27 +01:00
parent 7ee262f4c7
commit 895ce64c6f
22 changed files with 1330 additions and 582 deletions

View File

@@ -11,6 +11,14 @@ import '../widgets/profile_section_widget.dart';
class StudentDashboardPage extends StatefulWidget {
const StudentDashboardPage({super.key});
/// Clear the cached user name (call when name is updated in settings)
static void clearCachedUserName() {
_cachedUserName = null;
}
/// Cached user name to prevent flickering
static String? _cachedUserName;
@override
State<StudentDashboardPage> createState() => _StudentDashboardPageState();
}
@@ -21,7 +29,12 @@ class _StudentDashboardPageState extends State<StudentDashboardPage> {
@override
void initState() {
super.initState();
_checkRoleAndLoadData();
// Use cached name if available, otherwise load data
if (StudentDashboardPage._cachedUserName != null) {
_userName = StudentDashboardPage._cachedUserName!;
} else {
_checkRoleAndLoadData();
}
}
Future<void> _checkRoleAndLoadData() async {
@@ -75,6 +88,7 @@ class _StudentDashboardPageState extends State<StudentDashboardPage> {
print('DEBUG: Final displayName to use: "$displayName"');
setState(() {
_userName = displayName;
StudentDashboardPage._cachedUserName = displayName;
});
}
}
@@ -99,14 +113,21 @@ class _StudentDashboardPageState extends State<StudentDashboardPage> {
),
),
child: SafeArea(
top: false,
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(24.0),
padding: const EdgeInsets.only(
left: 24.0,
right: 24.0,
bottom: 28.0,
top: 52.0,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Header with logout and settings
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Column(