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