TF-2812 Calendar event accept integrate UI
This commit is contained in:
@@ -145,7 +145,9 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
|
||||
EmailLoaded? get currentEmailLoaded => _currentEmailLoaded;
|
||||
|
||||
bool get calendarEventProcessing => viewState.value is CalendarEventReplying;
|
||||
bool get calendarEventProcessing => viewState.value.fold(
|
||||
(failure) => false,
|
||||
(success) => success is CalendarEventReplying);
|
||||
|
||||
CalendarEvent? get calendarEvent => blobCalendarEvent.value?.calendarEventList.firstOrNull;
|
||||
Id? get _displayingEventBlobId => blobCalendarEvent.value?.blobId;
|
||||
@@ -1684,8 +1686,8 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
);
|
||||
}
|
||||
|
||||
void onCalendarEventReplyAction(EventAction eventAction) {
|
||||
switch (eventAction.actionType) {
|
||||
void onCalendarEventReplyAction(EventActionType eventActionType) {
|
||||
switch (eventActionType) {
|
||||
case EventActionType.yes:
|
||||
_acceptCalendarEventAction();
|
||||
break;
|
||||
|
||||
@@ -375,6 +375,8 @@ class EmailView extends GetWidget<SingleEmailController> {
|
||||
calendarEvent: calendarEvent,
|
||||
onOpenComposerAction: controller.openNewComposerAction,
|
||||
onOpenNewTabAction: controller.openNewTabAction,
|
||||
onCalendarEventReplyActionClick: controller.onCalendarEventReplyAction,
|
||||
calendarEventReplying: controller.calendarEventProcessing,
|
||||
),
|
||||
if (calendarEvent.getTitleEventAction(context, emailAddressSender ?? []).isNotEmpty)
|
||||
CalendarEventActionBannerWidget(
|
||||
@@ -388,6 +390,8 @@ class EmailView extends GetWidget<SingleEmailController> {
|
||||
onOpenComposerAction: controller.openNewComposerAction,
|
||||
onOpenNewTabAction: controller.openNewTabAction,
|
||||
onMailtoDelegateAction: controller.openMailToLink,
|
||||
onCalendarEventReplyActionClick: controller.onCalendarEventReplyAction,
|
||||
calendarEventReplying: controller.calendarEventProcessing,
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -10,6 +10,7 @@ class CalendarEventActionButtonWidgetStyles {
|
||||
static const double minWidth = 80;
|
||||
|
||||
static const Color backgroundColor = Colors.transparent;
|
||||
static Color loadingBackgroundColor = Colors.grey.shade300;
|
||||
static const Color textColor = AppColor.primaryColor;
|
||||
|
||||
static const FontWeight fontWeight = FontWeight.w500;
|
||||
|
||||
+12
-4
@@ -4,14 +4,19 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/email/domain/model/event_action.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/styles/calendar_event_action_button_widget_styles.dart';
|
||||
import 'package:tmail_ui_user/main/utils/app_utils.dart';
|
||||
|
||||
typedef OnCalendarEventReplyActionClick = void Function(EventActionType eventActionType);
|
||||
|
||||
class CalendarEventActionButtonWidget extends StatelessWidget {
|
||||
|
||||
final EdgeInsetsGeometry? margin;
|
||||
final OnCalendarEventReplyActionClick onCalendarEventReplyActionClick;
|
||||
final bool calendarEventReplying;
|
||||
|
||||
const CalendarEventActionButtonWidget({
|
||||
super.key,
|
||||
required this.onCalendarEventReplyActionClick,
|
||||
required this.calendarEventReplying,
|
||||
this.margin,
|
||||
});
|
||||
|
||||
@@ -30,7 +35,9 @@ class CalendarEventActionButtonWidget extends StatelessWidget {
|
||||
children: EventActionType.values
|
||||
.map((action) => TMailButtonWidget(
|
||||
text: action.getLabelButton(context),
|
||||
backgroundColor: CalendarEventActionButtonWidgetStyles.backgroundColor,
|
||||
backgroundColor: calendarEventReplying
|
||||
? CalendarEventActionButtonWidgetStyles.loadingBackgroundColor
|
||||
: CalendarEventActionButtonWidgetStyles.backgroundColor,
|
||||
borderRadius: CalendarEventActionButtonWidgetStyles.borderRadius,
|
||||
padding: CalendarEventActionButtonWidgetStyles.buttonPadding,
|
||||
textStyle: const TextStyle(
|
||||
@@ -45,8 +52,9 @@ class CalendarEventActionButtonWidget extends StatelessWidget {
|
||||
width: CalendarEventActionButtonWidgetStyles.borderWidth,
|
||||
color: CalendarEventActionButtonWidgetStyles.textColor
|
||||
),
|
||||
// TODO: Handle in part 4
|
||||
onTapActionCallback: () => AppUtils.launchLink(''),
|
||||
onTapActionCallback: calendarEventReplying
|
||||
? null
|
||||
: () => onCalendarEventReplyActionClick(action),
|
||||
))
|
||||
.toList(),
|
||||
),
|
||||
|
||||
+7
-1
@@ -21,11 +21,15 @@ class CalendarEventDetailWidget extends StatelessWidget {
|
||||
final OnOpenComposerAction? onOpenComposerAction;
|
||||
final bool? isDraggableAppActive;
|
||||
final OnMailtoDelegateAction? onMailtoDelegateAction;
|
||||
final OnCalendarEventReplyActionClick onCalendarEventReplyActionClick;
|
||||
final bool calendarEventReplying;
|
||||
|
||||
const CalendarEventDetailWidget({
|
||||
super.key,
|
||||
required this.calendarEvent,
|
||||
required this.emailContent,
|
||||
required this.onCalendarEventReplyActionClick,
|
||||
required this.calendarEventReplying,
|
||||
this.isDraggableAppActive,
|
||||
this.onOpenNewTabAction,
|
||||
this.onOpenComposerAction,
|
||||
@@ -89,7 +93,9 @@ class CalendarEventDetailWidget extends StatelessWidget {
|
||||
organizer: calendarEvent.organizer!,
|
||||
),
|
||||
),
|
||||
const CalendarEventActionButtonWidget(),
|
||||
CalendarEventActionButtonWidget(
|
||||
onCalendarEventReplyActionClick: onCalendarEventReplyActionClick,
|
||||
calendarEventReplying: calendarEventReplying),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
+10
-2
@@ -21,10 +21,14 @@ class CalendarEventInformationWidget extends StatelessWidget {
|
||||
final CalendarEvent calendarEvent;
|
||||
final OnOpenNewTabAction? onOpenNewTabAction;
|
||||
final OnOpenComposerAction? onOpenComposerAction;
|
||||
final OnCalendarEventReplyActionClick onCalendarEventReplyActionClick;
|
||||
final bool calendarEventReplying;
|
||||
|
||||
const CalendarEventInformationWidget({
|
||||
super.key,
|
||||
required this.calendarEvent,
|
||||
required this.onCalendarEventReplyActionClick,
|
||||
required this.calendarEventReplying,
|
||||
this.onOpenNewTabAction,
|
||||
this.onOpenComposerAction,
|
||||
});
|
||||
@@ -110,8 +114,10 @@ class CalendarEventInformationWidget extends StatelessWidget {
|
||||
organizer: calendarEvent.organizer!,
|
||||
),
|
||||
),
|
||||
const CalendarEventActionButtonWidget(
|
||||
CalendarEventActionButtonWidget(
|
||||
margin: EdgeInsetsDirectional.zero,
|
||||
onCalendarEventReplyActionClick: onCalendarEventReplyActionClick,
|
||||
calendarEventReplying: calendarEventReplying,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -178,8 +184,10 @@ class CalendarEventInformationWidget extends StatelessWidget {
|
||||
organizer: calendarEvent.organizer!,
|
||||
),
|
||||
),
|
||||
const CalendarEventActionButtonWidget(
|
||||
CalendarEventActionButtonWidget(
|
||||
margin: EdgeInsetsDirectional.zero,
|
||||
onCalendarEventReplyActionClick: onCalendarEventReplyActionClick,
|
||||
calendarEventReplying: calendarEventReplying,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -286,8 +286,7 @@ void main() {
|
||||
calendarEventList: [calendarEvent])]));
|
||||
|
||||
// act
|
||||
singleEmailController.onCalendarEventReplyAction(
|
||||
EventAction(EventActionType.yes, ''));
|
||||
singleEmailController.onCalendarEventReplyAction(EventActionType.yes);
|
||||
await untilCalled(acceptCalendarEventInteractor.execute(any, any));
|
||||
|
||||
// assert
|
||||
|
||||
Reference in New Issue
Block a user