feat(ui): animate pinned message color
Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
@@ -596,26 +596,29 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
|
||||
|
||||
final showReactions = _shouldShowReactions;
|
||||
|
||||
final onMessageTap = widget.onMessageTap;
|
||||
|
||||
return Material(
|
||||
type: widget.message.pinned && widget.showPinHighlight
|
||||
? MaterialType.card
|
||||
: MaterialType.transparency,
|
||||
type: MaterialType.transparency,
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(seconds: 1),
|
||||
color: widget.message.pinned && widget.showPinHighlight
|
||||
? _streamChatTheme.colorTheme.highlight
|
||||
: null,
|
||||
: _streamChatTheme.colorTheme.barsBg.withOpacity(0),
|
||||
child: Portal(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
widget.onMessageTap!(widget.message);
|
||||
},
|
||||
onTap: onMessageTap == null
|
||||
? null
|
||||
: () => onMessageTap(widget.message),
|
||||
onLongPress: widget.message.isDeleted && !isFailedState
|
||||
? null
|
||||
: () => onLongPress(context),
|
||||
child: Padding(
|
||||
padding: widget.padding ?? const EdgeInsets.all(8),
|
||||
child: FractionallySizedBox(
|
||||
alignment:
|
||||
widget.reverse ? Alignment.centerRight : Alignment.centerLeft,
|
||||
alignment: widget.reverse
|
||||
? Alignment.centerRight
|
||||
: Alignment.centerLeft,
|
||||
widthFactor: 0.78,
|
||||
child: Column(
|
||||
crossAxisAlignment: widget.reverse
|
||||
@@ -655,7 +658,8 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
|
||||
_buildUserAvatar(),
|
||||
const SizedBox(width: 4),
|
||||
],
|
||||
if (widget.showUserAvatar == DisplayWidget.hide)
|
||||
if (widget.showUserAvatar ==
|
||||
DisplayWidget.hide)
|
||||
SizedBox(width: avatarWidth + 4),
|
||||
Flexible(
|
||||
child: PortalTarget(
|
||||
@@ -705,13 +709,13 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
|
||||
!isFailedState)
|
||||
? Container(
|
||||
// ignore: lines_longer_than_80_chars
|
||||
margin: EdgeInsets.symmetric(
|
||||
margin:
|
||||
EdgeInsets.symmetric(
|
||||
horizontal:
|
||||
// ignore: lines_longer_than_80_chars
|
||||
widget.showUserAvatar ==
|
||||
// ignore: lines_longer_than_80_chars
|
||||
DisplayWidget
|
||||
.gone
|
||||
DisplayWidget.gone
|
||||
? 0
|
||||
: 4.0,
|
||||
),
|
||||
@@ -728,7 +732,8 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
|
||||
: Card(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
elevation: 0,
|
||||
margin: EdgeInsets.symmetric(
|
||||
margin:
|
||||
EdgeInsets.symmetric(
|
||||
horizontal: (isFailedState
|
||||
? 15.0
|
||||
: 0.0) +
|
||||
@@ -756,10 +761,12 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
|
||||
.borderRadiusGeometry ??
|
||||
BorderRadius.zero,
|
||||
),
|
||||
color: _getBackgroundColor(),
|
||||
color:
|
||||
_getBackgroundColor(),
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.end,
|
||||
CrossAxisAlignment
|
||||
.end,
|
||||
mainAxisSize:
|
||||
MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
@@ -773,7 +780,8 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
|
||||
),
|
||||
),
|
||||
),
|
||||
if (widget.showReactionPickerIndicator)
|
||||
if (widget
|
||||
.showReactionPickerIndicator)
|
||||
Positioned(
|
||||
right: widget.reverse ? null : 4,
|
||||
left: widget.reverse ? 4 : null,
|
||||
@@ -802,7 +810,8 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
|
||||
],
|
||||
),
|
||||
if (showBottomRow)
|
||||
SizedBox(height: context.textScaleFactor * 18.0),
|
||||
SizedBox(
|
||||
height: context.textScaleFactor * 18.0),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -811,8 +820,9 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
|
||||
padding: EdgeInsets.only(
|
||||
left: !widget.reverse ? bottomRowPadding : 0,
|
||||
right: widget.reverse ? bottomRowPadding : 0,
|
||||
bottom:
|
||||
isPinned && widget.showPinHighlight ? 6.0 : 0.0,
|
||||
bottom: isPinned && widget.showPinHighlight
|
||||
? 6.0
|
||||
: 0.0,
|
||||
),
|
||||
child: widget.bottomRowBuilder?.call(
|
||||
context,
|
||||
@@ -835,6 +845,7 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1343,12 +1354,8 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
StreamSvgIcon.pin(
|
||||
size: 16,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
StreamSvgIcon.pin(size: 16),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
context.translations.pinnedByUserText(
|
||||
pinnedBy: pinnedBy,
|
||||
|
||||
Reference in New Issue
Block a user