Files
petitspas/frontend/lib/screens/am/am_dashboard_screen.dart
T

87 lines
2.8 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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/quotidien/quotidien_shell.dart';
import 'package:p_tits_pas/widgets/quotidien/quotidien_theme.dart';
/// Dashboard assistante maternelle – coquille 3 colonnes quotidien (#169).
/// Colonne gauche : sélecteur de couple enfant–parent(s) (à venir #170).
/// Métier cartes / blog / messagerie : tickets C/D/E.
class AmDashboardScreen extends StatefulWidget {
const AmDashboardScreen({super.key});
@override
State<AmDashboardScreen> createState() => _AmDashboardScreenState();
}
class _AmDashboardScreenState extends State<AmDashboardScreen> {
QuotidienNavSection _section = QuotidienNavSection.liaison;
AppUser? _user;
@override
void initState() {
super.initState();
_loadUser();
}
Future<void> _loadUser() async {
final user = await AuthService.getCurrentUser();
if (mounted) setState(() => _user = user);
}
String get _displayName {
final n = _user?.fullName.trim() ?? '';
if (n.isNotEmpty) return n;
final email = _user?.email.trim() ?? '';
if (email.isNotEmpty) return email.split('@').first;
return 'Assistante maternelle';
}
void _soon(String label) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('$label — à venir')),
);
}
@override
Widget build(BuildContext context) {
return QuotidienShell(
selectedSection: _section,
onSectionSelected: (s) => setState(() => _section = s),
userDisplayName: _displayName,
userEmail: _user?.email,
onProfileTap: () => _soon('Profil'),
onSettingsTap: () => _soon('Paramètres'),
// L'AM n'a pas de bouton "Recherche AM" dans le bandeau
onSearchAmTap: null,
leftColumn: const QuotidienColumnPlaceholder(
title: 'Cartes',
subtitle:
'Couple enfant–parent(s) et flux de cartes\n(à brancher — tickets #170 / #174).',
icon: Icons.style_outlined,
),
centerColumn: const QuotidienColumnPlaceholder(
title: 'Blog',
subtitle:
'Fil du quotidien (affichage par défaut)\n(à brancher — ticket #179).',
icon: Icons.auto_stories_outlined,
),
rightColumn: const QuotidienColumnPlaceholder(
title: 'Messagerie',
subtitle:
'Mess. Parents · Mess. RPE\n(à brancher — ticket #185).',
icon: Icons.chat_bubble_outline,
),
agendaBody: const QuotidienStubPage(
title: 'Agenda',
message: 'Agenda — contenu à venir (stub #187).',
),
contratBody: const QuotidienStubPage(
title: 'Contrat',
message: 'Contrat — contenu à venir (stub #187).',
),
);
}
}