From 82845e0fd116998734b51f2609a236a68456aa2d Mon Sep 17 00:00:00 2001 From: dab246 Date: Thu, 8 Sep 2022 18:36:10 +0700 Subject: [PATCH] TF-421 Support delete permanently in mailbox Draft on Mobile --- .../widgets/bottom_bar_thread_selection_widget.dart | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/features/thread/presentation/widgets/bottom_bar_thread_selection_widget.dart b/lib/features/thread/presentation/widgets/bottom_bar_thread_selection_widget.dart index 3a69d38ee..b6c5a65b3 100644 --- a/lib/features/thread/presentation/widgets/bottom_bar_thread_selection_widget.dart +++ b/lib/features/thread/presentation/widgets/bottom_bar_thread_selection_widget.dart @@ -93,12 +93,13 @@ class BottomBarThreadSelectionWidget { }) ..text(_textButtonSpam, isVertical: _responsiveUtils.isMobile(_context))) .build()), - Expanded(child: (ButtonBuilder(_imagePaths.icDelete) + Expanded(child: (ButtonBuilder(canDeletePermanently ? _imagePaths.icDeleteComposer : _imagePaths.icDelete) ..key(const Key('button_delete_email')) + ..iconColor(canDeletePermanently ? AppColor.colorDeletePermanentlyButton : AppColor.primaryColor) ..paddingIcon(const EdgeInsets.symmetric(horizontal: 8, vertical: 4)) ..textStyle(const TextStyle(fontSize: 12, color: AppColor.colorTextButton)) ..onPressActionClick(() { - if (_currentMailbox?.isTrash == true) { + if (canDeletePermanently) { _onPressEmailSelectionActionClick?.call(EmailActionType.deletePermanently, _listSelectionEmail); } else { _onPressEmailSelectionActionClick?.call(EmailActionType.moveToTrash, _listSelectionEmail); @@ -110,6 +111,10 @@ class BottomBarThreadSelectionWidget { ); } + bool get canDeletePermanently { + return _currentMailbox?.isTrash == true || _currentMailbox?.isDrafts == true; + } + String? get _textButtonMarkAsRead { if (!_isMailboxDashboardSplitView(_context)) { return _listSelectionEmail.isAllEmailRead