TF-933 Update new position EmptyTrashNow button in mailbox trash on Web Desktop
This commit is contained in:
@@ -87,3 +87,13 @@ class StartSearchEmailAction extends DashBoardAction {
|
|||||||
@override
|
@override
|
||||||
List<Object?> get props => [];
|
List<Object?> get props => [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class EmptyTrashAction extends DashBoardAction {
|
||||||
|
|
||||||
|
final BuildContext context;
|
||||||
|
|
||||||
|
EmptyTrashAction(this.context);
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object?> get props => [];
|
||||||
|
}
|
||||||
+6
@@ -680,6 +680,12 @@ class MailboxDashBoardController extends ReloadableController {
|
|||||||
dispatchAction(StartSearchEmailAction());
|
dispatchAction(StartSearchEmailAction());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool get isMailboxTrash => selectedMailbox.value?.isTrash == true;
|
||||||
|
|
||||||
|
void emptyTrashAction(BuildContext context) {
|
||||||
|
dispatchAction(EmptyTrashAction(context));
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
_emailReceiveManager.closeEmailReceiveManagerStream();
|
_emailReceiveManager.closeEmailReceiveManagerStream();
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
|
|||||||
children: [
|
children: [
|
||||||
SizedBox(child: MailboxView(), width: responsiveUtils.defaultSizeMenu),
|
SizedBox(child: MailboxView(), width: responsiveUtils.defaultSizeMenu),
|
||||||
Expanded(child: Column(children: [
|
Expanded(child: Column(children: [
|
||||||
|
_buildEmptyTrashButton(context),
|
||||||
_buildVacationNotificationMessage(context),
|
_buildVacationNotificationMessage(context),
|
||||||
_buildListButtonQuickSearchFilter(context),
|
_buildListButtonQuickSearchFilter(context),
|
||||||
_buildMarkAsMailboxReadLoading(context),
|
_buildMarkAsMailboxReadLoading(context),
|
||||||
@@ -650,4 +651,59 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool supportEmptyTrash(BuildContext context) {
|
||||||
|
return controller.isMailboxTrash
|
||||||
|
&& !controller.searchController.isSearchActive()
|
||||||
|
&& responsiveUtils.isWebDesktop(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildEmptyTrashButton(BuildContext context) {
|
||||||
|
return Obx(() {
|
||||||
|
if (supportEmptyTrash(context)) {
|
||||||
|
return Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: const BorderRadius.all(Radius.circular(14)),
|
||||||
|
border: Border.all(color: AppColor.colorLineLeftEmailView),
|
||||||
|
color: Colors.white),
|
||||||
|
margin: const EdgeInsets.only(right: 16, top: 16),
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
|
child: Row(children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 16),
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
imagePaths.icDeleteTrash,
|
||||||
|
fit: BoxFit.fill)),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8),
|
||||||
|
child: Text(
|
||||||
|
AppLocalizations.of(context).message_delete_all_email_in_trash_button,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: AppColor.colorContentEmail,
|
||||||
|
fontSize: 13,
|
||||||
|
fontWeight: FontWeight.w500))),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => controller.emptyTrashAction(context),
|
||||||
|
child: Text(
|
||||||
|
AppLocalizations.of(context).empty_trash_now,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 17,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: AppColor.colorTextButton)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -281,6 +281,9 @@ class ThreadController extends BaseController {
|
|||||||
} else if (action is StartSearchEmailAction) {
|
} else if (action is StartSearchEmailAction) {
|
||||||
_searchEmail();
|
_searchEmail();
|
||||||
mailboxDashBoardController.clearDashBoardAction();
|
mailboxDashBoardController.clearDashBoardAction();
|
||||||
|
} else if (action is EmptyTrashAction) {
|
||||||
|
deleteSelectionEmailsPermanently(action.context, DeleteActionType.all);
|
||||||
|
mailboxDashBoardController.clearDashBoardAction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -607,7 +607,8 @@ class ThreadView extends GetWidget<ThreadController> with AppLoaderMixin,
|
|||||||
bool supportEmptyTrash(BuildContext context) {
|
bool supportEmptyTrash(BuildContext context) {
|
||||||
return controller.isMailboxTrash
|
return controller.isMailboxTrash
|
||||||
&& controller.emailList.isNotEmpty
|
&& controller.emailList.isNotEmpty
|
||||||
&& !controller.isSearchActive();
|
&& !controller.isSearchActive()
|
||||||
|
&& !_responsiveUtils.isWebDesktop(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildEmptyTrashButton(BuildContext context) {
|
Widget _buildEmptyTrashButton(BuildContext context) {
|
||||||
|
|||||||
Reference in New Issue
Block a user