TF-1831 Remove manage account button inside popup menu in Setting View

Signed-off-by: dab246 <tdvu@linagora.com>
(cherry picked from commit 2f0e62a1f4c2279716cbabaedbe3969e6af3f69a)
This commit is contained in:
dab246
2023-12-11 00:20:35 +07:00
committed by Dat H. Pham
parent fbb43e3bb0
commit 9b9dc3c3b8
3 changed files with 43 additions and 31 deletions
@@ -8,21 +8,37 @@ import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
mixin UserSettingPopupMenuMixin {
final _imagePaths = Get.find<ImagePaths>();
List<PopupMenuEntry> popupMenuUserSettingActionTile(BuildContext context, UserProfile? userProfile,
{Function? onLogoutAction, Function? onSettingAction}) {
List<PopupMenuEntry> popupMenuUserSettingActionTile(
BuildContext context,
UserProfile? userProfile,
{
Function? onLogoutAction,
Function? onSettingAction
}
) {
return [
PopupMenuItem(
enabled: false,
padding: EdgeInsets.zero,
child: _userInformation(context, userProfile)),
const PopupMenuDivider(height: 0.5),
PopupMenuItem(
padding: EdgeInsets.zero,
child: _settingAction(context, onSettingAction)),
const PopupMenuDivider(height: 0.5),
PopupMenuItem(
padding: EdgeInsets.zero,
child: _logoutAction(context, onLogoutAction)),
enabled: false,
padding: EdgeInsets.zero,
child: _userInformation(context, userProfile)
),
if (onSettingAction != null)
...[
const PopupMenuDivider(height: 0.5),
PopupMenuItem(
padding: EdgeInsets.zero,
child: _settingAction(context, onSettingAction)
),
const PopupMenuDivider(height: 0.5),
],
if (onLogoutAction != null)
...[
const PopupMenuDivider(height: 0.5),
PopupMenuItem(
padding: EdgeInsets.zero,
child: _logoutAction(context, onLogoutAction)
),
]
];
}
@@ -215,13 +215,6 @@ class ManageAccountDashBoardController extends ReloadableController {
}
}
void goToSettings() {
popAndPush(
AppRoutes.settings,
arguments: ManageAccountArguments(sessionCurrent)
);
}
void backToMailboxDashBoard({BuildContext? context}) {
if (context != null && canBack(context)) {
popBack(result: vacationResponse.value);
@@ -132,17 +132,20 @@ class ManageAccountDashBoardView extends GetWidget<ManageAccountDashBoardControl
..backgroundColor(Colors.white)
..textColor(Colors.black)
..context(context)
..addOnTapAvatarActionWithPositionClick((position) =>
controller.openPopupMenuAction(context, position, popupMenuUserSettingActionTile(context,
controller.userProfile.value,
onLogoutAction: () {
popBack();
controller.logout(controller.sessionCurrent, controller.accountId.value);
},
onSettingAction: () {
popBack();
controller.goToSettings();
})))
..addOnTapAvatarActionWithPositionClick((position) {
return controller.openPopupMenuAction(
context,
position,
popupMenuUserSettingActionTile(
context,
controller.userProfile.value,
onLogoutAction: () {
popBack();
controller.logout(controller.sessionCurrent, controller.accountId.value);
}
)
);
})
..addBoxShadows([const BoxShadow(
color: AppColor.colorShadowBgContentEmail,
spreadRadius: 1, blurRadius: 1, offset: Offset(0, 0.5))])