TF-37 Sort mailbox in alphabet
This commit is contained in:
committed by
Dat H. Pham
parent
e63298bc29
commit
63702035c8
@@ -1,7 +1,9 @@
|
||||
import 'dart:collection';
|
||||
import 'package:collection/collection.dart';
|
||||
|
||||
import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart';
|
||||
import 'package:model/mailbox/presentation_mailbox.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/domain/extensions/mailbox_name_extension.dart';
|
||||
|
||||
import 'mailbox_node.dart';
|
||||
import 'mailbox_tree.dart';
|
||||
@@ -21,8 +23,16 @@ class TreeBuilder {
|
||||
if (node != null) {
|
||||
if (parentNode != null) {
|
||||
parentNode.addChildNode(node);
|
||||
parentNode.childrenItems?.sortByCompare<MailboxName?>(
|
||||
(node) => node.item.name,
|
||||
(name, other) => name?.compareAlphabetically(other) ?? -1
|
||||
);
|
||||
} else {
|
||||
tree.root.addChildNode(node);
|
||||
tree.root.childrenItems?.sortByCompare<MailboxName?>(
|
||||
(node) => node.item.name,
|
||||
(name, other) => name?.compareAlphabetically(other) ?? -1
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user