TF-4227 Load all emails with tag when tag is selected

This commit is contained in:
dab246
2025-12-26 18:48:22 +07:00
committed by Dat H. Pham
parent 127b1dbce9
commit 8f6d9a6e8f
6 changed files with 81 additions and 3 deletions
@@ -1,3 +1,4 @@
import 'package:core/presentation/extensions/color_extension.dart';
import 'package:core/presentation/resources/image_paths.dart';
import 'package:flutter/material.dart';
import 'package:labels/extensions/label_extension.dart';
@@ -12,6 +13,7 @@ class LabelListItem extends StatelessWidget {
final Label label;
final ImagePaths imagePaths;
final bool isDesktop;
final bool isSelected;
final OnOpenLabelCallback onOpenLabelCallback;
const LabelListItem({
@@ -20,6 +22,7 @@ class LabelListItem extends StatelessWidget {
required this.imagePaths,
required this.onOpenLabelCallback,
this.isDesktop = false,
this.isSelected = false,
});
@override
@@ -38,7 +41,10 @@ class LabelListItem extends StatelessWidget {
borderRadius: borderRadius,
onTap: () => onOpenLabelCallback(label),
child: Container(
decoration: BoxDecoration(borderRadius: borderRadius),
decoration: BoxDecoration(
borderRadius: borderRadius,
color: _backgroundColorItem,
),
padding: EdgeInsetsDirectional.symmetric(
horizontal: isDesktop
? MailboxItemWidgetStyles.itemPadding
@@ -70,4 +76,7 @@ class LabelListItem extends StatelessWidget {
),
);
}
Color get _backgroundColorItem =>
isSelected ? AppColor.blue100 : Colors.transparent;
}
@@ -1,5 +1,6 @@
import 'package:core/presentation/resources/image_paths.dart';
import 'package:flutter/material.dart';
import 'package:jmap_dart_client/jmap/core/id.dart';
import 'package:labels/model/label.dart';
import 'package:tmail_ui_user/features/mailbox/presentation/widgets/labels/label_list_item.dart';
@@ -7,6 +8,7 @@ class LabelListView extends StatelessWidget {
final List<Label> labels;
final ImagePaths imagePaths;
final bool isDesktop;
final Id? labelIdSelected;
final OnOpenLabelCallback onOpenLabelCallback;
const LabelListView({
@@ -15,6 +17,7 @@ class LabelListView extends StatelessWidget {
required this.imagePaths,
required this.onOpenLabelCallback,
this.isDesktop = false,
this.labelIdSelected,
});
@override
@@ -26,9 +29,11 @@ class LabelListView extends StatelessWidget {
padding: EdgeInsets.zero,
itemCount: labels.length,
itemBuilder: (context, index) {
final label = labels[index];
return LabelListItem(
label: labels[index],
label: label,
imagePaths: imagePaths,
isSelected: label.id == labelIdSelected,
isDesktop: isDesktop,
onOpenLabelCallback: onOpenLabelCallback,
);