diff --git a/lib/features/email/presentation/email_view.dart b/lib/features/email/presentation/email_view.dart index 507ac40c6c..3f111a6209 100644 --- a/lib/features/email/presentation/email_view.dart +++ b/lib/features/email/presentation/email_view.dart @@ -361,6 +361,7 @@ class EmailView extends GetWidget { calendarEventReplying: controller.calendarEventProcessing, presentationEmail: controller.currentEmail, onMailtoAttendeesAction: controller.handleMailToAttendees, + openEmailAddressDetailAction: controller.openEmailAddressDialog, )), if (_validateDisplayEventActionBanner( context: context, diff --git a/lib/features/email/presentation/extensions/calendar_attendee_extension.dart b/lib/features/email/presentation/extensions/calendar_attendee_extension.dart new file mode 100644 index 0000000000..8233445363 --- /dev/null +++ b/lib/features/email/presentation/extensions/calendar_attendee_extension.dart @@ -0,0 +1,12 @@ + +import 'package:jmap_dart_client/jmap/mail/calendar/properties/attendee/calendar_attendee.dart'; +import 'package:jmap_dart_client/jmap/mail/email/email_address.dart'; + +extension CalendarAttendeeExtension on CalendarAttendee { + EmailAddress toEmailAddress() { + return EmailAddress( + name?.name, + mailto?.mailAddress.value, + ); + } +} \ No newline at end of file diff --git a/lib/features/email/presentation/extensions/calendar_organier_extension.dart b/lib/features/email/presentation/extensions/calendar_organier_extension.dart new file mode 100644 index 0000000000..6b567f50dc --- /dev/null +++ b/lib/features/email/presentation/extensions/calendar_organier_extension.dart @@ -0,0 +1,11 @@ + +import 'package:jmap_dart_client/jmap/mail/calendar/properties/calendar_organizer.dart'; +import 'package:jmap_dart_client/jmap/mail/email/email_address.dart'; + +extension CalendarOrganierExtension on CalendarOrganizer { + EmailAddress toEmailAddress() { + return EmailAddress( + name, mailto?.value, + ); + } +} \ No newline at end of file diff --git a/lib/features/email/presentation/widgets/calendar_event/attendee_widget.dart b/lib/features/email/presentation/widgets/calendar_event/attendee_widget.dart index 8834905b8a..8c5af940f1 100644 --- a/lib/features/email/presentation/widgets/calendar_event/attendee_widget.dart +++ b/lib/features/email/presentation/widgets/calendar_event/attendee_widget.dart @@ -1,17 +1,22 @@ +import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:jmap_dart_client/jmap/mail/calendar/properties/attendee/calendar_attendee.dart'; +import 'package:tmail_ui_user/features/email/presentation/extensions/calendar_attendee_extension.dart'; import 'package:tmail_ui_user/features/email/presentation/styles/attendee_widget_styles.dart'; +import 'package:tmail_ui_user/features/email/presentation/widgets/email_sender_builder.dart'; class AttendeeWidget extends StatelessWidget { final CalendarAttendee attendee; final List listAttendees; + final OnOpenEmailAddressDetailAction? openEmailAddressDetailAction; const AttendeeWidget({ super.key, required this.attendee, required this.listAttendees, + this.openEmailAddressDetailAction, }); @override @@ -34,6 +39,7 @@ class AttendeeWidget extends StatelessWidget { fontSize: AttendeeWidgetStyles.textSize, fontWeight: FontWeight.w500 ), + recognizer: TapGestureRecognizer()..onTap = () => _onClickMailAddress(context) ), if (listAttendees.last != attendee) const TextSpan(text: ', '), @@ -41,4 +47,8 @@ class AttendeeWidget extends StatelessWidget { ) ); } + + void _onClickMailAddress(BuildContext context) { + openEmailAddressDetailAction?.call(context, attendee.toEmailAddress()); + } } \ No newline at end of file diff --git a/lib/features/email/presentation/widgets/calendar_event/calendar_event_information_widget.dart b/lib/features/email/presentation/widgets/calendar_event/calendar_event_information_widget.dart index df32490e6d..798a476208 100644 --- a/lib/features/email/presentation/widgets/calendar_event/calendar_event_information_widget.dart +++ b/lib/features/email/presentation/widgets/calendar_event/calendar_event_information_widget.dart @@ -15,6 +15,7 @@ import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event/event_location_information_widget.dart'; import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event/event_time_information_widget.dart'; import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event/event_title_widget.dart'; +import 'package:tmail_ui_user/features/email/presentation/widgets/email_sender_builder.dart'; import 'package:tmail_ui_user/main/localizations/app_localizations.dart'; import 'package:tmail_ui_user/main/utils/app_utils.dart'; @@ -30,6 +31,7 @@ class CalendarEventInformationWidget extends StatelessWidget { final bool calendarEventReplying; final PresentationEmail? presentationEmail; final OnMailtoAttendeesAction? onMailtoAttendeesAction; + final OnOpenEmailAddressDetailAction? openEmailAddressDetailAction; final _responsiveUtils = Get.find(); @@ -42,6 +44,7 @@ class CalendarEventInformationWidget extends StatelessWidget { this.onOpenComposerAction, this.presentationEmail, this.onMailtoAttendeesAction, + this.openEmailAddressDetailAction, }); @override @@ -130,6 +133,7 @@ class CalendarEventInformationWidget extends StatelessWidget { child: EventAttendeeDetailWidget( attendees: calendarEvent.participants ?? [], organizer: calendarEvent.organizer, + openEmailAddressDetailAction: openEmailAddressDetailAction, ), ), if (calendarEvent.isDisplayedEventReplyAction) @@ -215,6 +219,7 @@ class CalendarEventInformationWidget extends StatelessWidget { child: EventAttendeeDetailWidget( attendees: calendarEvent.participants ?? [], organizer: calendarEvent.organizer, + openEmailAddressDetailAction: openEmailAddressDetailAction, ), ), if (calendarEvent.isDisplayedEventReplyAction) diff --git a/lib/features/email/presentation/widgets/calendar_event/event_attendee_detail_widget.dart b/lib/features/email/presentation/widgets/calendar_event/event_attendee_detail_widget.dart index af963b92cd..3f59e08b32 100644 --- a/lib/features/email/presentation/widgets/calendar_event/event_attendee_detail_widget.dart +++ b/lib/features/email/presentation/widgets/calendar_event/event_attendee_detail_widget.dart @@ -9,6 +9,7 @@ import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event/hide_all_attendees_button_widget.dart'; import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event/organizer_widget.dart'; import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event/see_all_attendees_button_widget.dart'; +import 'package:tmail_ui_user/features/email/presentation/widgets/email_sender_builder.dart'; import 'package:tmail_ui_user/main/localizations/app_localizations.dart'; class EventAttendeeDetailWidget extends StatefulWidget { @@ -17,11 +18,13 @@ class EventAttendeeDetailWidget extends StatefulWidget { final List attendees; final CalendarOrganizer? organizer; + final OnOpenEmailAddressDetailAction? openEmailAddressDetailAction; const EventAttendeeDetailWidget({ super.key, required this.attendees, - required this.organizer + required this.organizer, + this.openEmailAddressDetailAction, }); @override @@ -61,10 +64,17 @@ class _EventAttendeeDetailWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ if (widget.organizer != null) - OrganizerWidget(organizer: widget.organizer!), + OrganizerWidget( + organizer: widget.organizer!, + openEmailAddressDetailAction: widget.openEmailAddressDetailAction + ), if (_attendeesDisplayed.isNotEmpty) ..._attendeesDisplayed - .map((attendee) => AttendeeWidget(attendee: attendee, listAttendees: _attendeesDisplayed)) + .map((attendee) => AttendeeWidget( + attendee: attendee, + listAttendees: _attendeesDisplayed, + openEmailAddressDetailAction: widget.openEmailAddressDetailAction + )) .toList(), if (!_isShowAllAttendee) Padding( diff --git a/lib/features/email/presentation/widgets/calendar_event/organizer_widget.dart b/lib/features/email/presentation/widgets/calendar_event/organizer_widget.dart index 6ed9f4ae5a..ec60abd918 100644 --- a/lib/features/email/presentation/widgets/calendar_event/organizer_widget.dart +++ b/lib/features/email/presentation/widgets/calendar_event/organizer_widget.dart @@ -1,16 +1,21 @@ +import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:jmap_dart_client/jmap/mail/calendar/properties/calendar_organizer.dart'; +import 'package:tmail_ui_user/features/email/presentation/extensions/calendar_organier_extension.dart'; import 'package:tmail_ui_user/features/email/presentation/styles/organizer_widget_styles.dart'; +import 'package:tmail_ui_user/features/email/presentation/widgets/email_sender_builder.dart'; import 'package:tmail_ui_user/main/localizations/app_localizations.dart'; class OrganizerWidget extends StatelessWidget { final CalendarOrganizer organizer; + final OnOpenEmailAddressDetailAction? openEmailAddressDetailAction; const OrganizerWidget({ super.key, - required this.organizer + required this.organizer, + this.openEmailAddressDetailAction, }); @override @@ -33,6 +38,7 @@ class OrganizerWidget extends StatelessWidget { fontSize: OrganizerWidgetStyles.textSize, fontWeight: FontWeight.w500 ), + recognizer: TapGestureRecognizer()..onTap = () => _onClickMailAddress(context) ), TextSpan(text: '(${AppLocalizations.of(context).organizer})'), const TextSpan(text: ', '), @@ -40,4 +46,8 @@ class OrganizerWidget extends StatelessWidget { ) ); } + + void _onClickMailAddress(BuildContext context) { + openEmailAddressDetailAction?.call(context, organizer.toEmailAddress()); + } } \ No newline at end of file