Skip to content

Commit

Permalink
TW-1524: Remove hover on timestamp above message in chat
Browse files Browse the repository at this point in the history
  • Loading branch information
nqhhdev authored and hoangdat committed Mar 13, 2024
1 parent 6d7e7be commit 027ecfa
Showing 1 changed file with 94 additions and 95 deletions.
189 changes: 94 additions & 95 deletions lib/pages/chat/events/message/message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -135,104 +135,103 @@ class _MessageState extends State<Message> {

@override
Widget build(BuildContext context) {
return MultiPlatformsMessageContainer(
onTap: widget.hideKeyboardChatScreen,
onHover: (hover) {
if (widget.onHover != null) {
widget.onHover!(hover, widget.event);
}
},
child: LayoutBuilder(
builder: (context, constraints) {
if (!{
EventTypes.Message,
EventTypes.Sticker,
EventTypes.Encrypted,
EventTypes.CallInvite,
}.contains(widget.event.type)) {
if (widget.event.type.startsWith('m.call.')) {
return const SizedBox();
}
if (widget.event.isJoinedByRoomCreator()) {
return const SizedBox();
}
return StateMessage(widget.event);
return LayoutBuilder(
builder: (context, constraints) {
if (!{
EventTypes.Message,
EventTypes.Sticker,
EventTypes.Encrypted,
EventTypes.CallInvite,
}.contains(widget.event.type)) {
if (widget.event.type.startsWith('m.call.')) {
return const SizedBox();
}

if (widget.event.type == EventTypes.Message &&
widget.event.messageType == EventTypes.KeyVerificationRequest) {
return VerificationRequestContent(
event: widget.event,
timeline: widget.timeline,
);
if (widget.event.isJoinedByRoomCreator()) {
return const SizedBox();
}
return StateMessage(widget.event);
}

final displayTime = widget.event.type == EventTypes.RoomCreate ||
widget.nextEvent == null ||
!widget.event.originServerTs
.sameEnvironment(widget.nextEvent!.originServerTs);
final rowMainAxisAlignment = widget.event.isOwnMessage
? MainAxisAlignment.end
: MainAxisAlignment.start;
if (widget.event.type == EventTypes.Message &&
widget.event.messageType == EventTypes.KeyVerificationRequest) {
return VerificationRequestContent(
event: widget.event,
timeline: widget.timeline,
);
}

final rowChildren = <Widget>[
_placeHolderWidget(
widget.event.isSameSenderWith(widget.previousEvent),
widget.event.isOwnMessage,
widget.event,
final displayTime = widget.event.type == EventTypes.RoomCreate ||
widget.nextEvent == null ||
!widget.event.originServerTs
.sameEnvironment(widget.nextEvent!.originServerTs);
final rowMainAxisAlignment = widget.event.isOwnMessage
? MainAxisAlignment.end
: MainAxisAlignment.start;

final rowChildren = <Widget>[
_placeHolderWidget(
widget.event.isSameSenderWith(widget.previousEvent),
widget.event.isOwnMessage,
widget.event,
),
Expanded(
child: MessageContentWithTimestampBuilder(
event: widget.event,
nextEvent: widget.nextEvent,
onSelect: widget.onSelect,
scrollToEventId: widget.scrollToEventId,
selected: widget.selected,
selectMode: widget.selectMode,
timeline: widget.timeline,
isHoverNotifier: widget.isHoverNotifier,
listHorizontalActionMenu: widget.listHorizontalActionMenu,
onMenuAction: widget.onMenuAction,
menuChildren: widget.menuChildren,
focusNode: widget.focusNode,
),
Expanded(
child: MessageContentWithTimestampBuilder(
event: widget.event,
nextEvent: widget.nextEvent,
onSelect: widget.onSelect,
scrollToEventId: widget.scrollToEventId,
selected: widget.selected,
selectMode: widget.selectMode,
timeline: widget.timeline,
isHoverNotifier: widget.isHoverNotifier,
listHorizontalActionMenu: widget.listHorizontalActionMenu,
onMenuAction: widget.onMenuAction,
menuChildren: widget.menuChildren,
focusNode: widget.focusNode,
),
];
final row = Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: rowMainAxisAlignment,
children: rowChildren,
);
return Column(
children: [
if (displayTime)
ValueListenableBuilder(
valueListenable: inviewNotifier,
builder: (context, inView, _) {
return StickyTimestampWidget(
content: !inView
? widget.event.originServerTs.relativeTime(context)
: '',
);
},
),
),
];
final row = Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: rowMainAxisAlignment,
children: rowChildren,
);

return Column(
children: [
if (displayTime)
ValueListenableBuilder(
valueListenable: inviewNotifier,
builder: (context, inView, _) {
return StickyTimestampWidget(
content: !inView
? widget.event.originServerTs.relativeTime(context)
: '',
);
},
),
if (widget.markedUnreadLocation != null &&
widget.markedUnreadLocation == widget.event.eventId) ...[
Padding(
padding: MessageStyle.paddingDividerUnreadMessage,
child: Divider(
height: MessageStyle.heightDivider,
color: LinagoraStateLayer(
LinagoraSysColors.material().surfaceTint,
).opacityLayer3,
),
if (widget.markedUnreadLocation != null &&
widget.markedUnreadLocation == widget.event.eventId) ...[
Padding(
padding: MessageStyle.paddingDividerUnreadMessage,
child: Divider(
height: MessageStyle.heightDivider,
color: LinagoraStateLayer(
LinagoraSysColors.material().surfaceTint,
).opacityLayer3,
),
StickyTimestampWidget(
content: L10n.of(context)!.unreadMessages,
),
],
Container(
),
StickyTimestampWidget(
content: L10n.of(context)!.unreadMessages,
),
],
MultiPlatformsMessageContainer(
onTap: widget.hideKeyboardChatScreen,
onHover: (hover) {
if (widget.onHover != null) {
widget.onHover!(hover, widget.event);
}
},
child: Container(
constraints: BoxConstraints(
maxWidth: ChatViewBodyStyle.chatScreenMaxWidth,
),
Expand Down Expand Up @@ -274,10 +273,10 @@ class _MessageState extends State<Message> {
),
),
),
],
);
},
),
),
],
);
},
);
}

Expand Down

0 comments on commit 027ecfa

Please sign in to comment.