Skip to content

Commit 2a1633b

Browse files
committed
Fix color param, use same logic as textMessage
1 parent bab0daf commit 2a1633b

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

packages/flyer_chat_video_message/lib/src/flyer_chat_video_message.dart

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ class FlyerChatVideoMessage extends StatefulWidget {
2727
/// Constraints for the image size.
2828
final BoxConstraints? constraints;
2929

30-
/// Background color used while the placeholder is visible.
31-
final Color? placeholderColor;
30+
/// Color of the overlay shown during video loading for a sent message
31+
final Color? sentLoadingOverlayColor;
3232

33-
/// Color of the overlay shown during image loading.
34-
final Color? loadingOverlayColor;
33+
/// Color of the overlay shown during video loading for a received message
34+
final Color? receivedLoadingOverlayColor;
3535

3636
/// Color of the circular progress indicator shown during image loading.
3737
final Color? loadingIndicatorColor;
@@ -82,8 +82,8 @@ class FlyerChatVideoMessage extends StatefulWidget {
8282
this.headers,
8383
this.borderRadius,
8484
this.constraints = const BoxConstraints(maxHeight: 300),
85-
this.placeholderColor,
86-
this.loadingOverlayColor,
85+
this.sentLoadingOverlayColor,
86+
this.receivedLoadingOverlayColor,
8787
this.loadingIndicatorColor,
8888
this.uploadOverlayColor,
8989
this.uploadIndicatorColor,
@@ -215,7 +215,7 @@ class _FlyerChatVideoMessageState extends State<FlyerChatVideoMessage> {
215215
_videoPlayerController?.value.isInitialized == true
216216
? VideoPlayer(_videoPlayerController!)
217217
: Container(
218-
color: widget.placeholderColor ?? Colors.black12,
218+
color: _resolveBackgroundColor(isSentByMe, theme),
219219
child: Center(
220220
child: CircularProgressIndicator(
221221
color:
@@ -286,4 +286,11 @@ class _FlyerChatVideoMessageState extends State<FlyerChatVideoMessage> {
286286
),
287287
);
288288
}
289+
290+
Color? _resolveBackgroundColor(bool isSentByMe, ChatTheme theme) {
291+
if (isSentByMe) {
292+
return widget.sentLoadingOverlayColor ?? theme.colors.primary;
293+
}
294+
return widget.receivedLoadingOverlayColor ?? theme.colors.surfaceContainer;
295+
}
289296
}

0 commit comments

Comments
 (0)