TF-460 Separate the header of MailboxDashboard on the browser
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:model/model.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/extensions/filter_message_option_extension.dart';
|
||||
|
||||
mixin FilterEmailPopupMenuMixin {
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
|
||||
List<PopupMenuEntry> popupMenuFilterEmailActionTile(BuildContext context,
|
||||
FilterMessageOption optionSelected, Function(FilterMessageOption)? onCallBack) {
|
||||
return [
|
||||
PopupMenuItem(
|
||||
padding: EdgeInsets.zero,
|
||||
child: _filterEmailAction(context, optionSelected, FilterMessageOption.attachments, onCallBack)),
|
||||
PopupMenuDivider(height: 0.5),
|
||||
PopupMenuItem(
|
||||
padding: EdgeInsets.zero,
|
||||
child: _filterEmailAction(context, optionSelected, FilterMessageOption.unread, onCallBack)),
|
||||
PopupMenuDivider(height: 0.5),
|
||||
PopupMenuItem(
|
||||
padding: EdgeInsets.zero,
|
||||
child: _filterEmailAction(context, optionSelected, FilterMessageOption.starred, onCallBack)),
|
||||
];
|
||||
}
|
||||
|
||||
Widget _filterEmailAction(BuildContext context, FilterMessageOption optionSelected,
|
||||
FilterMessageOption option, Function(FilterMessageOption)? onCallBack) {
|
||||
return InkWell(
|
||||
onTap: () => onCallBack?.call(option == optionSelected ? FilterMessageOption.all : option),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 16),
|
||||
child: SizedBox(
|
||||
child: Row(children: [
|
||||
SvgPicture.asset(option.getIcon(_imagePaths),
|
||||
width: 20,
|
||||
height: 20,
|
||||
fit: BoxFit.fill,
|
||||
color: option != FilterMessageOption.starred ? AppColor.colorTextButton : null),
|
||||
SizedBox(width: 12),
|
||||
Expanded(child: Text(
|
||||
option.getName(context),
|
||||
style: TextStyle(fontSize: 15, color: Colors.black, fontWeight: FontWeight.w500))),
|
||||
if (optionSelected == option)
|
||||
SizedBox(width: 12),
|
||||
if (optionSelected == option)
|
||||
SvgPicture.asset(_imagePaths.icFilterSelected, width: 16, height: 16, fit: BoxFit.fill),
|
||||
])
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:model/model.dart';
|
||||
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}) {
|
||||
return [
|
||||
PopupMenuItem(
|
||||
enabled: false,
|
||||
padding: EdgeInsets.zero,
|
||||
child: _userInformation(context, userProfile)),
|
||||
PopupMenuDivider(height: 0.5),
|
||||
PopupMenuItem(
|
||||
padding: EdgeInsets.zero,
|
||||
child: _settingAction(context, onSettingAction)),
|
||||
PopupMenuDivider(height: 0.5),
|
||||
PopupMenuItem(
|
||||
padding: EdgeInsets.zero,
|
||||
child: _logoutAction(context, onLogoutAction)),
|
||||
];
|
||||
}
|
||||
|
||||
Widget _userInformation(BuildContext context, UserProfile? userProfile) {
|
||||
if (userProfile != null) {
|
||||
return SizedBox(
|
||||
width: 300,
|
||||
child: ListTile(
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 20),
|
||||
title: Text(userProfile.email, maxLines: 1, style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: AppColor.colorHintSearchBar,
|
||||
fontWeight: FontWeight.normal))),
|
||||
);
|
||||
}
|
||||
return SizedBox.shrink();
|
||||
}
|
||||
|
||||
Widget _settingAction(BuildContext context, Function? onCallBack) {
|
||||
return PopupMenuItemWidget(
|
||||
_imagePaths.icSetting,
|
||||
AppLocalizations.of(context).settings,
|
||||
() => onCallBack?.call());
|
||||
}
|
||||
|
||||
Widget _logoutAction(BuildContext context, Function? onCallBack) {
|
||||
return PopupMenuItemWidget(
|
||||
_imagePaths.icLogout,
|
||||
AppLocalizations.of(context).sign_out,
|
||||
() => onCallBack?.call());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user