- Bandeau générique (DashboardBandeau) pour Parent, Admin, Gestionnaire, AM - ParentDashboardScreen, AdminDashboardScreen, GestionnaireDashboardScreen, AM dashboard - AppFooter responsive, scripts Gitea (create/list issues parent API) - Doc: ticket #101 Inscription Parent API, mise à jour 23_LISTE-TICKETS - User.fromJson robustesse (nullable id/email/role) - Suppression dashboard_app_bar.dart au profit de dashboard_bandeau.dart Refs: #100, #101 Made-with: Cursor
79 lines
2.3 KiB
Dart
79 lines
2.3 KiB
Dart
import 'package:flutter/material.dart';
|
||
import 'package:p_tits_pas/models/user.dart';
|
||
import 'package:p_tits_pas/services/auth_service.dart';
|
||
import 'package:p_tits_pas/widgets/app_footer.dart';
|
||
import 'package:p_tits_pas/widgets/dashboard/dashboard_bandeau.dart';
|
||
|
||
/// Dashboard assistante maternelle – page blanche avec bandeau générique.
|
||
/// Contenu détaillé à venir.
|
||
class AmDashboardScreen extends StatefulWidget {
|
||
const AmDashboardScreen({super.key});
|
||
|
||
@override
|
||
State<AmDashboardScreen> createState() => _AmDashboardScreenState();
|
||
}
|
||
|
||
class _AmDashboardScreenState extends State<AmDashboardScreen> {
|
||
int selectedTabIndex = 0;
|
||
AppUser? _user;
|
||
|
||
@override
|
||
void initState() {
|
||
super.initState();
|
||
_loadUser();
|
||
}
|
||
|
||
Future<void> _loadUser() async {
|
||
final user = await AuthService.getCurrentUser();
|
||
if (mounted) setState(() => _user = user);
|
||
}
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
return Scaffold(
|
||
appBar: PreferredSize(
|
||
preferredSize: const Size.fromHeight(60.0),
|
||
child: DashboardBandeau(
|
||
tabItems: const [
|
||
DashboardTabItem(label: 'Mon tableau de bord'),
|
||
DashboardTabItem(label: 'Paramètres'),
|
||
],
|
||
selectedTabIndex: selectedTabIndex,
|
||
onTabSelected: (index) => setState(() => selectedTabIndex = index),
|
||
userDisplayName: _user?.fullName.isNotEmpty == true
|
||
? _user!.fullName
|
||
: 'Assistante maternelle',
|
||
userEmail: _user?.email,
|
||
userRole: _user?.role,
|
||
onProfileTap: () {
|
||
ScaffoldMessenger.of(context).showSnackBar(
|
||
const SnackBar(
|
||
content: Text('Modification du profil – à venir')),
|
||
);
|
||
},
|
||
onSettingsTap: () {
|
||
ScaffoldMessenger.of(context).showSnackBar(
|
||
const SnackBar(content: Text('Paramètres – à venir')),
|
||
);
|
||
},
|
||
onLogout: () {},
|
||
showLogoutConfirmation: true,
|
||
),
|
||
),
|
||
body: Column(
|
||
children: [
|
||
Expanded(
|
||
child: Center(
|
||
child: Text(
|
||
'Dashboard AM – à venir',
|
||
style: Theme.of(context).textTheme.titleLarge,
|
||
),
|
||
),
|
||
),
|
||
const AppFooter(),
|
||
],
|
||
),
|
||
);
|
||
}
|
||
}
|