TF-83 Fix show message constraints when sending a message

This commit is contained in:
dab246
2022-04-07 14:45:01 +07:00
committed by Dat H. Pham
parent 63d1b6584f
commit a7d013cfc7
8 changed files with 162 additions and 96 deletions
@@ -3,12 +3,8 @@ import 'package:model/model.dart';
extension ListAttachmentExtension on List<Attachment> {
num totalSize() {
num totalSize = 0;
forEach((attachment) {
if (attachment.size != null) {
totalSize += attachment.size!.value;
}
});
final currentListSize = map((attachment) => attachment.size?.value ?? 0).toList();
final totalSize = currentListSize.reduce((sum, size) => sum + size);
return totalSize;
}