feat(ui): expose attachment actions modal builder
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
✅ Added
|
✅ Added
|
||||||
|
|
||||||
- Now it is possible to customize the max lines of the title of a url attachment. Before it was always 1 line.
|
- Now it is possible to customize the max lines of the title of a url attachment. Before it was always 1 line.
|
||||||
|
- Added `attachmentActionsModalBuilder` parameter to `StreamMessageWidget` that allows to customize `AttachmentActionsModal`.
|
||||||
|
|
||||||
🔄 Changed
|
🔄 Changed
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ class StreamGiphyAttachment extends StreamAttachmentWidget {
|
|||||||
this.onShowMessage,
|
this.onShowMessage,
|
||||||
this.onReplyMessage,
|
this.onReplyMessage,
|
||||||
this.onAttachmentTap,
|
this.onAttachmentTap,
|
||||||
|
this.attachmentActionsModalBuilder,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// {@macro showMessageCallback}
|
/// {@macro showMessageCallback}
|
||||||
@@ -28,6 +29,9 @@ class StreamGiphyAttachment extends StreamAttachmentWidget {
|
|||||||
/// {@macro onAttachmentTap}
|
/// {@macro onAttachmentTap}
|
||||||
final OnAttachmentTap? onAttachmentTap;
|
final OnAttachmentTap? onAttachmentTap;
|
||||||
|
|
||||||
|
/// {@macro attachmentActionsBuilder}
|
||||||
|
final AttachmentActionsBuilder? attachmentActionsModalBuilder;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final imageUrl =
|
final imageUrl =
|
||||||
@@ -260,6 +264,7 @@ class StreamGiphyAttachment extends StreamAttachmentWidget {
|
|||||||
userName: message.user!.name,
|
userName: message.user!.name,
|
||||||
onShowMessage: onShowMessage,
|
onShowMessage: onShowMessage,
|
||||||
onReplyMessage: onReplyMessage,
|
onReplyMessage: onReplyMessage,
|
||||||
|
attachmentActionsModalBuilder: attachmentActionsModalBuilder,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class StreamImageAttachment extends StreamAttachmentWidget {
|
|||||||
this.imageThumbnailSize = const Size(400, 400),
|
this.imageThumbnailSize = const Size(400, 400),
|
||||||
this.imageThumbnailResizeType = 'clip',
|
this.imageThumbnailResizeType = 'clip',
|
||||||
this.imageThumbnailCropType = 'center',
|
this.imageThumbnailCropType = 'center',
|
||||||
|
this.attachmentActionsModalBuilder,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// The [StreamMessageThemeData] to use for the image title
|
/// The [StreamMessageThemeData] to use for the image title
|
||||||
@@ -52,6 +53,9 @@ class StreamImageAttachment extends StreamAttachmentWidget {
|
|||||||
/// Defaults to [center]
|
/// Defaults to [center]
|
||||||
final String /*center|top|bottom|left|right*/ imageThumbnailCropType;
|
final String /*center|top|bottom|left|right*/ imageThumbnailCropType;
|
||||||
|
|
||||||
|
/// {@macro attachmentActionsBuilder}
|
||||||
|
final AttachmentActionsBuilder? attachmentActionsModalBuilder;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return source.when(
|
return source.when(
|
||||||
@@ -161,6 +165,8 @@ class StreamImageAttachment extends StreamAttachmentWidget {
|
|||||||
userName: message.user!.name,
|
userName: message.user!.name,
|
||||||
onShowMessage: onShowMessage,
|
onShowMessage: onShowMessage,
|
||||||
onReplyMessage: onReplyMessage,
|
onReplyMessage: onReplyMessage,
|
||||||
|
attachmentActionsModalBuilder:
|
||||||
|
attachmentActionsModalBuilder,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ class StreamImageGroup extends StatelessWidget {
|
|||||||
this.imageThumbnailSize = const Size(400, 400),
|
this.imageThumbnailSize = const Size(400, 400),
|
||||||
this.imageThumbnailResizeType = 'clip',
|
this.imageThumbnailResizeType = 'clip',
|
||||||
this.imageThumbnailCropType = 'center',
|
this.imageThumbnailCropType = 'center',
|
||||||
|
this.attachmentActionsModalBuilder,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// List of attachments to show
|
/// List of attachments to show
|
||||||
@@ -54,6 +55,9 @@ class StreamImageGroup extends StatelessWidget {
|
|||||||
/// Defaults to [center]
|
/// Defaults to [center]
|
||||||
final String /*center|top|bottom|left|right*/ imageThumbnailCropType;
|
final String /*center|top|bottom|left|right*/ imageThumbnailCropType;
|
||||||
|
|
||||||
|
/// {@macro attachmentActionsBuilder}
|
||||||
|
final AttachmentActionsBuilder? attachmentActionsModalBuilder;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ConstrainedBox(
|
return ConstrainedBox(
|
||||||
@@ -154,6 +158,7 @@ class StreamImageGroup extends StatelessWidget {
|
|||||||
userName: message.user!.name,
|
userName: message.user!.name,
|
||||||
onShowMessage: onShowMessage,
|
onShowMessage: onShowMessage,
|
||||||
onReplyMessage: onReplyMessage,
|
onReplyMessage: onReplyMessage,
|
||||||
|
attachmentActionsModalBuilder: attachmentActionsModalBuilder,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -170,6 +175,7 @@ class StreamImageGroup extends StatelessWidget {
|
|||||||
imageThumbnailSize: imageThumbnailSize,
|
imageThumbnailSize: imageThumbnailSize,
|
||||||
imageThumbnailResizeType: imageThumbnailResizeType,
|
imageThumbnailResizeType: imageThumbnailResizeType,
|
||||||
imageThumbnailCropType: imageThumbnailCropType,
|
imageThumbnailCropType: imageThumbnailCropType,
|
||||||
|
attachmentActionsModalBuilder: attachmentActionsModalBuilder,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ class StreamVideoAttachment extends StreamAttachmentWidget {
|
|||||||
this.onShowMessage,
|
this.onShowMessage,
|
||||||
this.onReplyMessage,
|
this.onReplyMessage,
|
||||||
this.onAttachmentTap,
|
this.onAttachmentTap,
|
||||||
|
this.attachmentActionsModalBuilder,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// The [StreamMessageThemeData] to use for the title
|
/// The [StreamMessageThemeData] to use for the title
|
||||||
@@ -31,6 +32,9 @@ class StreamVideoAttachment extends StreamAttachmentWidget {
|
|||||||
/// {@macro onAttachmentTap}
|
/// {@macro onAttachmentTap}
|
||||||
final OnAttachmentTap? onAttachmentTap;
|
final OnAttachmentTap? onAttachmentTap;
|
||||||
|
|
||||||
|
/// {@macro attachmentActionsBuilder}
|
||||||
|
final AttachmentActionsBuilder? attachmentActionsModalBuilder;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return source.when(
|
return source.when(
|
||||||
@@ -86,6 +90,8 @@ class StreamVideoAttachment extends StreamAttachmentWidget {
|
|||||||
userName: message.user!.name,
|
userName: message.user!.name,
|
||||||
onShowMessage: onShowMessage,
|
onShowMessage: onShowMessage,
|
||||||
onReplyMessage: onReplyMessage,
|
onReplyMessage: onReplyMessage,
|
||||||
|
attachmentActionsModalBuilder:
|
||||||
|
attachmentActionsModalBuilder,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ class StreamMessageWidget extends StatefulWidget {
|
|||||||
this.imageAttachmentThumbnailSize = const Size(400, 400),
|
this.imageAttachmentThumbnailSize = const Size(400, 400),
|
||||||
this.imageAttachmentThumbnailResizeType = 'clip',
|
this.imageAttachmentThumbnailResizeType = 'clip',
|
||||||
this.imageAttachmentThumbnailCropType = 'center',
|
this.imageAttachmentThumbnailCropType = 'center',
|
||||||
|
this.attachmentActionsModalBuilder,
|
||||||
}) : assert(
|
}) : assert(
|
||||||
bottomRowBuilder == null || bottomRowBuilderWithDefaultWidget == null,
|
bottomRowBuilder == null || bottomRowBuilderWithDefaultWidget == null,
|
||||||
'You can only use one of the two bottom row builders',
|
'You can only use one of the two bottom row builders',
|
||||||
@@ -144,6 +145,8 @@ class StreamMessageWidget extends StatefulWidget {
|
|||||||
imageThumbnailResizeType:
|
imageThumbnailResizeType:
|
||||||
imageAttachmentThumbnailResizeType,
|
imageAttachmentThumbnailResizeType,
|
||||||
imageThumbnailCropType: imageAttachmentThumbnailCropType,
|
imageThumbnailCropType: imageAttachmentThumbnailCropType,
|
||||||
|
attachmentActionsModalBuilder:
|
||||||
|
attachmentActionsModalBuilder,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
attachmentShape: border,
|
attachmentShape: border,
|
||||||
@@ -171,6 +174,7 @@ class StreamMessageWidget extends StatefulWidget {
|
|||||||
imageThumbnailSize: imageAttachmentThumbnailSize,
|
imageThumbnailSize: imageAttachmentThumbnailSize,
|
||||||
imageThumbnailResizeType: imageAttachmentThumbnailResizeType,
|
imageThumbnailResizeType: imageAttachmentThumbnailResizeType,
|
||||||
imageThumbnailCropType: imageAttachmentThumbnailCropType,
|
imageThumbnailCropType: imageAttachmentThumbnailCropType,
|
||||||
|
attachmentActionsModalBuilder: attachmentActionsModalBuilder,
|
||||||
),
|
),
|
||||||
attachmentShape: border,
|
attachmentShape: border,
|
||||||
);
|
);
|
||||||
@@ -204,6 +208,8 @@ class StreamMessageWidget extends StatefulWidget {
|
|||||||
onAttachmentTap(message, attachment);
|
onAttachmentTap(message, attachment);
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
|
attachmentActionsModalBuilder:
|
||||||
|
attachmentActionsModalBuilder,
|
||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
),
|
),
|
||||||
@@ -533,6 +539,9 @@ class StreamMessageWidget extends StatefulWidget {
|
|||||||
/// {@macro onMessageWidgetAttachmentTap}
|
/// {@macro onMessageWidgetAttachmentTap}
|
||||||
final OnMessageWidgetAttachmentTap? onAttachmentTap;
|
final OnMessageWidgetAttachmentTap? onAttachmentTap;
|
||||||
|
|
||||||
|
/// {@macro attachmentActionsBuilder}
|
||||||
|
final AttachmentActionsBuilder? attachmentActionsModalBuilder;
|
||||||
|
|
||||||
/// Size of the image attachment thumbnail.
|
/// Size of the image attachment thumbnail.
|
||||||
final Size imageAttachmentThumbnailSize;
|
final Size imageAttachmentThumbnailSize;
|
||||||
|
|
||||||
@@ -617,6 +626,7 @@ class StreamMessageWidget extends StatefulWidget {
|
|||||||
Size? imageAttachmentThumbnailSize,
|
Size? imageAttachmentThumbnailSize,
|
||||||
String? imageAttachmentThumbnailResizeType,
|
String? imageAttachmentThumbnailResizeType,
|
||||||
String? imageAttachmentThumbnailCropType,
|
String? imageAttachmentThumbnailCropType,
|
||||||
|
AttachmentActionsBuilder? attachmentActionsModalBuilder,
|
||||||
}) {
|
}) {
|
||||||
assert(
|
assert(
|
||||||
bottomRowBuilder == null || bottomRowBuilderWithDefaultWidget == null,
|
bottomRowBuilder == null || bottomRowBuilderWithDefaultWidget == null,
|
||||||
@@ -703,6 +713,8 @@ class StreamMessageWidget extends StatefulWidget {
|
|||||||
this.imageAttachmentThumbnailResizeType,
|
this.imageAttachmentThumbnailResizeType,
|
||||||
imageAttachmentThumbnailCropType: imageAttachmentThumbnailCropType ??
|
imageAttachmentThumbnailCropType: imageAttachmentThumbnailCropType ??
|
||||||
this.imageAttachmentThumbnailCropType,
|
this.imageAttachmentThumbnailCropType,
|
||||||
|
attachmentActionsModalBuilder:
|
||||||
|
attachmentActionsModalBuilder ?? this.attachmentActionsModalBuilder,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user