TF-2042 Add event attendees information widget
(cherry picked from commit 5ee6fcebb2d35352d55fa84a70020d4c2ad03924)
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
|
||||||
|
import 'package:collection/collection.dart';
|
||||||
|
import 'package:jmap_dart_client/jmap/mail/calendar/properties/attendee/calendar_attendee.dart';
|
||||||
|
import 'package:jmap_dart_client/jmap/mail/calendar/properties/calendar_organizer.dart';
|
||||||
|
|
||||||
|
extension ListAttendeeExtension on List<CalendarAttendee> {
|
||||||
|
|
||||||
|
String get mailtoAsString {
|
||||||
|
return map((attendee) => attendee.mailto?.mailAddress.value)
|
||||||
|
.whereNotNull()
|
||||||
|
.join(', ');
|
||||||
|
}
|
||||||
|
|
||||||
|
List<CalendarAttendee> withoutOrganizer(CalendarOrganizer organizer) {
|
||||||
|
return where((attendee) => attendee.mailto?.mailAddress != organizer.mailto)
|
||||||
|
.whereNotNull()
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
class EventAttendeeInformationWidgetStyles {
|
||||||
|
static const double maxWidth = 100;
|
||||||
|
static const double textSize = 16;
|
||||||
|
}
|
||||||
+61
@@ -0,0 +1,61 @@
|
|||||||
|
|
||||||
|
import 'package:core/presentation/extensions/color_extension.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:jmap_dart_client/jmap/mail/calendar/properties/attendee/calendar_attendee.dart';
|
||||||
|
import 'package:jmap_dart_client/jmap/mail/calendar/properties/calendar_organizer.dart';
|
||||||
|
import 'package:tmail_ui_user/features/email/presentation/extensions/list_attendee_extension.dart';
|
||||||
|
import 'package:tmail_ui_user/features/email/presentation/styles/event_attendee_information_widget_styles.dart';
|
||||||
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||||
|
|
||||||
|
class EventAttendeeInformationWidget extends StatelessWidget {
|
||||||
|
|
||||||
|
final List<CalendarAttendee> attendees;
|
||||||
|
final CalendarOrganizer organizer;
|
||||||
|
|
||||||
|
const EventAttendeeInformationWidget({
|
||||||
|
super.key,
|
||||||
|
required this.attendees,
|
||||||
|
required this.organizer
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: EventAttendeeInformationWidgetStyles.maxWidth,
|
||||||
|
child: Text(
|
||||||
|
AppLocalizations.of(context).who,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: EventAttendeeInformationWidgetStyles.textSize,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: AppColor.colorSubTitleEventActionText
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(child: RichText(
|
||||||
|
text: TextSpan(
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: EventAttendeeInformationWidgetStyles.textSize,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Colors.black
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
TextSpan(
|
||||||
|
text: '${organizer.mailto?.value} (${AppLocalizations.of(context).organizer})',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: AppColor.colorOrganizerMailto,
|
||||||
|
fontSize: EventAttendeeInformationWidgetStyles.textSize,
|
||||||
|
fontWeight: FontWeight.w500
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const TextSpan(text: ', '),
|
||||||
|
TextSpan(text: attendees.withoutOrganizer(organizer).mailtoAsString)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
))
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user