feat(frontend): add return checklist screen with shared checklist widgets
This commit is contained in:
@@ -0,0 +1,173 @@
|
||||
import "package:flutter/material.dart";
|
||||
import "package:google_fonts/google_fonts.dart";
|
||||
import "../theme/ensup_colors.dart";
|
||||
import "../models/emprunt_item.dart";
|
||||
import "../widgets/ensup_top_bar.dart";
|
||||
import "../widgets/brand_corners.dart";
|
||||
import "../widgets/etat_checklist.dart";
|
||||
|
||||
/// Checklist de retour (RG16) : l'étudiant indique l'état de chaque accessoire
|
||||
/// au retour, en vue de la comparaison avec la checklist de départ.
|
||||
class ChecklistRetourScreen extends StatefulWidget {
|
||||
const ChecklistRetourScreen({super.key, required this.emprunt});
|
||||
|
||||
final EmpruntItem emprunt;
|
||||
|
||||
@override
|
||||
State<ChecklistRetourScreen> createState() => _ChecklistRetourScreenState();
|
||||
}
|
||||
|
||||
class _ChecklistRetourScreenState extends State<ChecklistRetourScreen> {
|
||||
late final List<EtatChecklist> _etats = List<EtatChecklist>.filled(
|
||||
widget.emprunt.materiel.accessoires.length,
|
||||
EtatChecklist.present,
|
||||
);
|
||||
|
||||
void _valider() {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text("Résultat de la restitution — écran à venir")),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: EnsupColors.soft,
|
||||
body: Stack(
|
||||
children: [
|
||||
Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 1280, maxHeight: 820),
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(24),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: EnsupColors.text.withValues(alpha: 0.14),
|
||||
blurRadius: 60,
|
||||
offset: const Offset(0, 18),
|
||||
),
|
||||
],
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: Column(
|
||||
children: [
|
||||
EnsupTopBar(
|
||||
brandText: "Checklist de retour",
|
||||
campusTag: "Paris · Ensitech",
|
||||
userName: "Lucas Martin",
|
||||
userInitials: "LM",
|
||||
onBack: () => Navigator.of(context).pop(),
|
||||
),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 28),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(flex: 3, child: _colonneGauche()),
|
||||
const SizedBox(width: 20),
|
||||
Expanded(flex: 2, child: _colonneDroite()),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const Positioned.fill(child: BrandCorners()),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _colonneGauche() {
|
||||
final materiel = widget.emprunt.materiel;
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
||||
decoration: BoxDecoration(
|
||||
color: EnsupColors.soft,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: EnsupColors.teal.withValues(alpha: 0.15), width: 1.5),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 38,
|
||||
height: 38,
|
||||
decoration: BoxDecoration(
|
||||
color: EnsupColors.teal.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(9),
|
||||
),
|
||||
child: Icon(materiel.icon, color: EnsupColors.teal, size: 18),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
materiel.nom,
|
||||
style: GoogleFonts.darkerGrotesque(fontWeight: FontWeight.w800, fontSize: 16),
|
||||
),
|
||||
Text(
|
||||
"Emprunté le ${widget.emprunt.dateEmprunt}",
|
||||
style: GoogleFonts.titilliumWeb(fontSize: 12, color: EnsupColors.muted),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
ChecklistTableau(
|
||||
accessoires: materiel.accessoires,
|
||||
etats: _etats,
|
||||
onChanged: (index, etat) => setState(() => _etats[index] = etat),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _colonneDroite() {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const ChecklistInstructions(
|
||||
titre: "Rappel checklist de départ",
|
||||
texte:
|
||||
"Au départ, tous les accessoires du kit étaient présents. "
|
||||
"Indiquez leur état au retour ; toute différence sera signalée.",
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
const ChecklistCommentaire(hint: "Commentaire optionnel..."),
|
||||
const SizedBox(height: 14),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: FilledButton.icon(
|
||||
onPressed: _valider,
|
||||
icon: const Icon(Icons.check, size: 18),
|
||||
label: Text(
|
||||
"Valider le retour",
|
||||
style: GoogleFonts.darkerGrotesque(fontWeight: FontWeight.w700, fontSize: 16),
|
||||
),
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: EnsupColors.blue3,
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user