Skip to content

Commit 0e549c8

Browse files
dab246hoangdat
authored andcommitted
TF-3293 Fix blue bar cannot select action banner text
Signed-off-by: dab246 <tdvu@linagora.com>
1 parent 71903d2 commit 0e549c8

File tree

3 files changed

+58
-44
lines changed

3 files changed

+58
-44
lines changed

core/lib/presentation/extensions/color_extension.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,13 @@ extension AppColor on Color {
178178
static const colorCalendarEventRead = Color(0xFF818C99);
179179
static const colorCalendarEventUnread = Color(0xFF1C1B1F);
180180
static const colorMaybeEventActionText = Color(0xFFFFC107);
181+
static const colorMaybeEventActionBanner = Color(0xFFFFF5C2);
181182
static const colorInvitedEventActionText = Color(0xFF007AFF);
183+
static const colorInvitedEventActionBanner = Color(0xFFEBF4FF);
182184
static const colorUpdatedEventActionText = Color(0xFF4BB34B);
185+
static const colorUpdatedEventActionBanner = Color(0xFFECF8E5);
183186
static const colorCanceledEventActionText = Color(0xFFFF3347);
187+
static const colorCanceledEventActionBanner = Color(0xFFF5EBEB);
184188
static const colorSubTitleEventActionText = Color(0xFF939393);
185189
static const colorCalendarEventInformationBackground = Color(0x0A000000);
186190
static const colorCalendarEventInformationStroke = Color(0x1F000000);

lib/features/email/presentation/extensions/calendar_event_extension.dart

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,34 @@ import 'package:tmail_ui_user/main/utils/app_utils.dart';
2525

2626
extension 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

lib/features/email/presentation/widgets/calendar_event/calendar_event_action_banner_widget.dart

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class CalendarEventActionBannerWidget extends StatelessWidget {
2424
return Container(
2525
decoration: BoxDecoration(
2626
borderRadius: const BorderRadius.all(Radius.circular(CalendarEventActionBannerStyles.borderRadius)),
27-
color: calendarEvent.getColorEventActionBanner(listEmailAddressSender).withOpacity(0.12)
27+
color: calendarEvent.getColorEventActionBanner(listEmailAddressSender),
2828
),
2929
padding: const EdgeInsets.all(CalendarEventActionBannerStyles.contentPadding),
3030
margin: const EdgeInsets.symmetric(
@@ -44,35 +44,29 @@ class CalendarEventActionBannerWidget extends StatelessWidget {
4444
fit: BoxFit.fill,
4545
),
4646
),
47-
Expanded(child: Column(
48-
crossAxisAlignment: CrossAxisAlignment.start,
49-
mainAxisSize: MainAxisSize.min,
50-
children: [
51-
Text.rich(
47+
Expanded(child: Text.rich(
48+
TextSpan(
49+
style: TextStyle(
50+
fontSize: CalendarEventActionBannerStyles.titleTextSize,
51+
fontWeight: FontWeight.w400,
52+
color: calendarEvent.getColorEventActionText(listEmailAddressSender)
53+
),
54+
children: [
5255
TextSpan(
56+
text: calendarEvent.getUserNameEventAction(
57+
context: context,
58+
imagePaths: imagePaths,
59+
listEmailAddressSender: listEmailAddressSender
60+
),
5361
style: TextStyle(
62+
color: calendarEvent.getColorEventActionText(listEmailAddressSender),
5463
fontSize: CalendarEventActionBannerStyles.titleTextSize,
55-
fontWeight: FontWeight.w400,
56-
color: calendarEvent.getColorEventActionText(listEmailAddressSender)
64+
fontWeight: FontWeight.w700
5765
),
58-
children: [
59-
TextSpan(
60-
text: calendarEvent.getUserNameEventAction(
61-
context: context,
62-
imagePaths: imagePaths,
63-
listEmailAddressSender: listEmailAddressSender
64-
),
65-
style: TextStyle(
66-
color: calendarEvent.getColorEventActionText(listEmailAddressSender),
67-
fontSize: CalendarEventActionBannerStyles.titleTextSize,
68-
fontWeight: FontWeight.w700
69-
),
70-
),
71-
TextSpan(text: calendarEvent.getTitleEventAction(context, listEmailAddressSender))
72-
]
73-
)
74-
),
75-
]
66+
),
67+
TextSpan(text: calendarEvent.getTitleEventAction(context, listEmailAddressSender))
68+
]
69+
)
7670
))
7771
]
7872
),

0 commit comments

Comments
 (0)