@@ -73,6 +73,11 @@ class FlyerChatVideoMessage extends StatefulWidget {
7373 /// Color of the play icon.
7474 final Color playIconColor;
7575
76+ /// Optional builder function that returns a Future of high resolution thumbnail [ImageProvider]
77+ /// for the video message. If provided, this will be used instead of the default
78+ /// thumbnail generation.
79+ final Future <ImageProvider ?> Function ()? highResThumbnailProviderBuilder;
80+
7681 /// Creates a widget to display an video message.
7782 const FlyerChatVideoMessage ({
7883 super .key,
@@ -95,6 +100,7 @@ class FlyerChatVideoMessage extends StatefulWidget {
95100 this .playIcon = Icons .play_circle_fill,
96101 this .playIconSize = 48 ,
97102 this .playIconColor = Colors .white,
103+ this .highResThumbnailProviderBuilder,
98104 });
99105
100106 @override
@@ -141,6 +147,17 @@ class _FlyerChatVideoMessageState extends State<FlyerChatVideoMessage> {
141147 }
142148
143149 Future <void > _generateImageCover () async {
150+ if (widget.highResThumbnailProviderBuilder != null ) {
151+ final provider = await widget.highResThumbnailProviderBuilder !();
152+ if (mounted && provider != null ) {
153+ setState (() {
154+ _placeholderProvider = provider;
155+ });
156+ }
157+ return ;
158+ }
159+
160+ // TODO use cache manager (or crosscache? to save the image)
144161 final coverImageBytes = await VideoThumbnail .thumbnailData (
145162 video: widget.message.source,
146163 imageFormat: ImageFormat .WEBP ,
0 commit comments