TF-3759 Update style popup context menu for profile setting menu
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
+19
@@ -0,0 +1,19 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/profile_setting/profile_setting_action_type.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/manage_account_dashboard_controller.dart';
|
||||
|
||||
extension HandleProfileSettingActionTypeClickExtension on ManageAccountDashBoardController {
|
||||
void handleProfileSettingActionTypeClick({
|
||||
required BuildContext context,
|
||||
required ProfileSettingActionType actionType,
|
||||
}) {
|
||||
switch (actionType) {
|
||||
case ProfileSettingActionType.signOut:
|
||||
logout(context, sessionCurrent, accountId.value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,6 @@ import 'package:rule_filter/rule_filter/capability_rule_filter.dart';
|
||||
import 'package:server_settings/server_settings/capability_server_settings.dart';
|
||||
import 'package:tmail_ui_user/features/base/action/ui_action.dart';
|
||||
import 'package:tmail_ui_user/features/base/reloadable/reloadable_controller.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/mixin/user_setting_popup_menu_mixin.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/state/export_trace_log_state.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/state/get_all_vacation_state.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/state/update_vacation_state.dart';
|
||||
@@ -43,7 +42,7 @@ import 'package:tmail_ui_user/main/routes/route_navigation.dart';
|
||||
import 'package:tmail_ui_user/main/routes/route_utils.dart';
|
||||
import 'package:tmail_ui_user/main/utils/app_config.dart';
|
||||
|
||||
class ManageAccountDashBoardController extends ReloadableController with UserSettingPopupMenuMixin {
|
||||
class ManageAccountDashBoardController extends ReloadableController {
|
||||
|
||||
GetAllVacationInteractor? _getAllVacationInteractor;
|
||||
UpdateVacationInteractor? _updateVacationInteractor;
|
||||
@@ -380,21 +379,6 @@ class ManageAccountDashBoardController extends ReloadableController with UserSet
|
||||
return false;
|
||||
}
|
||||
|
||||
void handleClickAvatarAction(BuildContext context, RelativeRect position) {
|
||||
openPopupMenuAction(
|
||||
context,
|
||||
position,
|
||||
popupMenuUserSettingActionTile(
|
||||
context,
|
||||
getOwnEmailAddress(),
|
||||
onLogoutAction: () {
|
||||
popBack();
|
||||
logout(context, sessionCurrent, accountId.value);
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
int get minInputLengthAutocomplete {
|
||||
if (sessionCurrent == null || accountId.value == null) {
|
||||
return AppConfig.defaultMinInputLengthAutocomplete;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/extensions/string_extension.dart';
|
||||
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||
import 'package:core/presentation/views/responsive/responsive_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_portal/flutter_portal.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/profile_setting/profile_setting_action_type.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/navigation_bar/navigation_bar_widget.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/email_rules/email_rules_view.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/handle_profile_setting_action_type_click_extension.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/vacation_response_extension.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/forward/forward_view.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/language_and_region/language_and_region_view.dart';
|
||||
@@ -25,73 +27,79 @@ class ManageAccountDashBoardView extends GetWidget<ManageAccountDashBoardControl
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: controller.responsiveUtils.isWebDesktop(context)
|
||||
? AppColor.colorBgDesktop
|
||||
: Colors.white,
|
||||
drawerEnableOpenDragGesture: false,
|
||||
body: GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: ResponsiveWidget(
|
||||
responsiveUtils: controller.responsiveUtils,
|
||||
desktop: Column(children: [
|
||||
Obx(() => NavigationBarWidget(
|
||||
imagePaths: controller.imagePaths,
|
||||
accountId: controller.accountId.value,
|
||||
avatarUserName: controller.getOwnEmailAddress().firstCharacterToUpperCase,
|
||||
onTapApplicationLogoAction: () =>
|
||||
controller.backToMailboxDashBoard(context: context),
|
||||
onTapAvatarAction: (position) =>
|
||||
controller.handleClickAvatarAction(context, position),
|
||||
)),
|
||||
Expanded(child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: ResponsiveUtils.defaultSizeMenu,
|
||||
child: ManageAccountMenuView()
|
||||
),
|
||||
Expanded(child: ColoredBox(
|
||||
color: AppColor.colorBgDesktop,
|
||||
child: Column(children: [
|
||||
Obx(() {
|
||||
if (controller.vacationResponse.value?.vacationResponderIsValid == true) {
|
||||
return VacationNotificationMessageWidget(
|
||||
margin: const EdgeInsetsDirectional.only(top: 16, start: 16, end: 16),
|
||||
fromAccountDashBoard: true,
|
||||
vacationResponse: controller.vacationResponse.value!,
|
||||
actionGotoVacationSetting: !controller.inVacationSettings()
|
||||
? () => controller.selectAccountMenuItem(AccountMenuItem.vacation)
|
||||
: null,
|
||||
actionEndNow: controller.disableVacationResponder);
|
||||
} else if ((controller.vacationResponse.value?.vacationResponderIsWaiting == true
|
||||
|| controller.vacationResponse.value?.vacationResponderIsStopped == true)
|
||||
&& controller.accountMenuItemSelected.value == AccountMenuItem.vacation) {
|
||||
return VacationNotificationMessageWidget(
|
||||
margin: const EdgeInsetsDirectional.only(top: 16, start: 16, end: 16),
|
||||
fromAccountDashBoard: true,
|
||||
vacationResponse: controller.vacationResponse.value!,
|
||||
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16),
|
||||
leadingIcon: const Padding(
|
||||
padding: EdgeInsetsDirectional.only(end: 12),
|
||||
child: Icon(Icons.timer, size: 20),
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}),
|
||||
Expanded(child: _viewDisplayedOfAccountMenuItem())
|
||||
]),
|
||||
))
|
||||
],
|
||||
))
|
||||
]),
|
||||
mobile: SafeArea(
|
||||
child: SettingsView(
|
||||
closeAction: () =>
|
||||
controller.backToMailboxDashBoard(context: context)),
|
||||
)
|
||||
return Portal(
|
||||
child: Scaffold(
|
||||
backgroundColor: controller.responsiveUtils.isWebDesktop(context)
|
||||
? AppColor.colorBgDesktop
|
||||
: Colors.white,
|
||||
drawerEnableOpenDragGesture: false,
|
||||
body: GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: ResponsiveWidget(
|
||||
responsiveUtils: controller.responsiveUtils,
|
||||
desktop: Column(children: [
|
||||
Obx(() => NavigationBarWidget(
|
||||
imagePaths: controller.imagePaths,
|
||||
accountId: controller.accountId.value,
|
||||
ownEmailAddress: controller.getOwnEmailAddress(),
|
||||
onTapApplicationLogoAction: () =>
|
||||
controller.backToMailboxDashBoard(context: context),
|
||||
settingActionTypes: const [ProfileSettingActionType.signOut],
|
||||
onProfileSettingActionTypeClick: (actionType) =>
|
||||
controller.handleProfileSettingActionTypeClick(
|
||||
context: context,
|
||||
actionType: actionType,
|
||||
),
|
||||
)),
|
||||
Expanded(child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(
|
||||
width: ResponsiveUtils.defaultSizeMenu,
|
||||
child: ManageAccountMenuView()
|
||||
),
|
||||
Expanded(child: ColoredBox(
|
||||
color: AppColor.colorBgDesktop,
|
||||
child: Column(children: [
|
||||
Obx(() {
|
||||
if (controller.vacationResponse.value?.vacationResponderIsValid == true) {
|
||||
return VacationNotificationMessageWidget(
|
||||
margin: const EdgeInsetsDirectional.only(top: 16, start: 16, end: 16),
|
||||
fromAccountDashBoard: true,
|
||||
vacationResponse: controller.vacationResponse.value!,
|
||||
actionGotoVacationSetting: !controller.inVacationSettings()
|
||||
? () => controller.selectAccountMenuItem(AccountMenuItem.vacation)
|
||||
: null,
|
||||
actionEndNow: controller.disableVacationResponder);
|
||||
} else if ((controller.vacationResponse.value?.vacationResponderIsWaiting == true
|
||||
|| controller.vacationResponse.value?.vacationResponderIsStopped == true)
|
||||
&& controller.accountMenuItemSelected.value == AccountMenuItem.vacation) {
|
||||
return VacationNotificationMessageWidget(
|
||||
margin: const EdgeInsetsDirectional.only(top: 16, start: 16, end: 16),
|
||||
fromAccountDashBoard: true,
|
||||
vacationResponse: controller.vacationResponse.value!,
|
||||
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16),
|
||||
leadingIcon: const Padding(
|
||||
padding: EdgeInsetsDirectional.only(end: 12),
|
||||
child: Icon(Icons.timer, size: 20),
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}),
|
||||
Expanded(child: _viewDisplayedOfAccountMenuItem())
|
||||
]),
|
||||
))
|
||||
],
|
||||
))
|
||||
]),
|
||||
mobile: SafeArea(
|
||||
child: SettingsView(
|
||||
closeAction: () =>
|
||||
controller.backToMailboxDashBoard(context: context)),
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user