diff --git a/core/lib/presentation/extensions/color_extension.dart b/core/lib/presentation/extensions/color_extension.dart index ca5e80620..a3a0113a8 100644 --- a/core/lib/presentation/extensions/color_extension.dart +++ b/core/lib/presentation/extensions/color_extension.dart @@ -178,9 +178,13 @@ extension AppColor on Color { static const colorCalendarEventRead = Color(0xFF818C99); static const colorCalendarEventUnread = Color(0xFF1C1B1F); static const colorMaybeEventActionText = Color(0xFFFFC107); + static const colorMaybeEventActionBanner = Color(0xFFFFF5C2); static const colorInvitedEventActionText = Color(0xFF007AFF); + static const colorInvitedEventActionBanner = Color(0xFFEBF4FF); static const colorUpdatedEventActionText = Color(0xFF4BB34B); + static const colorUpdatedEventActionBanner = Color(0xFFECF8E5); static const colorCanceledEventActionText = Color(0xFFFF3347); + static const colorCanceledEventActionBanner = Color(0xFFF5EBEB); static const colorSubTitleEventActionText = Color(0xFF939393); static const colorCalendarEventInformationBackground = Color(0x0A000000); static const colorCalendarEventInformationStroke = Color(0x1F000000); diff --git a/lib/features/email/presentation/extensions/calendar_event_extension.dart b/lib/features/email/presentation/extensions/calendar_event_extension.dart index f993c87cb..c058436af 100644 --- a/lib/features/email/presentation/extensions/calendar_event_extension.dart +++ b/lib/features/email/presentation/extensions/calendar_event_extension.dart @@ -25,30 +25,34 @@ import 'package:tmail_ui_user/main/utils/app_utils.dart'; extension CalendarEventExtension on CalendarEvent { - Color getColorEventActionBanner(List listEmailAddressSender) { + static const String acceptedParticipationStatus = 'ACCEPTED'; + static const String tentativeParticipationStatus = 'TENTATIVE'; + static const String declinedParticipationStatus = 'DECLINED'; + + Color? getColorEventActionBanner(List listEmailAddressSender) { switch(method) { case EventMethod.request: case EventMethod.add: - return AppColor.colorInvitedEventActionText; + return AppColor.colorInvitedEventActionBanner; case EventMethod.refresh: case EventMethod.counter: - return AppColor.colorUpdatedEventActionText; + return AppColor.colorUpdatedEventActionBanner; case EventMethod.cancel: case EventMethod.declineCounter: - return AppColor.colorCanceledEventActionText; + return AppColor.colorCanceledEventActionBanner; case EventMethod.reply: final matchedAttendee = findAttendeeHasUpdatedStatus(listEmailAddressSender); if (matchedAttendee != null) { - return getAttendeeMessageTextColor(matchedAttendee.participationStatus); + return getAttendeeMessageBannerColor(matchedAttendee.participationStatus); } else { - return Colors.transparent; + return null; } default: - return Colors.transparent; + return null; } } - Color getColorEventActionText(List listEmailAddressSender) { + Color? getColorEventActionText(List listEmailAddressSender) { switch(method) { case EventMethod.request: case EventMethod.add: @@ -64,10 +68,10 @@ extension CalendarEventExtension on CalendarEvent { if (matchedAttendee != null) { return getAttendeeMessageTextColor(matchedAttendee.participationStatus); } else { - return Colors.transparent; + return null; } default: - return Colors.transparent; + return null; } } @@ -155,26 +159,38 @@ extension CalendarEventExtension on CalendarEvent { } String getAttendeeMessageStatus(BuildContext context, CalendarAttendeeParticipationStatus? status) { - if (status == CalendarAttendeeParticipationStatus('ACCEPTED')) { + if (status == CalendarAttendeeParticipationStatus(acceptedParticipationStatus)) { return AppLocalizations.of(context).messageEventActionBannerAttendeeAccepted; - } else if (status == CalendarAttendeeParticipationStatus('TENTATIVE')) { + } else if (status == CalendarAttendeeParticipationStatus(tentativeParticipationStatus)) { return AppLocalizations.of(context).messageEventActionBannerAttendeeTentative; - } else if (status == CalendarAttendeeParticipationStatus('DECLINED')) { + } else if (status == CalendarAttendeeParticipationStatus(declinedParticipationStatus)) { return AppLocalizations.of(context).messageEventActionBannerAttendeeDeclined; } else { return ''; } } - Color getAttendeeMessageTextColor(CalendarAttendeeParticipationStatus? status) { - if (status == CalendarAttendeeParticipationStatus('ACCEPTED')) { + Color? getAttendeeMessageBannerColor(CalendarAttendeeParticipationStatus? status) { + if (status == CalendarAttendeeParticipationStatus(acceptedParticipationStatus)) { + return AppColor.colorUpdatedEventActionBanner; + } else if (status == CalendarAttendeeParticipationStatus(tentativeParticipationStatus)) { + return AppColor.colorMaybeEventActionBanner; + } else if (status == CalendarAttendeeParticipationStatus(declinedParticipationStatus)) { + return AppColor.colorCanceledEventActionBanner; + } else { + return null; + } + } + + Color? getAttendeeMessageTextColor(CalendarAttendeeParticipationStatus? status) { + if (status == CalendarAttendeeParticipationStatus(acceptedParticipationStatus)) { return AppColor.colorUpdatedEventActionText; - } else if (status == CalendarAttendeeParticipationStatus('TENTATIVE')) { + } else if (status == CalendarAttendeeParticipationStatus(tentativeParticipationStatus)) { return AppColor.colorMaybeEventActionText; - } else if (status == CalendarAttendeeParticipationStatus('DECLINED')) { + } else if (status == CalendarAttendeeParticipationStatus(declinedParticipationStatus)) { return AppColor.colorCanceledEventActionText; } else { - return Colors.transparent; + return null; } } diff --git a/lib/features/email/presentation/widgets/calendar_event/calendar_event_action_banner_widget.dart b/lib/features/email/presentation/widgets/calendar_event/calendar_event_action_banner_widget.dart index 7fe70559f..dc8477211 100644 --- a/lib/features/email/presentation/widgets/calendar_event/calendar_event_action_banner_widget.dart +++ b/lib/features/email/presentation/widgets/calendar_event/calendar_event_action_banner_widget.dart @@ -24,7 +24,7 @@ class CalendarEventActionBannerWidget extends StatelessWidget { return Container( decoration: BoxDecoration( borderRadius: const BorderRadius.all(Radius.circular(CalendarEventActionBannerStyles.borderRadius)), - color: calendarEvent.getColorEventActionBanner(listEmailAddressSender).withOpacity(0.12) + color: calendarEvent.getColorEventActionBanner(listEmailAddressSender), ), padding: const EdgeInsets.all(CalendarEventActionBannerStyles.contentPadding), margin: const EdgeInsets.symmetric( @@ -44,35 +44,29 @@ class CalendarEventActionBannerWidget extends StatelessWidget { fit: BoxFit.fill, ), ), - Expanded(child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text.rich( - TextSpan( - style: TextStyle( - fontSize: CalendarEventActionBannerStyles.titleTextSize, - fontWeight: FontWeight.w400, - color: calendarEvent.getColorEventActionText(listEmailAddressSender) - ), - children: [ - TextSpan( - text: calendarEvent.getUserNameEventAction( - context: context, - imagePaths: imagePaths, - listEmailAddressSender: listEmailAddressSender - ), - style: TextStyle( - color: calendarEvent.getColorEventActionText(listEmailAddressSender), - fontSize: CalendarEventActionBannerStyles.titleTextSize, - fontWeight: FontWeight.w700 - ), - ), - TextSpan(text: calendarEvent.getTitleEventAction(context, listEmailAddressSender)) - ] - ) + Expanded(child: Text.rich( + TextSpan( + style: TextStyle( + fontSize: CalendarEventActionBannerStyles.titleTextSize, + fontWeight: FontWeight.w400, + color: calendarEvent.getColorEventActionText(listEmailAddressSender) ), - ] + children: [ + TextSpan( + text: calendarEvent.getUserNameEventAction( + context: context, + imagePaths: imagePaths, + listEmailAddressSender: listEmailAddressSender + ), + style: TextStyle( + color: calendarEvent.getColorEventActionText(listEmailAddressSender), + fontSize: CalendarEventActionBannerStyles.titleTextSize, + fontWeight: FontWeight.w700 + ), + ), + TextSpan(text: calendarEvent.getTitleEventAction(context, listEmailAddressSender)) + ] + ) )) ] ),