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