TF-4227 Enable label item clickable action
This commit is contained in:
@@ -15,6 +15,7 @@ import 'package:tmail_ui_user/features/mailbox/presentation/extensions/toggle_ex
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/mailbox_controller.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/model/presentation_label_mailbox.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/styles/mailbox_item_widget_styles.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/widgets/folders_bar_widget.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/widgets/labels/label_list_view.dart';
|
||||
@@ -406,6 +407,10 @@ abstract class BaseMailboxView extends GetWidget<MailboxController>
|
||||
labels: labels,
|
||||
imagePaths: controller.imagePaths,
|
||||
isDesktop: isDesktop,
|
||||
onOpenLabelCallback: (label) => controller.openMailbox(
|
||||
context,
|
||||
PresentationLabelMailbox.initial(label),
|
||||
),
|
||||
)
|
||||
: const Offstage(),
|
||||
);
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart';
|
||||
import 'package:labels/model/label.dart';
|
||||
import 'package:model/mailbox/mailbox_state.dart';
|
||||
import 'package:model/mailbox/presentation_mailbox.dart';
|
||||
import 'package:model/mailbox/select_mode.dart';
|
||||
|
||||
class PresentationLabelMailbox extends PresentationMailbox {
|
||||
final Label label;
|
||||
|
||||
PresentationLabelMailbox(
|
||||
super.id,
|
||||
this.label, {
|
||||
super.name,
|
||||
super.parentId,
|
||||
super.role,
|
||||
super.sortOrder,
|
||||
super.totalEmails,
|
||||
super.unreadEmails,
|
||||
super.totalThreads,
|
||||
super.unreadThreads,
|
||||
super.myRights,
|
||||
super.isSubscribed,
|
||||
super.selectMode = SelectMode.INACTIVE,
|
||||
super.mailboxPath,
|
||||
super.state = MailboxState.activated,
|
||||
super.namespace,
|
||||
super.displayName,
|
||||
super.rights,
|
||||
});
|
||||
|
||||
factory PresentationLabelMailbox.initial(Label label) {
|
||||
return PresentationLabelMailbox(MailboxId(label.id!), label);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [label, ...super.props];
|
||||
}
|
||||
@@ -6,15 +6,19 @@ import 'package:tmail_ui_user/features/mailbox/presentation/styles/mailbox_item_
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/widgets/labels/label_icon_widget.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/widgets/labels/label_name_widget.dart';
|
||||
|
||||
typedef OnOpenLabelCallback = void Function(Label label);
|
||||
|
||||
class LabelListItem extends StatelessWidget {
|
||||
final Label label;
|
||||
final ImagePaths imagePaths;
|
||||
final bool isDesktop;
|
||||
final OnOpenLabelCallback onOpenLabelCallback;
|
||||
|
||||
const LabelListItem({
|
||||
super.key,
|
||||
required this.label,
|
||||
required this.imagePaths,
|
||||
required this.onOpenLabelCallback,
|
||||
this.isDesktop = false,
|
||||
});
|
||||
|
||||
@@ -32,6 +36,7 @@ class LabelListItem extends StatelessWidget {
|
||||
type: MaterialType.transparency,
|
||||
child: InkWell(
|
||||
borderRadius: borderRadius,
|
||||
onTap: () => onOpenLabelCallback(label),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(borderRadius: borderRadius),
|
||||
padding: EdgeInsetsDirectional.symmetric(
|
||||
|
||||
@@ -7,11 +7,13 @@ class LabelListView extends StatelessWidget {
|
||||
final List<Label> labels;
|
||||
final ImagePaths imagePaths;
|
||||
final bool isDesktop;
|
||||
final OnOpenLabelCallback onOpenLabelCallback;
|
||||
|
||||
const LabelListView({
|
||||
super.key,
|
||||
required this.labels,
|
||||
required this.imagePaths,
|
||||
required this.onOpenLabelCallback,
|
||||
this.isDesktop = false,
|
||||
});
|
||||
|
||||
@@ -28,6 +30,7 @@ class LabelListView extends StatelessWidget {
|
||||
label: labels[index],
|
||||
imagePaths: imagePaths,
|
||||
isDesktop: isDesktop,
|
||||
onOpenLabelCallback: onOpenLabelCallback,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user