TF-2042 Display calendar event information widget
(cherry picked from commit d804b98c5904d014b8bec031cc08614af84c4a42)
This commit is contained in:
@@ -28,8 +28,8 @@ import 'package:tmail_ui_user/features/email/presentation/styles/email_view_styl
|
|||||||
import 'package:tmail_ui_user/features/email/presentation/widgets/app_bar_mail_widget_builder.dart';
|
import 'package:tmail_ui_user/features/email/presentation/widgets/app_bar_mail_widget_builder.dart';
|
||||||
import 'package:tmail_ui_user/features/email/presentation/widgets/attachment_file_tile_builder.dart';
|
import 'package:tmail_ui_user/features/email/presentation/widgets/attachment_file_tile_builder.dart';
|
||||||
import 'package:tmail_ui_user/features/email/presentation/widgets/bottom_bar_mail_widget_builder.dart';
|
import 'package:tmail_ui_user/features/email/presentation/widgets/bottom_bar_mail_widget_builder.dart';
|
||||||
import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event_action_banner_widget.dart';
|
import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event/calendar_event_action_banner_widget.dart';
|
||||||
import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event_information_widget.dart';
|
import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event/calendar_event_information_widget.dart';
|
||||||
import 'package:tmail_ui_user/features/email/presentation/widgets/email_action_cupertino_action_sheet_action_builder.dart';
|
import 'package:tmail_ui_user/features/email/presentation/widgets/email_action_cupertino_action_sheet_action_builder.dart';
|
||||||
import 'package:tmail_ui_user/features/email/presentation/widgets/information_sender_and_receiver_builder.dart';
|
import 'package:tmail_ui_user/features/email/presentation/widgets/information_sender_and_receiver_builder.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/vacation_response_extension.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/vacation_response_extension.dart';
|
||||||
|
|||||||
@@ -7,4 +7,5 @@ class CalendarIconWidgetStyles {
|
|||||||
static const double bodyDayTextSize = 40;
|
static const double bodyDayTextSize = 40;
|
||||||
static const double bodyWeekDayTextSize = 14;
|
static const double bodyWeekDayTextSize = 14;
|
||||||
static const double bodyContentPadding = 8;
|
static const double bodyContentPadding = 8;
|
||||||
|
static const double margin = 16;
|
||||||
}
|
}
|
||||||
@@ -9,4 +9,9 @@ class CalendarEventInformationWidgetStyles {
|
|||||||
static const double horizontalMargin = 16;
|
static const double horizontalMargin = 16;
|
||||||
static const double calendarDateIconMargin = 16;
|
static const double calendarDateIconMargin = 16;
|
||||||
static const Color calendarDateIconBackgroundColor = AppColor.colorCalendarEventInformationBackground;
|
static const Color calendarDateIconBackgroundColor = AppColor.colorCalendarEventInformationBackground;
|
||||||
|
static const double calendarInformationMargin = 16;
|
||||||
|
static const double invitationMessageTextSize = 16;
|
||||||
|
static const double titleTextSize = 24;
|
||||||
|
static const double fieldTopPadding = 16;
|
||||||
|
static const double space = 8;
|
||||||
}
|
}
|
||||||
+1
@@ -21,6 +21,7 @@ class CalendarDateIconWidget extends StatelessWidget {
|
|||||||
return Container(
|
return Container(
|
||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
width: width,
|
width: width,
|
||||||
|
margin: const EdgeInsets.all(CalendarIconWidgetStyles.margin),
|
||||||
decoration: const ShapeDecoration(
|
decoration: const ShapeDecoration(
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(CalendarIconWidgetStyles.borderRadius))),
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(CalendarIconWidgetStyles.borderRadius))),
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
+1
-4
@@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
import 'package:core/presentation/extensions/color_extension.dart';
|
import 'package:core/presentation/extensions/color_extension.dart';
|
||||||
import 'package:core/presentation/resources/image_paths.dart';
|
import 'package:core/presentation/resources/image_paths.dart';
|
||||||
import 'package:core/utils/app_logger.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@@ -94,9 +93,7 @@ class CalendarEventActionBannerWidget extends StatelessWidget {
|
|||||||
|
|
||||||
String _getSenderEmailAddress() {
|
String _getSenderEmailAddress() {
|
||||||
if (listFromEmailAddress?.isNotEmpty == true) {
|
if (listFromEmailAddress?.isNotEmpty == true) {
|
||||||
final senderEmailAddress = listFromEmailAddress!.first.emailAddress;
|
return listFromEmailAddress!.first.emailAddress;
|
||||||
log('CalendarEventActionBannerWidget::getSenderEmailAddress: $senderEmailAddress');
|
|
||||||
return senderEmailAddress;
|
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
+189
@@ -0,0 +1,189 @@
|
|||||||
|
|
||||||
|
import 'package:core/presentation/extensions/color_extension.dart';
|
||||||
|
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:jmap_dart_client/jmap/mail/calendar/calendar_event.dart';
|
||||||
|
import 'package:tmail_ui_user/features/email/presentation/extensions/calendar_event_extension.dart';
|
||||||
|
import 'package:tmail_ui_user/features/email/presentation/styles/calendar_event_information_widget_styles.dart';
|
||||||
|
import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event/event_attendee_information_widget.dart';
|
||||||
|
import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event/calendar_date_icon_widget.dart';
|
||||||
|
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/main/localizations/app_localizations.dart';
|
||||||
|
|
||||||
|
class CalendarEventInformationWidget extends StatelessWidget {
|
||||||
|
|
||||||
|
final CalendarEvent calendarEvent;
|
||||||
|
|
||||||
|
const CalendarEventInformationWidget({
|
||||||
|
super.key,
|
||||||
|
required this.calendarEvent
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final responsiveUtils = Get.find<ResponsiveUtils>();
|
||||||
|
return Container(
|
||||||
|
clipBehavior: Clip.antiAlias,
|
||||||
|
decoration: const ShapeDecoration(
|
||||||
|
color: AppColor.colorCalendarEventInformationBackground,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
side: BorderSide(
|
||||||
|
width: 0.5,
|
||||||
|
color: AppColor.colorCalendarEventInformationStroke,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(CalendarEventInformationWidgetStyles.borderRadius)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
margin: const EdgeInsetsDirectional.symmetric(
|
||||||
|
vertical: CalendarEventInformationWidgetStyles.verticalMargin,
|
||||||
|
horizontal: CalendarEventInformationWidgetStyles.horizontalMargin),
|
||||||
|
child: responsiveUtils.isPortraitMobile(context)
|
||||||
|
? Column(
|
||||||
|
children: [
|
||||||
|
CalendarDateIconWidget(
|
||||||
|
calendarEvent: calendarEvent,
|
||||||
|
width: double.infinity,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
decoration: const ShapeDecoration(
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
bottomLeft: Radius.circular(CalendarEventInformationWidgetStyles.borderRadius),
|
||||||
|
bottomRight: Radius.circular(CalendarEventInformationWidgetStyles.borderRadius)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
color: Colors.white
|
||||||
|
),
|
||||||
|
clipBehavior: Clip.antiAlias,
|
||||||
|
padding: const EdgeInsets.all(CalendarEventInformationWidgetStyles.calendarInformationMargin),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
RichText(
|
||||||
|
text: TextSpan(
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: CalendarEventInformationWidgetStyles.invitationMessageTextSize,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Colors.black
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
TextSpan(
|
||||||
|
text: calendarEvent.organizer?.name,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: CalendarEventInformationWidgetStyles.invitationMessageTextSize,
|
||||||
|
fontWeight: FontWeight.w700
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextSpan(text: AppLocalizations.of(context).invitationMessageCalendarInformation)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
),
|
||||||
|
const SizedBox(height: CalendarEventInformationWidgetStyles.space),
|
||||||
|
Text(
|
||||||
|
calendarEvent.title ?? '',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
fontSize: CalendarEventInformationWidgetStyles.titleTextSize,
|
||||||
|
color: Colors.black
|
||||||
|
)
|
||||||
|
),
|
||||||
|
if (calendarEvent.dateTimeEventAsString.isNotEmpty)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: CalendarEventInformationWidgetStyles.fieldTopPadding),
|
||||||
|
child: EventTimeInformationWidget(timeEvent: calendarEvent.dateTimeEventAsString),
|
||||||
|
),
|
||||||
|
if (calendarEvent.location?.isNotEmpty == true)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: CalendarEventInformationWidgetStyles.fieldTopPadding),
|
||||||
|
child: EventLocationInformationWidget(locationEvent: calendarEvent.location!),
|
||||||
|
),
|
||||||
|
if (calendarEvent.participants?.isNotEmpty == true && calendarEvent.organizer != null)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: CalendarEventInformationWidgetStyles.fieldTopPadding),
|
||||||
|
child: EventAttendeeInformationWidget(
|
||||||
|
attendees: calendarEvent.participants!,
|
||||||
|
organizer: calendarEvent.organizer!,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
CalendarDateIconWidget(calendarEvent: calendarEvent),
|
||||||
|
Expanded(child: Container(
|
||||||
|
clipBehavior: Clip.antiAlias,
|
||||||
|
decoration: const ShapeDecoration(
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topRight: Radius.circular(CalendarEventInformationWidgetStyles.borderRadius),
|
||||||
|
bottomRight: Radius.circular(CalendarEventInformationWidgetStyles.borderRadius)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
color: Colors.white
|
||||||
|
),
|
||||||
|
padding: const EdgeInsets.all(CalendarEventInformationWidgetStyles.calendarInformationMargin),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
RichText(
|
||||||
|
text: TextSpan(
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: CalendarEventInformationWidgetStyles.invitationMessageTextSize,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Colors.black
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
TextSpan(
|
||||||
|
text: calendarEvent.organizer?.name,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: CalendarEventInformationWidgetStyles.invitationMessageTextSize,
|
||||||
|
fontWeight: FontWeight.w700
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextSpan(text: AppLocalizations.of(context).invitationMessageCalendarInformation)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
),
|
||||||
|
const SizedBox(height: CalendarEventInformationWidgetStyles.space),
|
||||||
|
Text(
|
||||||
|
calendarEvent.title ?? '',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
fontSize: CalendarEventInformationWidgetStyles.titleTextSize,
|
||||||
|
color: Colors.black
|
||||||
|
)
|
||||||
|
),
|
||||||
|
if (calendarEvent.dateTimeEventAsString.isNotEmpty)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: CalendarEventInformationWidgetStyles.fieldTopPadding),
|
||||||
|
child: EventTimeInformationWidget(timeEvent: calendarEvent.dateTimeEventAsString),
|
||||||
|
),
|
||||||
|
if (calendarEvent.location?.isNotEmpty == true)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: CalendarEventInformationWidgetStyles.fieldTopPadding),
|
||||||
|
child: EventLocationInformationWidget(locationEvent: calendarEvent.location!),
|
||||||
|
),
|
||||||
|
if (calendarEvent.participants?.isNotEmpty == true && calendarEvent.organizer != null)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: CalendarEventInformationWidgetStyles.fieldTopPadding),
|
||||||
|
child: EventAttendeeInformationWidget(
|
||||||
|
attendees: calendarEvent.participants!,
|
||||||
|
organizer: calendarEvent.organizer!,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
|
|
||||||
import 'package:core/presentation/extensions/color_extension.dart';
|
|
||||||
import 'package:core/presentation/utils/responsive_utils.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:jmap_dart_client/jmap/mail/calendar/calendar_event.dart';
|
|
||||||
import 'package:tmail_ui_user/features/email/presentation/styles/calendar_event_information_widget_styles.dart';
|
|
||||||
import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_date_icon_widget.dart';
|
|
||||||
|
|
||||||
class CalendarEventInformationWidget extends StatelessWidget {
|
|
||||||
|
|
||||||
final CalendarEvent calendarEvent;
|
|
||||||
|
|
||||||
const CalendarEventInformationWidget({
|
|
||||||
super.key,
|
|
||||||
required this.calendarEvent
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final responsiveUtils = Get.find<ResponsiveUtils>();
|
|
||||||
return Container(
|
|
||||||
clipBehavior: Clip.antiAlias,
|
|
||||||
decoration: const ShapeDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
side: BorderSide(
|
|
||||||
width: 0.5,
|
|
||||||
color: AppColor.colorCalendarEventInformationStroke,
|
|
||||||
),
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(CalendarEventInformationWidgetStyles.borderRadius)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
margin: const EdgeInsetsDirectional.symmetric(
|
|
||||||
vertical: CalendarEventInformationWidgetStyles.verticalMargin,
|
|
||||||
horizontal: CalendarEventInformationWidgetStyles.horizontalMargin),
|
|
||||||
child: responsiveUtils.isPortraitMobile(context)
|
|
||||||
? Column(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
padding: const EdgeInsets.all(CalendarEventInformationWidgetStyles.calendarDateIconMargin),
|
|
||||||
color: CalendarEventInformationWidgetStyles.calendarDateIconBackgroundColor,
|
|
||||||
child: CalendarDateIconWidget(
|
|
||||||
calendarEvent: calendarEvent,
|
|
||||||
width: double.infinity,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)
|
|
||||||
: Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
padding: const EdgeInsets.all(CalendarEventInformationWidgetStyles.calendarDateIconMargin),
|
|
||||||
color: CalendarEventInformationWidgetStyles.calendarDateIconBackgroundColor,
|
|
||||||
child: CalendarDateIconWidget(calendarEvent: calendarEvent),
|
|
||||||
),
|
|
||||||
Expanded(child: Container(color: Colors.white))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user