@@ -25,30 +25,34 @@ import 'package:tmail_ui_user/main/utils/app_utils.dart';
2525
2626extension CalendarEventExtension on CalendarEvent {
2727
28- Color getColorEventActionBanner (List <String > listEmailAddressSender) {
28+ static const String acceptedParticipationStatus = 'ACCEPTED' ;
29+ static const String tentativeParticipationStatus = 'TENTATIVE' ;
30+ static const String declinedParticipationStatus = 'DECLINED' ;
31+
32+ Color ? getColorEventActionBanner (List <String > listEmailAddressSender) {
2933 switch (method) {
3034 case EventMethod .request:
3135 case EventMethod .add:
32- return AppColor .colorInvitedEventActionText ;
36+ return AppColor .colorInvitedEventActionBanner ;
3337 case EventMethod .refresh:
3438 case EventMethod .counter:
35- return AppColor .colorUpdatedEventActionText ;
39+ return AppColor .colorUpdatedEventActionBanner ;
3640 case EventMethod .cancel:
3741 case EventMethod .declineCounter:
38- return AppColor .colorCanceledEventActionText ;
42+ return AppColor .colorCanceledEventActionBanner ;
3943 case EventMethod .reply:
4044 final matchedAttendee = findAttendeeHasUpdatedStatus (listEmailAddressSender);
4145 if (matchedAttendee != null ) {
42- return getAttendeeMessageTextColor (matchedAttendee.participationStatus);
46+ return getAttendeeMessageBannerColor (matchedAttendee.participationStatus);
4347 } else {
44- return Colors .transparent ;
48+ return null ;
4549 }
4650 default :
47- return Colors .transparent ;
51+ return null ;
4852 }
4953 }
5054
51- Color getColorEventActionText (List <String > listEmailAddressSender) {
55+ Color ? getColorEventActionText (List <String > listEmailAddressSender) {
5256 switch (method) {
5357 case EventMethod .request:
5458 case EventMethod .add:
@@ -64,10 +68,10 @@ extension CalendarEventExtension on CalendarEvent {
6468 if (matchedAttendee != null ) {
6569 return getAttendeeMessageTextColor (matchedAttendee.participationStatus);
6670 } else {
67- return Colors .transparent ;
71+ return null ;
6872 }
6973 default :
70- return Colors .transparent ;
74+ return null ;
7175 }
7276 }
7377
@@ -155,26 +159,38 @@ extension CalendarEventExtension on CalendarEvent {
155159 }
156160
157161 String getAttendeeMessageStatus (BuildContext context, CalendarAttendeeParticipationStatus ? status) {
158- if (status == CalendarAttendeeParticipationStatus ('ACCEPTED' )) {
162+ if (status == CalendarAttendeeParticipationStatus (acceptedParticipationStatus )) {
159163 return AppLocalizations .of (context).messageEventActionBannerAttendeeAccepted;
160- } else if (status == CalendarAttendeeParticipationStatus ('TENTATIVE' )) {
164+ } else if (status == CalendarAttendeeParticipationStatus (tentativeParticipationStatus )) {
161165 return AppLocalizations .of (context).messageEventActionBannerAttendeeTentative;
162- } else if (status == CalendarAttendeeParticipationStatus ('DECLINED' )) {
166+ } else if (status == CalendarAttendeeParticipationStatus (declinedParticipationStatus )) {
163167 return AppLocalizations .of (context).messageEventActionBannerAttendeeDeclined;
164168 } else {
165169 return '' ;
166170 }
167171 }
168172
169- Color getAttendeeMessageTextColor (CalendarAttendeeParticipationStatus ? status) {
170- if (status == CalendarAttendeeParticipationStatus ('ACCEPTED' )) {
173+ Color ? getAttendeeMessageBannerColor (CalendarAttendeeParticipationStatus ? status) {
174+ if (status == CalendarAttendeeParticipationStatus (acceptedParticipationStatus)) {
175+ return AppColor .colorUpdatedEventActionBanner;
176+ } else if (status == CalendarAttendeeParticipationStatus (tentativeParticipationStatus)) {
177+ return AppColor .colorMaybeEventActionBanner;
178+ } else if (status == CalendarAttendeeParticipationStatus (declinedParticipationStatus)) {
179+ return AppColor .colorCanceledEventActionBanner;
180+ } else {
181+ return null ;
182+ }
183+ }
184+
185+ Color ? getAttendeeMessageTextColor (CalendarAttendeeParticipationStatus ? status) {
186+ if (status == CalendarAttendeeParticipationStatus (acceptedParticipationStatus)) {
171187 return AppColor .colorUpdatedEventActionText;
172- } else if (status == CalendarAttendeeParticipationStatus ('TENTATIVE' )) {
188+ } else if (status == CalendarAttendeeParticipationStatus (tentativeParticipationStatus )) {
173189 return AppColor .colorMaybeEventActionText;
174- } else if (status == CalendarAttendeeParticipationStatus ('DECLINED' )) {
190+ } else if (status == CalendarAttendeeParticipationStatus (declinedParticipationStatus )) {
175191 return AppColor .colorCanceledEventActionText;
176192 } else {
177- return Colors .transparent ;
193+ return null ;
178194 }
179195 }
180196
0 commit comments