refactor(front): suppression anciens widgets dashbord_parent remplaces par la coquille quotidien (#166)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,58 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class Childrensidebarwidget extends StatelessWidget{
|
|
||||||
final void Function(String childId) onChildSelected;
|
|
||||||
|
|
||||||
const Childrensidebarwidget({
|
|
||||||
Key? key,
|
|
||||||
required this.onChildSelected,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final children = [
|
|
||||||
{'id': '1', 'name': 'Léna', 'photo': null, 'status': 'Actif'},
|
|
||||||
{'id': '2', 'name': 'Noé', 'photo': null, 'status': 'Inactif'},
|
|
||||||
];
|
|
||||||
|
|
||||||
return Container(
|
|
||||||
color: const Color(0xFFF7F7F7),
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
// Avatar parent + bouton
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
const CircleAvatar(radius: 24, child: Icon(Icons.person)),
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(Icons.add),
|
|
||||||
onPressed: () {
|
|
||||||
// Naviguer vers ajout d'enfant
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
const Text("Mes enfants", style: TextStyle(fontWeight: FontWeight.bold)),
|
|
||||||
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
// Liste des enfants
|
|
||||||
...children.map((child) {
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: () => onChildSelected(child['id']!),
|
|
||||||
child: Card(
|
|
||||||
color: child['status'] == 'Actif' ? Colors.teal.shade50 : Colors.white,
|
|
||||||
child: ListTile(
|
|
||||||
leading: const CircleAvatar(child: Icon(Icons.child_care)),
|
|
||||||
title: Text(child['name']!),
|
|
||||||
subtitle: Text(child['status']!),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}).toList()
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class AppLayout extends StatelessWidget {
|
|
||||||
final PreferredSizeWidget appBar;
|
|
||||||
final Widget body;
|
|
||||||
final Widget? footer;
|
|
||||||
|
|
||||||
const AppLayout({
|
|
||||||
Key? key,
|
|
||||||
required this.appBar,
|
|
||||||
required this.body,
|
|
||||||
this.footer,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: const Color(0xFFF5F7FA),
|
|
||||||
appBar: appBar,
|
|
||||||
body: Column(
|
|
||||||
children: [
|
|
||||||
Expanded(child: body),
|
|
||||||
if (footer != null) footer!,
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,203 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:p_tits_pas/models/m_dashbord/child_model.dart';
|
|
||||||
|
|
||||||
class ChildrenSidebar extends StatelessWidget {
|
|
||||||
final List<ChildModel> children;
|
|
||||||
final String? selectedChildId;
|
|
||||||
final Function(String) onChildSelected;
|
|
||||||
final VoidCallback onAddChild;
|
|
||||||
final bool isCompact;
|
|
||||||
final bool isMobile;
|
|
||||||
|
|
||||||
const ChildrenSidebar({
|
|
||||||
Key? key,
|
|
||||||
required this.children,
|
|
||||||
this.selectedChildId,
|
|
||||||
required this.onChildSelected,
|
|
||||||
required this.onAddChild,
|
|
||||||
this.isCompact = false,
|
|
||||||
this.isMobile = false,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Container(
|
|
||||||
padding: EdgeInsets.all(isMobile ? 16 : 24),
|
|
||||||
color: Colors.white,
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
_buildHeader(context),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
_buildAddChildButton(context),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
Expanded(child: _buildChildrenList()),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildHeader(BuildContext context) {
|
|
||||||
return Row(
|
|
||||||
children: [
|
|
||||||
// UserAvatar(
|
|
||||||
// size: isCompact ? 40 : 60,
|
|
||||||
// name: 'Emma Dupont', // TODO: Récupérer depuis le contexte utilisateur
|
|
||||||
// ),
|
|
||||||
if (!isCompact) ...[
|
|
||||||
const SizedBox(width: 12),
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: const [
|
|
||||||
Text(
|
|
||||||
'Emma Dupont',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Icon(Icons.keyboard_arrow_down),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildAddChildButton(BuildContext context) {
|
|
||||||
return SizedBox(
|
|
||||||
width: double.infinity,
|
|
||||||
child: OutlinedButton.icon(
|
|
||||||
onPressed: onAddChild,
|
|
||||||
icon: const Icon(Icons.add),
|
|
||||||
label: Text(isCompact ? 'Ajouter' : 'Ajouter un enfant'),
|
|
||||||
style: OutlinedButton.styleFrom(
|
|
||||||
padding: EdgeInsets.symmetric(
|
|
||||||
horizontal: 16,
|
|
||||||
vertical: isCompact ? 8 : 12,
|
|
||||||
),
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildChildrenList() {
|
|
||||||
if (children.isEmpty) {
|
|
||||||
return const Center(
|
|
||||||
child: Text(
|
|
||||||
'Aucun enfant ajouté',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.grey,
|
|
||||||
fontSize: 14,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ListView.separated(
|
|
||||||
itemCount: children.length,
|
|
||||||
separatorBuilder: (context, index) => const SizedBox(height: 12),
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
final child = children[index];
|
|
||||||
final isSelected = child.id == selectedChildId;
|
|
||||||
|
|
||||||
return _buildChildCard(context, child, isSelected);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildChildCard(BuildContext context, ChildModel child, bool isSelected) {
|
|
||||||
return InkWell(
|
|
||||||
onTap: () => onChildSelected(child.id),
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: isSelected ? const Color(0xFF9CC5C0).withOpacity(0.1) : Colors.transparent,
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
border: Border.all(
|
|
||||||
color: isSelected ? const Color(0xFF9CC5C0) : Colors.grey.shade300,
|
|
||||||
width: isSelected ? 2 : 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
// UserAvatar(
|
|
||||||
// // size: isCompact ? 32 : 40,
|
|
||||||
// // name: child.fullName,
|
|
||||||
// // imageUrl: child.photoUrl,
|
|
||||||
// ),
|
|
||||||
if (!isCompact) ...[
|
|
||||||
const SizedBox(width: 12),
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
child.firstName,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14,
|
|
||||||
fontWeight: isSelected ? FontWeight.w600 : FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 4),
|
|
||||||
_buildChildStatus(child.status),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildChildStatus(ChildStatus status) {
|
|
||||||
String label;
|
|
||||||
Color color;
|
|
||||||
|
|
||||||
switch (status) {
|
|
||||||
case ChildStatus.withAssistant:
|
|
||||||
label = 'En garde';
|
|
||||||
color = Colors.green;
|
|
||||||
break;
|
|
||||||
case ChildStatus.available:
|
|
||||||
label = 'Disponible';
|
|
||||||
color = Colors.blue;
|
|
||||||
break;
|
|
||||||
case ChildStatus.onHoliday:
|
|
||||||
label = 'En vacances';
|
|
||||||
color = Colors.orange;
|
|
||||||
break;
|
|
||||||
case ChildStatus.sick:
|
|
||||||
label = 'Malade';
|
|
||||||
color = Colors.red;
|
|
||||||
break;
|
|
||||||
case ChildStatus.searching:
|
|
||||||
label = 'Recherche AM';
|
|
||||||
color = Colors.purple;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Container(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: color.withOpacity(0.1),
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
label,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 11,
|
|
||||||
color: color,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:p_tits_pas/widgets/dashbord_parent/ChildrenSidebarwidget.dart';
|
|
||||||
import 'package:p_tits_pas/widgets/dashbord_parent/children_sidebar.dart';
|
|
||||||
import 'package:p_tits_pas/widgets/dashbord_parent/wid_mainContentArea.dart';
|
|
||||||
import 'package:p_tits_pas/widgets/messaging_sidebar.dart';
|
|
||||||
|
|
||||||
Widget Dashbord_body() {
|
|
||||||
return Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
||||||
children: [
|
|
||||||
// 1️⃣ Colonne de gauche : enfants
|
|
||||||
SizedBox(
|
|
||||||
width: 250,
|
|
||||||
child: Childrensidebarwidget(
|
|
||||||
onChildSelected: (childId) {
|
|
||||||
// Met à jour l'enfant sélectionné
|
|
||||||
// Tu peux stocker cet ID dans un state `selectedChildId`
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: WMainContentArea(
|
|
||||||
// Passe l’enfant sélectionné si besoin
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:p_tits_pas/widgets/messaging_sidebar.dart';
|
|
||||||
|
|
||||||
class WMainContentArea extends StatelessWidget {
|
|
||||||
const WMainContentArea({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Container(
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
color: Colors.white,
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
||||||
children: [
|
|
||||||
// 🔷 Informations assistante maternelle (ligne complète)
|
|
||||||
Card(
|
|
||||||
margin: const EdgeInsets.only(bottom: 16),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
const CircleAvatar(
|
|
||||||
radius: 30,
|
|
||||||
backgroundImage: AssetImage("assets/images/am_photo.jpg"), // à adapter
|
|
||||||
),
|
|
||||||
const SizedBox(width: 16),
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: const [
|
|
||||||
Text("Julie Dupont", style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
|
||||||
SizedBox(height: 4),
|
|
||||||
Text("Taux horaire : 10€/h"),
|
|
||||||
Text("Frais journaliers : 5€"),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ElevatedButton(
|
|
||||||
onPressed: () {
|
|
||||||
// Ouvrir le contrat
|
|
||||||
},
|
|
||||||
child: const Text("Voir le contrat"),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
// 🔷 Deux colonnes : planning + messagerie
|
|
||||||
Expanded(
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
// 📆 Planning de garde
|
|
||||||
Expanded(
|
|
||||||
flex: 2,
|
|
||||||
child: Card(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: const [
|
|
||||||
Text("Planning de garde", style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)),
|
|
||||||
SizedBox(height: 12),
|
|
||||||
Expanded(
|
|
||||||
child: Center(
|
|
||||||
child: Text("Composant calendrier à intégrer ici"),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
const SizedBox(width: 16),
|
|
||||||
|
|
||||||
// 💬 Messagerie
|
|
||||||
Expanded(
|
|
||||||
flex: 1,
|
|
||||||
child: MessagingSidebar(
|
|
||||||
conversations: [],
|
|
||||||
notifications: [],
|
|
||||||
isCompact: false,
|
|
||||||
isMobile: false,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user