@@ -55,6 +55,9 @@ class CellOpenedIconChips extends ConsumerWidget {
5555 final bool absentOrUndeclared =
5656 status == StatusEnum .undeclared || status == StatusEnum .absence;
5757
58+ final bool isUserIsInAfternoonTeamAndNotAbsent =
59+ isUserIsInAfternoonTeam && statusAfternoon != StatusEnum .absence;
60+
5861 return Column (
5962 mainAxisSize: MainAxisSize .min,
6063 children: [
@@ -105,7 +108,8 @@ class CellOpenedIconChips extends ConsumerWidget {
105108 Row (
106109 mainAxisAlignment: MainAxisAlignment .start,
107110 children: [
108- if (isUserIsInAfternoonTeam) ...[
111+ // do not display team chip if the user is not in the afternoon team or if he is absent
112+ if (isUserIsInAfternoonTeamAndNotAbsent) ...[
109113 IconChip (
110114 label: teamNameAfternoon! ,
111115 backgroundColor: AppColors .cellChipDefault,
@@ -121,8 +125,14 @@ class CellOpenedIconChips extends ConsumerWidget {
121125 ),
122126 const SizedBox (
123127 width: 4 ,
128+ height: 8 ,
124129 ),
125- const SizedBox (height: 8 ),
130+ ],
131+ // no need to display this chip if the user neither is into the morning team (only one unavailable chip is enough for the day)
132+ if (! isUserIsInAfternoonTeam && isUserIsInTeam)
133+ const UnavailableIconChip (),
134+
135+ if (isUserIsInAfternoonTeam || absentOrUndeclared)
126136 IconChip (
127137 label: tr (statusAfternoon! .name),
128138 backgroundColor: setStatusColor (statusAfternoon! ),
@@ -134,10 +144,6 @@ class CellOpenedIconChips extends ConsumerWidget {
134144 ),
135145 ),
136146 ),
137- ],
138- // no need to display this chip if the user neither is into the morning team (only one unavailable chip is enough for the day)
139- if (! isUserIsInAfternoonTeam && isUserIsInTeam)
140- const UnavailableIconChip (),
141147 ],
142148 ),
143149 ],
0 commit comments