From ef4adaea6eb30efabc42c3a54007d024e6cc7533 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 6 Jan 2021 13:50:30 +0530 Subject: [PATCH] [MessageListView] Add messageHighlightColor property Signed-off-by: Sahil Kumar --- lib/src/message_list_view.dart | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/src/message_list_view.dart b/lib/src/message_list_view.dart index 68a1633b..294c6484 100644 --- a/lib/src/message_list_view.dart +++ b/lib/src/message_list_view.dart @@ -122,6 +122,7 @@ class MessageListView extends StatefulWidget { this.itemPositionListener, this.onMessageSwiped, this.highlightInitialMessage = false, + this.messageHighlightColor, this.onShowMessage, }) : super(key: key); @@ -175,6 +176,9 @@ class MessageListView extends StatefulWidget { /// Also See [StreamChannel] final bool highlightInitialMessage; + /// Color used while highlighting initial message + final Color messageHighlightColor; + final ShowMessageCallback onShowMessage; @override @@ -845,17 +849,16 @@ class _MessageListViewState extends State { if (!initialMessageHighlightComplete && widget.highlightInitialMessage && _isInitialMessage(message.id)) { - final accentColor = Theme.of(context).accentColor; + final colorTheme = StreamChatTheme.of(context).colorTheme; + final highlightColor = widget.messageHighlightColor ?? colorTheme.yellow; child = TweenAnimationBuilder( tween: ColorTween( - begin: accentColor.withOpacity(0.7), - end: Colors.transparent, + begin: highlightColor, + end: colorTheme.white.withOpacity(0), ), - duration: const Duration(seconds: 2), + duration: const Duration(seconds: 3), child: child, - onEnd: () { - initialMessageHighlightComplete = true; - }, + onEnd: () => initialMessageHighlightComplete = true, builder: (_, color, child) { return Container( color: color,