TF-599 Remove list mailbox selection not use on browser
This commit is contained in:
@@ -14,8 +14,6 @@ abstract class BaseMailboxController extends BaseController {
|
||||
|
||||
final folderMailboxTree = MailboxTree(MailboxNode.root()).obs;
|
||||
final defaultMailboxTree = MailboxTree(MailboxNode.root()).obs;
|
||||
final listMailboxNodeSelected = <MailboxNode>[].obs;
|
||||
final listPresentationMailboxSelected = <PresentationMailbox>[].obs;
|
||||
|
||||
List<PresentationMailbox> allMailboxes = <PresentationMailbox>[];
|
||||
|
||||
@@ -57,13 +55,6 @@ abstract class BaseMailboxController extends BaseController {
|
||||
? SelectMode.ACTIVE
|
||||
: SelectMode.INACTIVE;
|
||||
|
||||
|
||||
if (newSelectMode == SelectMode.INACTIVE) {
|
||||
listMailboxNodeSelected.removeWhere((mailboxNode) => mailboxNode.item.id == mailboxNodeSelected.item.id);
|
||||
} else {
|
||||
listMailboxNodeSelected.add(mailboxNodeSelected);
|
||||
}
|
||||
|
||||
if (defaultMailboxTree.value.updateSelectedNode(mailboxNodeSelected, newSelectMode) != null) {
|
||||
log('selectMailboxNode() refresh defaultMailboxTree');
|
||||
defaultMailboxTree.refresh();
|
||||
|
||||
@@ -372,13 +372,11 @@ class MailboxController extends BaseMailboxController {
|
||||
|
||||
void enableSearch() {
|
||||
_cancelSelectMailbox();
|
||||
listMailboxNodeSelected.clear();
|
||||
searchState.value = searchState.value.enableSearchState();
|
||||
}
|
||||
|
||||
void disableSearch(BuildContext context) {
|
||||
_cancelSelectMailbox();
|
||||
listPresentationMailboxSelected.clear();
|
||||
listMailboxSearched.clear();
|
||||
searchState.value = searchState.value.disableSearchState();
|
||||
searchQuery.value = SearchQuery.initial();
|
||||
@@ -390,12 +388,10 @@ class MailboxController extends BaseMailboxController {
|
||||
searchQuery.value = SearchQuery.initial();
|
||||
searchFocus.requestFocus();
|
||||
listMailboxSearched.clear();
|
||||
listPresentationMailboxSelected.clear();
|
||||
}
|
||||
|
||||
void searchMailbox(String value) {
|
||||
searchQuery.value = SearchQuery(value);
|
||||
listPresentationMailboxSelected.clear();
|
||||
_searchMailboxAction(allMailboxes, searchQuery.value);
|
||||
}
|
||||
|
||||
@@ -430,14 +426,6 @@ class MailboxController extends BaseMailboxController {
|
||||
listMailboxSearched.value = listMailboxSearched
|
||||
.map((mailbox) => mailbox.id == mailboxSelected.id ? mailbox.toggleSelectPresentationMailbox() : mailbox)
|
||||
.toList();
|
||||
|
||||
if (kIsWeb) {
|
||||
if (mailboxSelected.selectMode == SelectMode.ACTIVE) {
|
||||
listPresentationMailboxSelected.removeWhere((mailbox) => mailbox.id == mailboxSelected.id);
|
||||
} else {
|
||||
listPresentationMailboxSelected.add(mailboxSelected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _cancelSelectMailbox() {
|
||||
@@ -450,10 +438,6 @@ class MailboxController extends BaseMailboxController {
|
||||
folderMailboxTree.value.updateNodesUIMode(SelectMode.INACTIVE, ExpandMode.COLLAPSE);
|
||||
}
|
||||
currentSelectMode.value = SelectMode.INACTIVE;
|
||||
if (kIsWeb) {
|
||||
listPresentationMailboxSelected.clear();
|
||||
listMailboxNodeSelected.clear();
|
||||
}
|
||||
}
|
||||
|
||||
List<PresentationMailbox> get listMailboxSelected {
|
||||
|
||||
@@ -24,69 +24,58 @@ class MailboxView extends GetWidget<MailboxController> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SafeArea(bottom: false, left: false, right: false, top: _responsiveUtils.isMobile(context),
|
||||
return SafeArea(bottom: false, left: false, right: false,
|
||||
top: _responsiveUtils.isMobile(context),
|
||||
child: ClipRRect(
|
||||
borderRadius: _responsiveUtils.isPortraitMobile(context)
|
||||
? const BorderRadius.only(topRight: Radius.circular(14), topLeft: Radius.circular(14))
|
||||
? const BorderRadius.only(
|
||||
topRight: Radius.circular(14),
|
||||
topLeft: Radius.circular(14))
|
||||
: const BorderRadius.all(Radius.zero),
|
||||
child: Drawer(
|
||||
child: Scaffold(
|
||||
backgroundColor: BuildUtils.isWeb && _responsiveUtils.isDesktop(context)
|
||||
? AppColor.colorBgDesktop
|
||||
: Colors.white,
|
||||
backgroundColor: Colors.white,
|
||||
body: Stack(children: [
|
||||
Column(children: [
|
||||
if (BuildUtils.isWeb && _responsiveUtils.isDesktop(context))
|
||||
_buildLogoApp(context),
|
||||
if ((BuildUtils.isWeb && !_responsiveUtils.isDesktop(context))
|
||||
|| !BuildUtils.isWeb)
|
||||
_buildHeaderMailbox(context),
|
||||
if (BuildUtils.isWeb && _responsiveUtils.isDesktop(context))
|
||||
_buildComposerButton(context),
|
||||
Obx(() => !controller.isSearchActive() && BuildUtils.isWeb
|
||||
&& _responsiveUtils.isDesktop(context)
|
||||
? Row(children: [
|
||||
Expanded(child: _buildSearchBarWidget(context)),
|
||||
_buildAddNewFolderButton(context),
|
||||
])
|
||||
: const SizedBox.shrink()),
|
||||
_buildHeaderMailbox(context),
|
||||
Obx(() => controller.isSearchActive()
|
||||
? SafeArea(bottom: false, top: false, right: false, child: _buildInputSearchFormWidget(context))
|
||||
? SafeArea(bottom: false, top: false, right: false,
|
||||
child: _buildInputSearchFormWidget(context))
|
||||
: const SizedBox.shrink()),
|
||||
Expanded(child: Obx(() => Container(
|
||||
color: _responsiveUtils.isDesktop(context) && BuildUtils.isWeb
|
||||
? Colors.transparent
|
||||
: controller.isSearchActive() ? Colors.white : AppColor.colorBgMailbox,
|
||||
color: controller.isSearchActive()
|
||||
? Colors.white
|
||||
: AppColor.colorBgMailbox,
|
||||
child: RefreshIndicator(
|
||||
color: AppColor.primaryColor,
|
||||
onRefresh: () async => controller.refreshAllMailbox(),
|
||||
color: AppColor.primaryColor,
|
||||
onRefresh: () async => controller.refreshAllMailbox(),
|
||||
child: SafeArea(top: false, right: false,
|
||||
bottom: !controller.isSelectionEnabled(),
|
||||
child: controller.isSearchActive()
|
||||
? SafeArea(
|
||||
bottom: !controller.isSelectionEnabled(),
|
||||
top: false,
|
||||
right: false,
|
||||
child: _buildListMailboxSearched(context))
|
||||
: SafeArea(
|
||||
bottom: !controller.isSelectionEnabled(),
|
||||
right: false,
|
||||
top: false,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(bottom: _responsiveUtils.isLandscapeMobile(context)
|
||||
? _buildListMailboxSearched(context)
|
||||
: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: _responsiveUtils.isLandscapeMobile(context)
|
||||
|| controller.isSelectionEnabled() ? 0 : 55),
|
||||
child: _buildListMailbox(context)))
|
||||
child: _buildListMailbox(context))
|
||||
)
|
||||
),
|
||||
))),
|
||||
Obx(() => controller.isSelectionEnabled() ? _buildOptionSelectionMailbox(context) : const SizedBox.shrink()),
|
||||
Obx(() => controller.isSelectionEnabled()
|
||||
? _buildOptionSelectionMailbox(context)
|
||||
: const SizedBox.shrink()),
|
||||
]),
|
||||
Obx(() {
|
||||
if (controller.mailboxDashBoardController.appInformation.value != null
|
||||
&& !controller.isSearchActive() && !controller.isSelectionEnabled()) {
|
||||
final appInformation = controller.mailboxDashBoardController.appInformation.value;
|
||||
if (appInformation != null
|
||||
&& !controller.isSearchActive()
|
||||
&& !controller.isSelectionEnabled()) {
|
||||
if (_responsiveUtils.isLandscapeMobile(context)) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: _buildVersionInformation(context, controller.mailboxDashBoardController.appInformation.value!));
|
||||
child: _buildVersionInformation(context, appInformation));
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
@@ -98,19 +87,6 @@ class MailboxView extends GetWidget<MailboxController> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildLogoApp(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
padding: const EdgeInsets.only(left: 32, top: 20, bottom: 24),
|
||||
child: (SloganBuilder(arrangedByHorizontal: true)
|
||||
..setSloganText(AppLocalizations.of(context).app_name)
|
||||
..setSloganTextAlign(TextAlign.center)
|
||||
..setSloganTextStyle(const TextStyle(color: Colors.black, fontSize: 25, fontWeight: FontWeight.bold))
|
||||
..setSizeLogo(24)
|
||||
..setLogo(_imagePaths.icLogoTMail))
|
||||
.build());
|
||||
}
|
||||
|
||||
Widget _buildHeaderMailbox(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -155,42 +131,6 @@ class MailboxView extends GetWidget<MailboxController> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildComposerButton(BuildContext context) {
|
||||
return Row(children: [
|
||||
Expanded(child: Container(
|
||||
padding: const EdgeInsets.only(top: 16, left: 20),
|
||||
color: AppColor.colorBgDesktop,
|
||||
alignment: Alignment.centerLeft,
|
||||
child: (ButtonBuilder(_imagePaths.icCompose)
|
||||
..key(const Key('button_compose_email'))
|
||||
..decoration(BoxDecoration(borderRadius: BorderRadius.circular(25), color: AppColor.colorTextButton))
|
||||
..paddingIcon(const EdgeInsets.only(right: 8))
|
||||
..iconColor(Colors.white)
|
||||
..maxWidth(140)
|
||||
..size(20)
|
||||
..radiusSplash(10)
|
||||
..padding(const EdgeInsets.symmetric(vertical: 13))
|
||||
..textStyle(const TextStyle(fontSize: 15, color: Colors.white, fontWeight: FontWeight.w500))
|
||||
..onPressActionClick(() => controller.mailboxDashBoardController.composeEmailAction())
|
||||
..text(AppLocalizations.of(context).compose, isVertical: false))
|
||||
.build())
|
||||
),
|
||||
Obx(() {
|
||||
if (controller.isSearchActive()) {
|
||||
return controller.listMailboxSearched.isNotEmpty
|
||||
? Padding(
|
||||
padding: const EdgeInsets.only(top: 16),
|
||||
child: _buildEditMailboxButton(context, controller.isSelectionEnabled()))
|
||||
: const SizedBox.shrink();
|
||||
} else {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 16),
|
||||
child: _buildEditMailboxButton(context, controller.isSelectionEnabled()));
|
||||
}
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
||||
Widget _buildCloseScreenButton(BuildContext context) {
|
||||
return buildIconWeb(
|
||||
icon: SvgPicture.asset(_imagePaths.icCloseMailbox, width: 28, height: 28, fit: BoxFit.fill),
|
||||
@@ -423,29 +363,21 @@ class MailboxView extends GetWidget<MailboxController> {
|
||||
}
|
||||
|
||||
Widget _buildOptionSelectionMailbox(BuildContext context) {
|
||||
if (_responsiveUtils.isDesktop(context)) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: const [BoxShadow(color: AppColor.colorEmailAddressTag, spreadRadius: 1, blurRadius: 1, offset: Offset(0, 0.5))],
|
||||
color: Colors.white),
|
||||
margin: const EdgeInsets.only(left: 10, bottom: 10, right: 10),
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: (BottomBarSelectionMailboxWidget(context, _imagePaths, controller.listMailboxSelected)
|
||||
..addOnMailboxActionsClick((actions, listMailboxSelected) => controller.pressMailboxSelectionAction(context, actions, listMailboxSelected)))
|
||||
.build(),
|
||||
);
|
||||
} else {
|
||||
return Column(children: [
|
||||
const Divider(color: AppColor.lineItemListColor, height: 1, thickness: 0.2),
|
||||
SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: (BottomBarSelectionMailboxWidget(context, _imagePaths, controller.listMailboxSelected)
|
||||
..addOnMailboxActionsClick((actions, listMailboxSelected) => controller.pressMailboxSelectionAction(context, actions, listMailboxSelected)))
|
||||
.build()))
|
||||
]);
|
||||
}
|
||||
return Column(children: [
|
||||
const Divider(color: AppColor.lineItemListColor, height: 1, thickness: 0.2),
|
||||
SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: (BottomBarSelectionMailboxWidget(context,
|
||||
_imagePaths,
|
||||
controller.listMailboxSelected)
|
||||
..addOnMailboxActionsClick((actions, listMailboxSelected) =>
|
||||
controller.pressMailboxSelectionAction(
|
||||
context,
|
||||
actions,
|
||||
listMailboxSelected)))
|
||||
.build()))
|
||||
]);
|
||||
}
|
||||
|
||||
Widget _buildVersionInformation(BuildContext context, PackageInfo packageInfo) {
|
||||
|
||||
@@ -10,7 +10,6 @@ import 'package:tmail_ui_user/features/mailbox/presentation/mailbox_controller.d
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_actions.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_categories.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_node.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/widgets/bottom_bar_selection_mailbox_widget.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/widgets/mailbox_bottom_sheet_action_tile_builder.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/widgets/mailbox_folder_tile_builder.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/widgets/mailbox_search_tile_builder.dart';
|
||||
@@ -31,47 +30,45 @@ class MailboxView extends GetWidget<MailboxController> with AppLoaderMixin, Popu
|
||||
elevation: _responsiveUtils.isDesktop(context) ? 0 : 16.0,
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
body: Column(
|
||||
children: [
|
||||
if (!_responsiveUtils.isDesktop(context)) _buildLogoApp(context),
|
||||
if (!_responsiveUtils.isDesktop(context))
|
||||
const Divider(color: AppColor.colorDividerMailbox, height: 0.5, thickness: 0.2),
|
||||
Expanded(child: Container(
|
||||
padding: EdgeInsets.only(left: _responsiveUtils.isDesktop(context) ? 16 : 0),
|
||||
color: _responsiveUtils.isDesktop(context) ? AppColor.colorBgDesktop : Colors.white,
|
||||
child: Column(children: [
|
||||
if (_responsiveUtils.isDesktop(context)) _buildComposerButton(context),
|
||||
Obx(() => controller.isSearchActive()
|
||||
? _buildInputSearchFormWidget(context)
|
||||
: const SizedBox.shrink()),
|
||||
Expanded(child: Obx(() => Container(
|
||||
color: _responsiveUtils.isDesktop(context)
|
||||
? AppColor.colorBgDesktop
|
||||
: Colors.white,
|
||||
padding: EdgeInsets.zero,
|
||||
margin: EdgeInsets.only(top: _responsiveUtils.isDesktop(context) ? 16 : 0),
|
||||
child: RefreshIndicator(
|
||||
color: AppColor.primaryColor,
|
||||
onRefresh: () async => controller.refreshAllMailbox(),
|
||||
child: controller.isSearchActive()
|
||||
? _buildListMailboxSearched(context, controller.listMailboxSearched)
|
||||
: _buildListMailbox(context)),
|
||||
))),
|
||||
]),
|
||||
)),
|
||||
Obx(() {
|
||||
if (controller.isSearchActive()) {
|
||||
return controller.listPresentationMailboxSelected.isNotEmpty
|
||||
? _buildOptionSelectionMailbox(context)
|
||||
: const SizedBox.shrink();
|
||||
} else {
|
||||
return controller.listMailboxNodeSelected.isNotEmpty
|
||||
? _buildOptionSelectionMailbox(context)
|
||||
: const SizedBox.shrink();
|
||||
}
|
||||
}),
|
||||
]
|
||||
),
|
||||
body: Column(children: [
|
||||
if (!_responsiveUtils.isDesktop(context)) _buildLogoApp(context),
|
||||
if (!_responsiveUtils.isDesktop(context))
|
||||
const Divider(
|
||||
color: AppColor.colorDividerMailbox,
|
||||
height: 0.5,
|
||||
thickness: 0.2),
|
||||
Expanded(child: Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: _responsiveUtils.isDesktop(context) ? 16 : 0),
|
||||
color: _responsiveUtils.isDesktop(context)
|
||||
? AppColor.colorBgDesktop
|
||||
: Colors.white,
|
||||
child: Column(children: [
|
||||
if (_responsiveUtils.isDesktop(context))
|
||||
_buildComposerButton(context),
|
||||
Obx(() => controller.isSearchActive()
|
||||
? _buildInputSearchFormWidget(context)
|
||||
: const SizedBox.shrink()),
|
||||
Expanded(child: Obx(() {
|
||||
return Container(
|
||||
color: _responsiveUtils.isDesktop(context)
|
||||
? AppColor.colorBgDesktop
|
||||
: Colors.white,
|
||||
padding: EdgeInsets.zero,
|
||||
margin: EdgeInsets.only(
|
||||
top: _responsiveUtils.isDesktop(context) ? 16 : 0),
|
||||
child: RefreshIndicator(
|
||||
color: AppColor.primaryColor,
|
||||
onRefresh: () async => controller.refreshAllMailbox(),
|
||||
child: controller.isSearchActive()
|
||||
? _buildListMailboxSearched(
|
||||
context, controller.listMailboxSearched)
|
||||
: _buildListMailbox(context)),
|
||||
);
|
||||
})),
|
||||
]),
|
||||
)),
|
||||
]),
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -362,18 +359,6 @@ class MailboxView extends GetWidget<MailboxController> with AppLoaderMixin, Popu
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildOptionSelectionMailbox(BuildContext context) {
|
||||
return Column(children: [
|
||||
const Divider(color: AppColor.lineItemListColor, height: 1, thickness: 0.2),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
child: (BottomBarSelectionMailboxWidget(context, _imagePaths, controller.listMailboxSelected)
|
||||
..addOnMailboxActionsClick((actions, listMailboxSelected) => controller.pressMailboxSelectionAction(context, actions, listMailboxSelected)))
|
||||
.build()
|
||||
)
|
||||
]);
|
||||
}
|
||||
|
||||
Widget _buildVersionInformation(BuildContext context, PackageInfo packageInfo) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
|
||||
Reference in New Issue
Block a user