TF-3293 Fix blue bar cannot select action banner text

Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
dab246
2025-02-19 11:32:25 +07:00
committed by Dat H. Pham
parent 71903d270f
commit 0e549c830a
3 changed files with 61 additions and 47 deletions
@@ -178,9 +178,13 @@ extension AppColor on Color {
static const colorCalendarEventRead = Color(0xFF818C99); static const colorCalendarEventRead = Color(0xFF818C99);
static const colorCalendarEventUnread = Color(0xFF1C1B1F); static const colorCalendarEventUnread = Color(0xFF1C1B1F);
static const colorMaybeEventActionText = Color(0xFFFFC107); static const colorMaybeEventActionText = Color(0xFFFFC107);
static const colorMaybeEventActionBanner = Color(0xFFFFF5C2);
static const colorInvitedEventActionText = Color(0xFF007AFF); static const colorInvitedEventActionText = Color(0xFF007AFF);
static const colorInvitedEventActionBanner = Color(0xFFEBF4FF);
static const colorUpdatedEventActionText = Color(0xFF4BB34B); static const colorUpdatedEventActionText = Color(0xFF4BB34B);
static const colorUpdatedEventActionBanner = Color(0xFFECF8E5);
static const colorCanceledEventActionText = Color(0xFFFF3347); static const colorCanceledEventActionText = Color(0xFFFF3347);
static const colorCanceledEventActionBanner = Color(0xFFF5EBEB);
static const colorSubTitleEventActionText = Color(0xFF939393); static const colorSubTitleEventActionText = Color(0xFF939393);
static const colorCalendarEventInformationBackground = Color(0x0A000000); static const colorCalendarEventInformationBackground = Color(0x0A000000);
static const colorCalendarEventInformationStroke = Color(0x1F000000); static const colorCalendarEventInformationStroke = Color(0x1F000000);
@@ -25,30 +25,34 @@ import 'package:tmail_ui_user/main/utils/app_utils.dart';
extension CalendarEventExtension on CalendarEvent { extension CalendarEventExtension on CalendarEvent {
Color getColorEventActionBanner(List<String> listEmailAddressSender) { static const String acceptedParticipationStatus = 'ACCEPTED';
static const String tentativeParticipationStatus = 'TENTATIVE';
static const String declinedParticipationStatus = 'DECLINED';
Color? getColorEventActionBanner(List<String> listEmailAddressSender) {
switch(method) { switch(method) {
case EventMethod.request: case EventMethod.request:
case EventMethod.add: case EventMethod.add:
return AppColor.colorInvitedEventActionText; return AppColor.colorInvitedEventActionBanner;
case EventMethod.refresh: case EventMethod.refresh:
case EventMethod.counter: case EventMethod.counter:
return AppColor.colorUpdatedEventActionText; return AppColor.colorUpdatedEventActionBanner;
case EventMethod.cancel: case EventMethod.cancel:
case EventMethod.declineCounter: case EventMethod.declineCounter:
return AppColor.colorCanceledEventActionText; return AppColor.colorCanceledEventActionBanner;
case EventMethod.reply: case EventMethod.reply:
final matchedAttendee = findAttendeeHasUpdatedStatus(listEmailAddressSender); final matchedAttendee = findAttendeeHasUpdatedStatus(listEmailAddressSender);
if (matchedAttendee != null) { if (matchedAttendee != null) {
return getAttendeeMessageTextColor(matchedAttendee.participationStatus); return getAttendeeMessageBannerColor(matchedAttendee.participationStatus);
} else { } else {
return Colors.transparent; return null;
} }
default: default:
return Colors.transparent; return null;
} }
} }
Color getColorEventActionText(List<String> listEmailAddressSender) { Color? getColorEventActionText(List<String> listEmailAddressSender) {
switch(method) { switch(method) {
case EventMethod.request: case EventMethod.request:
case EventMethod.add: case EventMethod.add:
@@ -64,10 +68,10 @@ extension CalendarEventExtension on CalendarEvent {
if (matchedAttendee != null) { if (matchedAttendee != null) {
return getAttendeeMessageTextColor(matchedAttendee.participationStatus); return getAttendeeMessageTextColor(matchedAttendee.participationStatus);
} else { } else {
return Colors.transparent; return null;
} }
default: default:
return Colors.transparent; return null;
} }
} }
@@ -155,26 +159,38 @@ extension CalendarEventExtension on CalendarEvent {
} }
String getAttendeeMessageStatus(BuildContext context, CalendarAttendeeParticipationStatus? status) { String getAttendeeMessageStatus(BuildContext context, CalendarAttendeeParticipationStatus? status) {
if (status == CalendarAttendeeParticipationStatus('ACCEPTED')) { if (status == CalendarAttendeeParticipationStatus(acceptedParticipationStatus)) {
return AppLocalizations.of(context).messageEventActionBannerAttendeeAccepted; return AppLocalizations.of(context).messageEventActionBannerAttendeeAccepted;
} else if (status == CalendarAttendeeParticipationStatus('TENTATIVE')) { } else if (status == CalendarAttendeeParticipationStatus(tentativeParticipationStatus)) {
return AppLocalizations.of(context).messageEventActionBannerAttendeeTentative; return AppLocalizations.of(context).messageEventActionBannerAttendeeTentative;
} else if (status == CalendarAttendeeParticipationStatus('DECLINED')) { } else if (status == CalendarAttendeeParticipationStatus(declinedParticipationStatus)) {
return AppLocalizations.of(context).messageEventActionBannerAttendeeDeclined; return AppLocalizations.of(context).messageEventActionBannerAttendeeDeclined;
} else { } else {
return ''; return '';
} }
} }
Color getAttendeeMessageTextColor(CalendarAttendeeParticipationStatus? status) { Color? getAttendeeMessageBannerColor(CalendarAttendeeParticipationStatus? status) {
if (status == CalendarAttendeeParticipationStatus('ACCEPTED')) { 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; return AppColor.colorUpdatedEventActionText;
} else if (status == CalendarAttendeeParticipationStatus('TENTATIVE')) { } else if (status == CalendarAttendeeParticipationStatus(tentativeParticipationStatus)) {
return AppColor.colorMaybeEventActionText; return AppColor.colorMaybeEventActionText;
} else if (status == CalendarAttendeeParticipationStatus('DECLINED')) { } else if (status == CalendarAttendeeParticipationStatus(declinedParticipationStatus)) {
return AppColor.colorCanceledEventActionText; return AppColor.colorCanceledEventActionText;
} else { } else {
return Colors.transparent; return null;
} }
} }
@@ -24,7 +24,7 @@ class CalendarEventActionBannerWidget extends StatelessWidget {
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(CalendarEventActionBannerStyles.borderRadius)), 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), padding: const EdgeInsets.all(CalendarEventActionBannerStyles.contentPadding),
margin: const EdgeInsets.symmetric( margin: const EdgeInsets.symmetric(
@@ -44,35 +44,29 @@ class CalendarEventActionBannerWidget extends StatelessWidget {
fit: BoxFit.fill, fit: BoxFit.fill,
), ),
), ),
Expanded(child: Column( Expanded(child: Text.rich(
crossAxisAlignment: CrossAxisAlignment.start, TextSpan(
mainAxisSize: MainAxisSize.min, style: TextStyle(
children: [ fontSize: CalendarEventActionBannerStyles.titleTextSize,
Text.rich( fontWeight: FontWeight.w400,
TextSpan( color: calendarEvent.getColorEventActionText(listEmailAddressSender)
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))
]
)
), ),
] 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))
]
)
)) ))
] ]
), ),