Skip to content

Commit

Permalink
test: Added basic test cases for ZetaChatItem
Browse files Browse the repository at this point in the history
  • Loading branch information
thelukewalton committed Aug 22, 2024
1 parent d40b127 commit 09cd1bc
Show file tree
Hide file tree
Showing 10 changed files with 517 additions and 7 deletions.
25 changes: 25 additions & 0 deletions example/lib/pages/components/chat_item_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,31 @@ class ChatItemExample extends StatelessWidget {
child: SingleChildScrollView(
child: Column(
children: [
ZetaChatItem(
leading: const ZetaAvatar(initials: 'AZ'),
slidableActions: [
ZetaSlidableAction(
onPressed: () {},
paleColor: true,
icon: Icons.star,
),
ZetaSlidableAction(
onPressed: () {},
paleColor: true,
icon: Icons.delete,
),
ZetaSlidableAction(
onPressed: () {},
icon: Icons.call,
),
ZetaSlidableAction(
onPressed: () {},
icon: Icons.message,
),
],
title: Text('title'),
subtitle: Text('subtitle'),
),
ZetaChatItem(
explicitChildNodes: false,
time: DateTime.now(),
Expand Down
15 changes: 8 additions & 7 deletions lib/src/components/chat_item/chat_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class ZetaChatItem extends ZetaStatelessWidget {

final actions = [...slidableActions];

// coverage:ignore-start
if (onMenuMoreTap != null) {
actions.add(
ZetaSlidableAction(onPressed: onMenuMoreTap, color: colors.purple, icon: ZetaIcons.more_vertical),
Expand All @@ -149,6 +150,7 @@ class ZetaChatItem extends ZetaStatelessWidget {
if (onDeleteTap != null) {
actions.add(ZetaSlidableAction(onPressed: onDeleteTap, color: colors.red, icon: ZetaIcons.delete));
}
// coverage:ignore-end

return ZetaRoundedScope(
rounded: context.rounded,
Expand Down Expand Up @@ -372,7 +374,7 @@ class ZetaSlidableAction extends StatelessWidget {
super.key,
this.onPressed,
required this.icon,
this.color,
this.color = ZetaColorBase.blue,
this.customForegroundColor,
this.customBackgroundColor,
this.semanticLabel,
Expand Down Expand Up @@ -536,12 +538,11 @@ class ZetaSlidableAction extends StatelessWidget {
super.debugFillProperties(properties);
properties
..add(ObjectFlagProperty<VoidCallback?>.has('onPressed', onPressed))
..add(DiagnosticsProperty<IconData>('icon', icon))
..add(ColorProperty('foregroundColor', customForegroundColor))
..add(ColorProperty('backgroundColor', customBackgroundColor))
..add(DiagnosticsProperty<IconData>('icon', icon))
..add(ColorProperty('color', color))
..add(DiagnosticsProperty<bool>('paleColor', paleColor))
..add(StringProperty('semanticLabel', semanticLabel))
..add(DiagnosticsProperty<bool>('paleColor', paleColor));
..add(ColorProperty('color', color))
..add(ColorProperty('customBackgroundColor', customBackgroundColor))
..add(ColorProperty('customForegroundColor', customForegroundColor))
..add(DiagnosticsProperty<IconData>('icon', icon));
}
}
Loading

0 comments on commit 09cd1bc

Please sign in to comment.