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