TF-495 Implement linter for thread view
This commit is contained in:
@@ -26,6 +26,8 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
|
||||
ThreadView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
@@ -35,7 +37,7 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
backgroundColor: _responsiveUtils.isDesktop(context) ? AppColor.colorBgDesktop : Colors.white,
|
||||
body: Row(children: [
|
||||
if ((!kIsWeb && !_responsiveUtils.isMobile(context)) || (kIsWeb && _responsiveUtils.isTabletLarge(context)))
|
||||
VerticalDivider(color: AppColor.lineItemListColor, width: 1, thickness: 0.2),
|
||||
const VerticalDivider(color: AppColor.lineItemListColor, width: 1, thickness: 0.2),
|
||||
Expanded(child: SafeArea(
|
||||
right: _responsiveUtils.isLandscapeMobile(context),
|
||||
left: _responsiveUtils.isLandscapeMobile(context),
|
||||
@@ -45,11 +47,11 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
if (_responsiveUtils.isDesktop(context))
|
||||
Container(
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.only(right: 10, top: 16, bottom: 10, left: 32),
|
||||
padding: const EdgeInsets.only(right: 10, top: 16, bottom: 10, left: 32),
|
||||
child: _buildHeader(context)),
|
||||
Obx(() => !controller.isSearchActive() && !_responsiveUtils.isDesktop(context)
|
||||
? _buildAppBarNormal(context)
|
||||
: SizedBox.shrink()),
|
||||
: const SizedBox.shrink()),
|
||||
_buildSearchInputFormForMobile(context),
|
||||
Container(
|
||||
color: kIsWeb ? AppColor.colorBgDesktop : Colors.white,
|
||||
@@ -57,10 +59,10 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
child: _buildSearchButtonViewForMobile(context)),
|
||||
Obx(() => controller.isMailboxTrash && controller.emailList.isNotEmpty && !controller.isSearchActive()
|
||||
? _buildEmptyTrashButton(context)
|
||||
: SizedBox.shrink()),
|
||||
: const SizedBox.shrink()),
|
||||
Expanded(child: Container(
|
||||
color: kIsWeb ? AppColor.colorBgDesktop : Colors.white,
|
||||
padding: _responsiveUtils.isDesktop(context) ? EdgeInsets.only(left: 32, right: 24, top: 16, bottom: 24) : EdgeInsets.zero,
|
||||
padding: _responsiveUtils.isDesktop(context) ? const EdgeInsets.only(left: 32, right: 24, top: 16, bottom: 24) : EdgeInsets.zero,
|
||||
child: Stack(children: [
|
||||
Container(
|
||||
alignment: Alignment.center,
|
||||
@@ -92,14 +94,14 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
|
||||
Widget _buildHeader(BuildContext context) {
|
||||
return Row(children: [
|
||||
Obx(() => !controller.isSelectionEnabled() ? _buildListButtonTopBar(context) : SizedBox.shrink()),
|
||||
Obx(() => controller.isSelectionEnabled() ? _buildListButtonSelectionForDesktop(context) : SizedBox.shrink()),
|
||||
SizedBox(width: 16),
|
||||
Obx(() => !controller.isSearchActive() ? Spacer() : SizedBox.shrink()),
|
||||
Obx(() => !controller.isSelectionEnabled() ? _buildListButtonTopBar(context) : const SizedBox.shrink()),
|
||||
Obx(() => controller.isSelectionEnabled() ? _buildListButtonSelectionForDesktop(context) : const SizedBox.shrink()),
|
||||
const SizedBox(width: 16),
|
||||
Obx(() => !controller.isSearchActive() ? const Spacer() : const SizedBox.shrink()),
|
||||
Expanded(child: _buildSearchInputFormForDesktop(context)),
|
||||
_buildSearchButtonViewForDesktop(context),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 16),
|
||||
padding: const EdgeInsets.only(right: 16),
|
||||
child: (AvatarBuilder()
|
||||
..text(controller.mailboxDashBoardController.userProfile.value?.getAvatarText() ?? '')
|
||||
..backgroundColor(Colors.white)
|
||||
@@ -109,7 +111,7 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
context,
|
||||
position,
|
||||
popupMenuUserSettingActionTile(context, () => controller.mailboxDashBoardController.logoutAction())))
|
||||
..addBoxShadows([BoxShadow(
|
||||
..addBoxShadows([const BoxShadow(
|
||||
color: AppColor.colorShadowBgContentEmail,
|
||||
spreadRadius: 1, blurRadius: 1, offset: Offset(0, 0.5))])
|
||||
..size(48))
|
||||
@@ -121,35 +123,35 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
return Row(children: [
|
||||
if (!controller.isSearchActive())
|
||||
(ButtonBuilder(_imagePaths.icRefresh)
|
||||
..key(Key('button_reload_thread'))
|
||||
..key(const Key('button_reload_thread'))
|
||||
..decoration(BoxDecoration(borderRadius: BorderRadius.circular(10), color: AppColor.colorButtonHeaderThread))
|
||||
..paddingIcon(EdgeInsets.zero)
|
||||
..size(16)
|
||||
..radiusSplash(10)
|
||||
..padding(EdgeInsets.symmetric(horizontal: 8, vertical: 8))
|
||||
..padding(const EdgeInsets.symmetric(horizontal: 8, vertical: 8))
|
||||
..onPressActionClick(() => controller.refreshAllEmail()))
|
||||
.build(),
|
||||
if (!controller.isSearchActive()) SizedBox(width: 16),
|
||||
if (!controller.isSearchActive()) const SizedBox(width: 16),
|
||||
(ButtonBuilder(_imagePaths.icSelectAll)
|
||||
..key(Key('button_select_all'))
|
||||
..key(const Key('button_select_all'))
|
||||
..decoration(BoxDecoration(borderRadius: BorderRadius.circular(10), color: AppColor.colorButtonHeaderThread))
|
||||
..paddingIcon(EdgeInsets.only(right: 8))
|
||||
..paddingIcon(const EdgeInsets.only(right: 8))
|
||||
..size(16)
|
||||
..radiusSplash(10)
|
||||
..padding(EdgeInsets.symmetric(horizontal: 12, vertical: 8))
|
||||
..textStyle(TextStyle(fontSize: 12, color: AppColor.colorTextButtonHeaderThread))
|
||||
..padding(const EdgeInsets.symmetric(horizontal: 12, vertical: 8))
|
||||
..textStyle(const TextStyle(fontSize: 12, color: AppColor.colorTextButtonHeaderThread))
|
||||
..onPressActionClick(() => controller.setSelectAllEmailAction())
|
||||
..text(AppLocalizations.of(context).select_all, isVertical: false))
|
||||
.build(),
|
||||
SizedBox(width: 16),
|
||||
const SizedBox(width: 16),
|
||||
(ButtonBuilder(_imagePaths.icMarkAllAsRead)
|
||||
..key(Key('button_mark_all_as_read'))
|
||||
..key(const Key('button_mark_all_as_read'))
|
||||
..decoration(BoxDecoration(borderRadius: BorderRadius.circular(10), color: AppColor.colorButtonHeaderThread))
|
||||
..paddingIcon(EdgeInsets.only(right: 8))
|
||||
..paddingIcon(const EdgeInsets.only(right: 8))
|
||||
..size(16)
|
||||
..padding(EdgeInsets.symmetric(horizontal: 12, vertical: 8))
|
||||
..padding(const EdgeInsets.symmetric(horizontal: 12, vertical: 8))
|
||||
..radiusSplash(10)
|
||||
..textStyle(TextStyle(fontSize: 12, color: AppColor.colorTextButtonHeaderThread))
|
||||
..textStyle(const TextStyle(fontSize: 12, color: AppColor.colorTextButtonHeaderThread))
|
||||
..onPressActionClick(() {
|
||||
final listEmail = controller.isSearchActive()
|
||||
? controller.emailListSearch.allEmailUnread
|
||||
@@ -161,22 +163,22 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
})
|
||||
..text(AppLocalizations.of(context).mark_all_as_read, isVertical: false))
|
||||
.build(),
|
||||
if (!controller.isSearchActive()) SizedBox(width: 16),
|
||||
if (!controller.isSearchActive()) const SizedBox(width: 16),
|
||||
if (!controller.isSearchActive())
|
||||
(ButtonBuilder(_imagePaths.icFilterWeb)
|
||||
..key(Key('button_filter_messages'))
|
||||
..key(const Key('button_filter_messages'))
|
||||
..context(context)
|
||||
..decoration(BoxDecoration(borderRadius: BorderRadius.circular(10), color: AppColor.colorButtonHeaderThread))
|
||||
..paddingIcon(EdgeInsets.only(right: 8))
|
||||
..paddingIcon(const EdgeInsets.only(right: 8))
|
||||
..size(16)
|
||||
..padding(EdgeInsets.symmetric(horizontal: 12, vertical: 8))
|
||||
..padding(const EdgeInsets.symmetric(horizontal: 12, vertical: 8))
|
||||
..radiusSplash(10)
|
||||
..textStyle(TextStyle(
|
||||
fontSize: 12,
|
||||
color: controller.filterMessageOption.value == FilterMessageOption.all ? AppColor.colorTextButtonHeaderThread : AppColor.colorNameEmail,
|
||||
fontWeight: controller.filterMessageOption.value == FilterMessageOption.all ? FontWeight.normal : FontWeight.w500))
|
||||
..addIconAction(Padding(
|
||||
padding: EdgeInsets.only(left: 8),
|
||||
padding: const EdgeInsets.only(left: 8),
|
||||
child: SvgPicture.asset(_imagePaths.icArrowDown, fit: BoxFit.fill)))
|
||||
..addOnPressActionWithPositionClick((position) =>
|
||||
controller.openFilterMessagesForTablet(
|
||||
@@ -198,8 +200,8 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
onTap: () => controller.cancelSelectEmail()),
|
||||
Text(
|
||||
AppLocalizations.of(context).count_email_selected(controller.listEmailSelected.length),
|
||||
style: TextStyle(fontSize: 17, fontWeight: FontWeight.w500, color: AppColor.colorTextButton),),
|
||||
SizedBox(width: 30),
|
||||
style: const TextStyle(fontSize: 17, fontWeight: FontWeight.w500, color: AppColor.colorTextButton),),
|
||||
const SizedBox(width: 30),
|
||||
buildIconWeb(
|
||||
icon: SvgPicture.asset(controller.listEmailSelected.isAllEmailRead ? _imagePaths.icUnread : _imagePaths.icRead, fit: BoxFit.fill),
|
||||
tooltip: controller.listEmailSelected.isAllEmailRead ? AppLocalizations.of(context).mark_as_unread : AppLocalizations.of(context).mark_as_read,
|
||||
@@ -242,9 +244,9 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
return Obx(() {
|
||||
if (controller.isSelectionEnabled() && !_responsiveUtils.isDesktop(context) && controller.listEmailSelected.isNotEmpty) {
|
||||
return Column(children: [
|
||||
Divider(color: AppColor.lineItemListColor, height: 1, thickness: 0.2),
|
||||
const Divider(color: AppColor.lineItemListColor, height: 1, thickness: 0.2),
|
||||
Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: (BottomBarThreadSelectionWidget(
|
||||
context,
|
||||
_imagePaths,
|
||||
@@ -256,7 +258,7 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
.build()),
|
||||
]);
|
||||
} else {
|
||||
return SizedBox.shrink();
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -266,13 +268,13 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
if (!controller.isSearchActive() && !_responsiveUtils.isDesktop(context)) {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.only(left: 16, right: 16, bottom: 10),
|
||||
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 10),
|
||||
child: (SearchBarView(_imagePaths)
|
||||
..hintTextSearch(kIsWeb ? AppLocalizations.of(context).search_emails : AppLocalizations.of(context).hint_search_emails)
|
||||
..addOnOpenSearchViewAction(() => controller.enableSearch(context)))
|
||||
.build());
|
||||
} else {
|
||||
return SizedBox.shrink();
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -282,10 +284,10 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
if (controller.isSearchActive() && !_responsiveUtils.isDesktop(context)) {
|
||||
return Column(children: [
|
||||
_buildSearchForm(context),
|
||||
Divider(color: AppColor.lineItemListColor, height: 1, thickness: 0.2),
|
||||
const Divider(color: AppColor.lineItemListColor, height: 1, thickness: 0.2),
|
||||
]);
|
||||
} else {
|
||||
return SizedBox.shrink();
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -294,14 +296,14 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
return Obx(() {
|
||||
if (!controller.isSearchActive() && _responsiveUtils.isDesktop(context)) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(right: 16),
|
||||
padding: const EdgeInsets.only(right: 16),
|
||||
child: (SearchBarView(_imagePaths)
|
||||
..hintTextSearch(AppLocalizations.of(context).search_emails)
|
||||
..maxSizeWidth(240)
|
||||
..addOnOpenSearchViewAction(() => controller.enableSearch(context)))
|
||||
.build());
|
||||
} else {
|
||||
return SizedBox.shrink();
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -311,7 +313,7 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
if (controller.isSearchActive() && _responsiveUtils.isDesktop(context)) {
|
||||
return _buildSearchFormForDesktop(context);
|
||||
} else {
|
||||
return SizedBox.shrink();
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -325,10 +327,10 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
controller.mailboxDashBoardController.searchFocus,
|
||||
controller.mailboxDashBoardController.searchInputController,
|
||||
suggestionSearch: controller.mailboxDashBoardController.suggestionSearch,)
|
||||
..addDecoration(BoxDecoration(
|
||||
..addDecoration(const BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||
color: AppColor.colorBgSearchBar))
|
||||
..setMargin(EdgeInsets.only(right: 10))
|
||||
..setMargin(const EdgeInsets.only(right: 10))
|
||||
..setHeightSearchBar(45)
|
||||
..setHintText(AppLocalizations.of(context).search_mail)
|
||||
..addOnCancelSearchPressed(() => controller.disableSearch())
|
||||
@@ -347,8 +349,8 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
controller.mailboxDashBoardController.searchFocus,
|
||||
controller.mailboxDashBoardController.searchInputController,
|
||||
suggestionSearch: controller.mailboxDashBoardController.suggestionSearch,)
|
||||
..addDecoration(BoxDecoration(color: Colors.white))
|
||||
..setMargin(EdgeInsets.only(right: 10))
|
||||
..addDecoration(const BoxDecoration(color: Colors.white))
|
||||
..setMargin(const EdgeInsets.only(right: 10))
|
||||
..setHintText(AppLocalizations.of(context).search_mail)
|
||||
..addOnCancelSearchPressed(() => controller.disableSearch())
|
||||
..addOnClearTextSearchAction(() => controller.mailboxDashBoardController.clearSearchText())
|
||||
@@ -395,9 +397,9 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
alignment: Alignment.bottomRight,
|
||||
child: ScrollingFloatingButtonAnimated(
|
||||
icon: SvgPicture.asset(_imagePaths.icCompose, width: 20, height: 20, fit: BoxFit.fill),
|
||||
text: Padding(padding: EdgeInsets.only(right: 10),
|
||||
text: Padding(padding: const EdgeInsets.only(right: 10),
|
||||
child: Text(AppLocalizations.of(context).compose,
|
||||
style: TextStyle(color: AppColor.colorTextButton, fontSize: 15.0, fontWeight: FontWeight.w500))),
|
||||
style: const TextStyle(color: AppColor.colorTextButton, fontSize: 15.0, fontWeight: FontWeight.w500))),
|
||||
onPress: () => controller.composeEmailAction(),
|
||||
scrollController: controller.listEmailController,
|
||||
color: Colors.white,
|
||||
@@ -408,7 +410,7 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return SizedBox.shrink();
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -425,23 +427,23 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
return CupertinoActionSheetAction(
|
||||
child: Text(
|
||||
AppLocalizations.of(context).cancel,
|
||||
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20, color: AppColor.colorTextButton)),
|
||||
style: const TextStyle(fontWeight: FontWeight.w500, fontSize: 20, color: AppColor.colorTextButton)),
|
||||
onPressed: () => controller.closeFilterMessageActionSheet(),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _filterMessageWithAttachmentsAction(BuildContext context, FilterMessageOption optionCurrent) {
|
||||
return (FilterMessageCupertinoActionSheetActionBuilder(
|
||||
Key('filter_attachment_action'),
|
||||
const Key('filter_attachment_action'),
|
||||
SvgPicture.asset(_imagePaths.icAttachment, width: 28, height: 28, fit: BoxFit.fill, color: AppColor.colorTextButton),
|
||||
AppLocalizations.of(context).with_attachments,
|
||||
FilterMessageOption.attachments,
|
||||
optionCurrent: optionCurrent,
|
||||
iconLeftPadding: _responsiveUtils.isMobile(context)
|
||||
? EdgeInsets.only(left: 12, right: 16)
|
||||
: EdgeInsets.only(right: 12),
|
||||
? const EdgeInsets.only(left: 12, right: 16)
|
||||
: const EdgeInsets.only(right: 12),
|
||||
iconRightPadding: _responsiveUtils.isMobile(context)
|
||||
? EdgeInsets.only(right: 12)
|
||||
? const EdgeInsets.only(right: 12)
|
||||
: EdgeInsets.zero,
|
||||
actionSelected: SvgPicture.asset(_imagePaths.icFilterSelected, fit: BoxFit.fill))
|
||||
..onActionClick((option) => controller.filterMessagesAction(context, option)))
|
||||
@@ -450,16 +452,16 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
|
||||
Widget _filterMessagesUnreadAction(BuildContext context, FilterMessageOption optionCurrent) {
|
||||
return (FilterMessageCupertinoActionSheetActionBuilder(
|
||||
Key('filter_unread_action'),
|
||||
const Key('filter_unread_action'),
|
||||
SvgPicture.asset(_imagePaths.icUnread, width: 28, height: 28, fit: BoxFit.fill),
|
||||
AppLocalizations.of(context).unread,
|
||||
FilterMessageOption.unread,
|
||||
optionCurrent: optionCurrent,
|
||||
iconLeftPadding: _responsiveUtils.isMobile(context)
|
||||
? EdgeInsets.only(left: 12, right: 16)
|
||||
: EdgeInsets.only(right: 12),
|
||||
? const EdgeInsets.only(left: 12, right: 16)
|
||||
: const EdgeInsets.only(right: 12),
|
||||
iconRightPadding: _responsiveUtils.isMobile(context)
|
||||
? EdgeInsets.only(right: 12)
|
||||
? const EdgeInsets.only(right: 12)
|
||||
: EdgeInsets.zero,
|
||||
actionSelected: SvgPicture.asset(_imagePaths.icFilterSelected, fit: BoxFit.fill))
|
||||
..onActionClick((option) => controller.filterMessagesAction(context, option)))
|
||||
@@ -468,16 +470,16 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
|
||||
Widget _filterMessageStarredAction(BuildContext context, FilterMessageOption optionCurrent) {
|
||||
return (FilterMessageCupertinoActionSheetActionBuilder(
|
||||
Key('filter_starred_action'),
|
||||
const Key('filter_starred_action'),
|
||||
SvgPicture.asset(_imagePaths.icStar, width: 28, height: 28, fit: BoxFit.fill),
|
||||
AppLocalizations.of(context).starred,
|
||||
FilterMessageOption.starred,
|
||||
optionCurrent: optionCurrent,
|
||||
iconLeftPadding: _responsiveUtils.isMobile(context)
|
||||
? EdgeInsets.only(left: 12, right: 16)
|
||||
: EdgeInsets.only(right: 12),
|
||||
? const EdgeInsets.only(left: 12, right: 16)
|
||||
: const EdgeInsets.only(right: 12),
|
||||
iconRightPadding: _responsiveUtils.isMobile(context)
|
||||
? EdgeInsets.only(right: 12)
|
||||
? const EdgeInsets.only(right: 12)
|
||||
: EdgeInsets.zero,
|
||||
actionSelected: SvgPicture.asset(_imagePaths.icFilterSelected, fit: BoxFit.fill))
|
||||
..onActionClick((option) => controller.filterMessagesAction(context, option)))
|
||||
@@ -486,32 +488,32 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
|
||||
List<PopupMenuEntry> _popupMenuEmailActionTile(BuildContext context, FilterMessageOption option) {
|
||||
return [
|
||||
PopupMenuItem(padding: EdgeInsets.symmetric(horizontal: 8), child: _filterMessageWithAttachmentsAction(context, option)),
|
||||
PopupMenuDivider(height: 0.5),
|
||||
PopupMenuItem(padding: EdgeInsets.symmetric(horizontal: 8), child: _filterMessagesUnreadAction(context, option)),
|
||||
PopupMenuDivider(height: 0.5),
|
||||
PopupMenuItem(padding: EdgeInsets.symmetric(horizontal: 8), child: _filterMessageStarredAction(context, option)),
|
||||
PopupMenuItem(padding: const EdgeInsets.symmetric(horizontal: 8), child: _filterMessageWithAttachmentsAction(context, option)),
|
||||
const PopupMenuDivider(height: 0.5),
|
||||
PopupMenuItem(padding: const EdgeInsets.symmetric(horizontal: 8), child: _filterMessagesUnreadAction(context, option)),
|
||||
const PopupMenuDivider(height: 0.5),
|
||||
PopupMenuItem(padding: const EdgeInsets.symmetric(horizontal: 8), child: _filterMessageStarredAction(context, option)),
|
||||
];
|
||||
}
|
||||
|
||||
Widget _buildLoadingView() {
|
||||
return Obx(() => controller.viewState.value.fold(
|
||||
(failure) => SizedBox.shrink(),
|
||||
(failure) => const SizedBox.shrink(),
|
||||
(success) {
|
||||
if (controller.isSearchActive()) {
|
||||
return success is SearchingState
|
||||
? Padding(padding: EdgeInsets.symmetric(vertical: 16), child: _loadingWidget)
|
||||
: SizedBox.shrink();
|
||||
? Padding(padding: const EdgeInsets.symmetric(vertical: 16), child: _loadingWidget)
|
||||
: const SizedBox.shrink();
|
||||
} else {
|
||||
return success is LoadingState
|
||||
? Padding(padding: EdgeInsets.symmetric(vertical: 16), child: _loadingWidget)
|
||||
: SizedBox.shrink();
|
||||
? Padding(padding: const EdgeInsets.symmetric(vertical: 16), child: _loadingWidget)
|
||||
: const SizedBox.shrink();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
Widget get _loadingWidget {
|
||||
return Center(child: Padding(
|
||||
return const Center(child: Padding(
|
||||
padding: EdgeInsets.zero,
|
||||
child: SizedBox(
|
||||
width: 24,
|
||||
@@ -521,16 +523,16 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
|
||||
Widget _buildLoadingViewLoadMore() {
|
||||
return Obx(() => controller.viewState.value.fold(
|
||||
(failure) => SizedBox.shrink(),
|
||||
(failure) => const SizedBox.shrink(),
|
||||
(success) {
|
||||
if (controller.isSearchActive()) {
|
||||
return success is SearchingMoreState
|
||||
? Padding(padding: EdgeInsets.only(bottom: 16), child: _loadingWidget)
|
||||
: SizedBox.shrink();
|
||||
? Padding(padding: const EdgeInsets.only(bottom: 16), child: _loadingWidget)
|
||||
: const SizedBox.shrink();
|
||||
} else {
|
||||
return success is LoadingMoreState
|
||||
? Padding(padding: EdgeInsets.only(bottom: 16), child: _loadingWidget)
|
||||
: SizedBox.shrink();
|
||||
? Padding(padding: const EdgeInsets.only(bottom: 16), child: _loadingWidget)
|
||||
: const SizedBox.shrink();
|
||||
}
|
||||
}));
|
||||
}
|
||||
@@ -546,7 +548,7 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
child: Obx(() {
|
||||
if (controller.isSearchActive()) {
|
||||
if (controller.mailboxDashBoardController.suggestionSearch.isNotEmpty) {
|
||||
return SizedBox.shrink();
|
||||
return const SizedBox.shrink();
|
||||
} else {
|
||||
return _buildResultSearchEmails(context, controller.emailListSearch);
|
||||
}
|
||||
@@ -598,8 +600,8 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
},
|
||||
child: ListView.builder(
|
||||
controller: controller.listEmailController,
|
||||
physics: AlwaysScrollableScrollPhysics(),
|
||||
key: PageStorageKey('list_presentation_email_in_threads'),
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
key: const PageStorageKey('list_presentation_email_in_threads'),
|
||||
itemCount: listPresentationEmail.length,
|
||||
padding: EdgeInsets.only(top: kIsWeb && !_responsiveUtils.isDesktop(context) ? 10 : 0),
|
||||
itemBuilder: (context, index) => Obx(() => (EmailTileBuilder(
|
||||
@@ -620,16 +622,16 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
|
||||
Widget _buildEmptyEmail(BuildContext context) {
|
||||
return Obx(() => controller.viewState.value.fold(
|
||||
(failure) => SizedBox.shrink(),
|
||||
(success) => !(success is LoadingState) && !(success is SearchingState)
|
||||
(failure) => const SizedBox.shrink(),
|
||||
(success) => success is! LoadingState && success is! SearchingState
|
||||
? (BackgroundWidgetBuilder(context)
|
||||
..key(Key('empty_email_background'))
|
||||
..key(const Key('empty_email_background'))
|
||||
..image(SvgPicture.asset(_imagePaths.icEmptyImageDefault, width: 120, height: 120, fit: BoxFit.fill))
|
||||
..text(controller.isSearchActive()
|
||||
? AppLocalizations.of(context).no_emails_matching_your_search
|
||||
: AppLocalizations.of(context).no_emails))
|
||||
.build()
|
||||
: SizedBox.shrink())
|
||||
: const SizedBox.shrink())
|
||||
);
|
||||
}
|
||||
|
||||
@@ -642,29 +644,29 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
..addOnSelectedSuggestion((suggestion) =>
|
||||
controller.mailboxDashBoardController.searchEmail(context, suggestion)))
|
||||
.build()
|
||||
: SizedBox.shrink()
|
||||
: const SizedBox.shrink()
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatusResultSearch(BuildContext context) {
|
||||
return Obx(() {
|
||||
if (controller.isSearchActive()) {
|
||||
return controller.emailListSearch.length > 0
|
||||
return controller.emailListSearch.isNotEmpty
|
||||
? Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.symmetric(vertical: 12, horizontal: 24),
|
||||
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 24),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: _responsiveUtils.isDesktop(context)
|
||||
? BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20))
|
||||
? const BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20))
|
||||
: null,
|
||||
color: AppColor.bgStatusResultSearch),
|
||||
child: Text(
|
||||
AppLocalizations.of(context).results,
|
||||
style: TextStyle(color: AppColor.baseTextColor, fontSize: 14, fontWeight: FontWeight.w500),
|
||||
style: const TextStyle(color: AppColor.baseTextColor, fontSize: 14, fontWeight: FontWeight.w500),
|
||||
))
|
||||
: SizedBox.shrink();
|
||||
: const SizedBox.shrink();
|
||||
} else {
|
||||
return SizedBox.shrink();
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -672,7 +674,7 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
Widget _buildEmptyTrashButton(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(14)),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(14)),
|
||||
border: Border.all(color: AppColor.colorLineLeftEmailView),
|
||||
color: Colors.white),
|
||||
margin: EdgeInsets.only(
|
||||
@@ -680,25 +682,25 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
right: _responsiveUtils.isDesktop(context) ? 20 : 16,
|
||||
bottom: _responsiveUtils.isDesktop(context) ? 0 : 16,
|
||||
top: _responsiveUtils.isDesktop(context) ? 16 : 0),
|
||||
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: Row(children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 16),
|
||||
padding: const EdgeInsets.only(right: 16),
|
||||
child: SvgPicture.asset(_imagePaths.icDeleteTrash, fit: BoxFit.fill)),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 8),
|
||||
padding: const EdgeInsets.only(left: 8),
|
||||
child: Text(
|
||||
AppLocalizations.of(context).message_delete_all_email_in_trash_button,
|
||||
style: TextStyle(color: AppColor.colorContentEmail, fontSize: 13, fontWeight: FontWeight.w500))),
|
||||
style: const TextStyle(color: AppColor.colorContentEmail, fontSize: 13, fontWeight: FontWeight.w500))),
|
||||
TextButton(
|
||||
onPressed: () => controller.deleteSelectionEmailsPermanently(context, DeleteActionType.all),
|
||||
child: Text(
|
||||
AppLocalizations.of(context).empty_trash_now,
|
||||
style: TextStyle(fontSize: 17, fontWeight: FontWeight.w500, color: AppColor.colorTextButton)
|
||||
style: const TextStyle(fontSize: 17, fontWeight: FontWeight.w500, color: AppColor.colorTextButton)
|
||||
)
|
||||
)
|
||||
]
|
||||
@@ -716,7 +718,7 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
|
||||
Widget _markAsEmailSpamOrUnSpamAction(BuildContext context, PresentationEmail email) {
|
||||
return (EmailActionCupertinoActionSheetActionBuilder(
|
||||
Key('mark_as_spam_or_un_spam_action'),
|
||||
const Key('mark_as_spam_or_un_spam_action'),
|
||||
SvgPicture.asset(
|
||||
controller.currentMailbox?.isSpam == true ? _imagePaths.icNotSpam : _imagePaths.icSpam,
|
||||
width: 28, height: 28, fit: BoxFit.fill, color: AppColor.colorTextButton),
|
||||
@@ -725,10 +727,10 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
: AppLocalizations.of(context).mark_as_spam,
|
||||
email,
|
||||
iconLeftPadding: _responsiveUtils.isMobile(context)
|
||||
? EdgeInsets.only(left: 12, right: 16)
|
||||
: EdgeInsets.only(right: 12),
|
||||
? const EdgeInsets.only(left: 12, right: 16)
|
||||
: const EdgeInsets.only(right: 12),
|
||||
iconRightPadding: _responsiveUtils.isMobile(context)
|
||||
? EdgeInsets.only(right: 12)
|
||||
? const EdgeInsets.only(right: 12)
|
||||
: EdgeInsets.zero)
|
||||
..onActionClick((email) => controller.pressEmailAction(context,
|
||||
controller.currentMailbox?.isSpam == true
|
||||
@@ -740,7 +742,7 @@ class ThreadView extends GetWidget<ThreadController> with UserSettingPopupMenuMi
|
||||
|
||||
List<PopupMenuEntry> _popupMenuActionTile(BuildContext context, PresentationEmail email) {
|
||||
return [
|
||||
PopupMenuItem(padding: EdgeInsets.symmetric(horizontal: 8), child: _markAsEmailSpamOrUnSpamAction(context, email)),
|
||||
PopupMenuItem(padding: const EdgeInsets.symmetric(horizontal: 8), child: _markAsEmailSpamOrUnSpamAction(context, email)),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user