Files
LearnIT/lib/features/dashboard/presentation/pages/student_dashboard_page.dart

121 lines
3.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import '../../../../core/services/auth_service.dart';
import '../widgets/progress_hero_widget.dart';
import '../widgets/quick_access_widget.dart';
import '../widgets/profile_section_widget.dart';
class StudentDashboardPage extends StatefulWidget {
const StudentDashboardPage({super.key});
@override
State<StudentDashboardPage> createState() => _StudentDashboardPageState();
}
class _StudentDashboardPageState extends State<StudentDashboardPage> {
String _userName = 'Estudante';
@override
void initState() {
super.initState();
_loadUserData();
}
void _loadUserData() {
final user = AuthService.currentUser;
if (user != null) {
setState(() {
_userName = user.displayName ?? 'Estudante';
});
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Color(0xFF82C9BD),
Color(0xFF7BA89C),
Color(0xFFF68D2D),
Color(0xFFF8F9FA),
],
stops: [0.0, 0.2, 0.6, 1.0],
),
),
child: SafeArea(
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Header with logout
Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Bem-vindo, $_userName!',
style: const TextStyle(
color: Colors.white,
fontSize: 28,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 4),
const Text(
'Seu progresso de estudos',
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontWeight: FontWeight.w300,
),
),
],
),
),
IconButton(
icon: const Icon(Icons.logout, color: Colors.white),
onPressed: () async {
await AuthService.signOut();
if (mounted) {
context.go('/login');
}
},
tooltip: 'Sair',
),
],
),
const SizedBox(height: 32),
// Progress Hero Section (Priority 1)
ProgressHeroWidget(userName: _userName),
const SizedBox(height: 24),
// Quick Access Section (Priority 2)
const QuickAccessWidget(),
const SizedBox(height: 24),
// Profile Section (Priority 3)
const ProfileSectionWidget(),
const SizedBox(height: 40),
],
),
),
),
),
),
);
}
}