|
|
|
@ -49,6 +49,8 @@ class _PointagePageState extends State<PointagePage> { |
|
|
|
child: Text('Ajouter'), |
|
|
|
onPressed: () async { |
|
|
|
final pointage = Pointage( |
|
|
|
userName: |
|
|
|
"Nom de l'utilisateur", // fixed value, customize if needed |
|
|
|
date: DateTime.now().toString().split(' ')[0], |
|
|
|
heureArrivee: _arrivalController.text, |
|
|
|
heureDepart: '', |
|
|
|
@ -64,6 +66,15 @@ class _PointagePageState extends State<PointagePage> { |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
void _scanQRCode({required bool isEntree}) { |
|
|
|
// Ici tu peux intégrer ton scanner QR. |
|
|
|
ScaffoldMessenger.of(context).showSnackBar( |
|
|
|
SnackBar( |
|
|
|
content: Text(isEntree ? "Scan QR pour Entrée" : "Scan QR pour Sortie"), |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
@override |
|
|
|
Widget build(BuildContext context) { |
|
|
|
return Scaffold( |
|
|
|
@ -86,19 +97,36 @@ class _PointagePageState extends State<PointagePage> { |
|
|
|
), |
|
|
|
elevation: 4, |
|
|
|
shadowColor: Colors.blueGrey.shade50, |
|
|
|
child: ListTile( |
|
|
|
leading: CircleAvatar( |
|
|
|
child: Padding( |
|
|
|
padding: const EdgeInsets.symmetric( |
|
|
|
horizontal: 8.0, vertical: 4), |
|
|
|
child: Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: [ |
|
|
|
Row( |
|
|
|
children: [ |
|
|
|
CircleAvatar( |
|
|
|
backgroundColor: Colors.blue.shade100, |
|
|
|
child: Icon(Icons.calendar_today, color: Colors.blue), |
|
|
|
child: Icon(Icons.person, color: Colors.blue), |
|
|
|
), |
|
|
|
const SizedBox(width: 10), |
|
|
|
Expanded( |
|
|
|
child: Text( |
|
|
|
pointage |
|
|
|
.userName, // suppose non-null (corrige si null possible) |
|
|
|
style: TextStyle( |
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
fontSize: 18), |
|
|
|
), |
|
|
|
), |
|
|
|
title: Text( |
|
|
|
], |
|
|
|
), |
|
|
|
Divider(), |
|
|
|
Text( |
|
|
|
pointage.date, |
|
|
|
style: TextStyle(fontWeight: FontWeight.bold), |
|
|
|
style: const TextStyle( |
|
|
|
color: Colors.black87, fontSize: 15), |
|
|
|
), |
|
|
|
subtitle: Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: [ |
|
|
|
const SizedBox(height: 4), |
|
|
|
Row( |
|
|
|
children: [ |
|
|
|
Icon(Icons.login, |
|
|
|
@ -119,18 +147,43 @@ class _PointagePageState extends State<PointagePage> { |
|
|
|
style: TextStyle(color: Colors.red.shade700)), |
|
|
|
], |
|
|
|
), |
|
|
|
const SizedBox(height: 6), |
|
|
|
], |
|
|
|
), |
|
|
|
isThreeLine: true, |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
}, |
|
|
|
), |
|
|
|
floatingActionButton: FloatingActionButton( |
|
|
|
floatingActionButton: Column( |
|
|
|
mainAxisAlignment: MainAxisAlignment.end, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.end, |
|
|
|
children: [ |
|
|
|
FloatingActionButton.extended( |
|
|
|
onPressed: () => _scanQRCode(isEntree: true), |
|
|
|
label: Text('Entrée'), |
|
|
|
icon: Icon(Icons.qr_code_scanner, color: Colors.green), |
|
|
|
backgroundColor: Colors.white, |
|
|
|
foregroundColor: Colors.green, |
|
|
|
heroTag: 'btnEntree', |
|
|
|
), |
|
|
|
SizedBox(height: 12), |
|
|
|
FloatingActionButton.extended( |
|
|
|
onPressed: () => _scanQRCode(isEntree: false), |
|
|
|
label: Text('Sortie'), |
|
|
|
icon: Icon(Icons.qr_code_scanner, color: Colors.red), |
|
|
|
backgroundColor: Colors.white, |
|
|
|
foregroundColor: Colors.red, |
|
|
|
heroTag: 'btnSortie', |
|
|
|
), |
|
|
|
SizedBox(height: 12), |
|
|
|
FloatingActionButton( |
|
|
|
onPressed: _showAddDialog, |
|
|
|
tooltip: 'Ajouter Pointage', |
|
|
|
child: const Icon(Icons.add), |
|
|
|
heroTag: 'btnAdd', |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|