Skip to content

Commit

Permalink
Comment component fixes (#46)
Browse files Browse the repository at this point in the history
fix: onDelete now gets invoked correctly for ZdsComment
fix: Voice notes can now be disabled without the assertion failing
  • Loading branch information
mikecoomber authored Nov 29, 2024
1 parent 8c85877 commit 5bf1345
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions example/lib/pages/components/comment.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ class _CommentDemoState extends State<CommentDemo> {
author: 'John Doe',
downloadCallback: () {},
comment: 'This is a comment',
onReply: () {},
onReply: () {
print('reply');
},
replySemanticLabel: 'Reply to comment',
onDelete: () {},
onDelete: () {
print('delete');
},
deleteSemanticLabel: 'Delete',
timeStamp: '09:30 AM',
attachment: ZdsChatAttachment(
Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/molecules/comment.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class ZdsComment extends StatelessWidget {
ZdsSlidableAction(
icon: ZetaIcons.delete,
semanticLabel: deleteSemanticLabel,
onPressed: (_) {},
onPressed: (_) => onDelete!(),
backgroundColor: colors.surfaceNegativeSubtle,
foregroundColor: colors.error,
),
Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/organisms/chat/message_input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ZdsMessageInput extends StatefulWidget {
this.allowVoiceNotes = false,
super.key,
}) : assert(
allowVoiceNotes && voiceNoteFileName != null,
(allowVoiceNotes && voiceNoteFileName != null) || !allowVoiceNotes,
'A value for voiceNoteFileName must be provided if allowVoiceNotes is enabled',
);

Expand Down

0 comments on commit 5bf1345

Please sign in to comment.