TF-233 Add presentation for create new mailbox

This commit is contained in:
dab246
2022-02-22 15:06:21 +07:00
committed by Dat H. Pham
parent 54034811ac
commit eec37295c8
19 changed files with 503 additions and 86 deletions
@@ -16,6 +16,7 @@ import 'package:tmail_ui_user/features/mailbox/domain/usecases/refresh_all_mailb
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_node.dart';
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_tree_builder.dart';
import 'package:tmail_ui_user/features/mailbox/presentation/extensions/list_mailbox_node_extension.dart';
import 'package:tmail_ui_user/features/mailbox_creator/presentation/model/mailbox_creator_arguments.dart';
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/mailbox_dashboard_controller.dart';
import 'package:tmail_ui_user/features/thread/domain/state/mark_as_multiple_email_read_state.dart';
import 'package:tmail_ui_user/features/thread/domain/state/move_multiple_email_to_mailbox_state.dart';
@@ -36,6 +37,8 @@ class MailboxController extends BaseController {
final defaultMailboxList = <PresentationMailbox>[].obs;
final folderMailboxNodeList = <MailboxNode>[].obs;
List<PresentationMailbox> allMailboxes = <PresentationMailbox>[];
jmapState.State? currentMailboxState;
MailboxController(
@@ -82,6 +85,7 @@ class MailboxController extends BaseController {
super.onData(newState);
newState.map((success) {
if (success is GetAllMailboxSuccess) {
allMailboxes = success.defaultMailboxList + success.folderMailboxList;
currentMailboxState = success.currentMailboxState;
defaultMailboxList.value = success.defaultMailboxList;
_setUpMapMailboxIdDefault(success.defaultMailboxList, success.folderMailboxList);
@@ -202,6 +206,13 @@ class MailboxController extends BaseController {
await _cachingManager.clearAll();
}
void createNewMailbox() async {
final newMailboxArguments = await push(
AppRoutes.MAILBOX_CREATOR,
arguments: MailboxCreatorArguments(allMailboxes)
);
}
void closeMailboxScreen() {
mailboxDashBoardController.closeDrawer();
}
@@ -84,7 +84,7 @@ class MailboxView extends GetWidget<MailboxController> {
padding: EdgeInsets.only(left: 16, right: 16),
child: IconButton(
key: Key('mailbox_add_new_folder_button'),
onPressed: () => {},
onPressed: () => controller.createNewMailbox(),
icon: SvgPicture.asset(imagePaths.icAddNewFolder, width: 30, height: 30, fit: BoxFit.fill)));
}