ticket form funzionante! devo ancora provare a salvare però

This commit is contained in:
2026-05-06 20:40:02 +02:00
parent 040db4ad79
commit c6321d6580
12 changed files with 97 additions and 23 deletions

View File

@@ -22,6 +22,7 @@ class StaffSection extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
// Se staffId è nullo, proviamo a preselezionare l'utente loggato
final selectedStaffId =
staffId ?? GetIt.I.get<SessionCubit>().state.currentStaffMember?.id;
@@ -31,7 +32,8 @@ class StaffSection extends StatelessWidget {
Padding(
padding: const EdgeInsets.only(bottom: 12.0),
child: Text(
'Operatore',
label ??
'Operatore', // <-- FIX: Ora usa l'etichetta passata dal form!
style: theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.bold,
),
@@ -39,8 +41,28 @@ class StaffSection extends StatelessWidget {
),
BlocBuilder<StaffCubit, StaffState>(
builder: (context, state) {
// Dati finti per farti vedere la UI, piallali quando attacchi il BlocBuilder!
// FIX: Aggiunto un controllo se sta caricando
if (state.status == StaffStatus.loading) {
return const Padding(
padding: EdgeInsets.symmetric(vertical: 8.0),
child: SizedBox(
height: 24,
width: 24,
child: CircularProgressIndicator(strokeWidth: 2),
),
);
}
final staffMembers = state.storeStaff;
// FIX: Feedback visivo se la lista è vuota
if (staffMembers.isEmpty) {
return const Text(
'Nessun operatore caricato. Controlla il Cubit!',
style: TextStyle(color: Colors.red),
);
}
final currentLoggedStaffMember = GetIt.I
.get<SessionCubit>()
.state
@@ -55,11 +77,6 @@ class StaffSection extends StatelessWidget {
return GestureDetector(
onTap: () {
onStaffSelected(staff);
/* context.read<OperationsCubit>().updateOperationFields(
staffId: staff.id,
staffDisplayName: staff.name,
); */
},
child: AnimatedContainer(
duration: const Duration(milliseconds: 200),