feat(ui): add onAttachmentTap to ImageGroup
This commit is contained in:
@@ -15,6 +15,7 @@ class ImageGroup extends StatelessWidget {
|
||||
required this.size,
|
||||
this.onReturnAction,
|
||||
this.onShowMessage,
|
||||
this.onAttachmentTap,
|
||||
}) : super(key: key);
|
||||
|
||||
/// List of attachments to show
|
||||
@@ -23,6 +24,9 @@ class ImageGroup extends StatelessWidget {
|
||||
/// Callback when attachment is returned to from other screens
|
||||
final ValueChanged<ReturnActionType>? onReturnAction;
|
||||
|
||||
/// Callback when attachment is tapped
|
||||
final void Function(Message message, Attachment attachment)? onAttachmentTap;
|
||||
|
||||
/// Message which images are attached to
|
||||
final Message message;
|
||||
|
||||
@@ -117,6 +121,10 @@ class ImageGroup extends StatelessWidget {
|
||||
BuildContext context,
|
||||
int index,
|
||||
) async {
|
||||
if (onAttachmentTap != null) {
|
||||
return onAttachmentTap!(message, images[index]);
|
||||
}
|
||||
|
||||
final channel = StreamChannel.of(context).channel;
|
||||
|
||||
final res = await Navigator.push(
|
||||
|
||||
@@ -133,6 +133,7 @@ class MessageWidget extends StatefulWidget {
|
||||
messageTheme: messageTheme,
|
||||
onShowMessage: onShowMessage,
|
||||
onReturnAction: onReturnAction,
|
||||
onAttachmentTap: onAttachmentTap,
|
||||
),
|
||||
),
|
||||
border,
|
||||
|
||||
Reference in New Issue
Block a user