Skip to content

Commit

Permalink
fixup! fixup! fixup! TW-508: Keep horizontal when open context popup …
Browse files Browse the repository at this point in the history
…menu
  • Loading branch information
nqhhdev committed Aug 30, 2023
1 parent 0866080 commit 862830a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 14 deletions.
7 changes: 6 additions & 1 deletion lib/pages/chat/chat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,8 @@ class ChatController extends State<Chat>
}

void onHover(bool isHovered, int index, Event event) {
if (timeline!.events[index - 1].eventId == event.eventId &&
if (index > 0 &&
timeline!.events[index - 1].eventId == event.eventId &&
responsive.isDesktop(context) &&
!selectMode &&
!openingPopupMenu.value) {
Expand Down Expand Up @@ -1398,15 +1399,19 @@ class ChatController extends State<Chat>
switch (action) {
case ChatContextMenuActions.select:
onSelectMessage(event);
break;
case ChatContextMenuActions.copyMessage:
onSelectMessage(event);
copyEventsAction();
break;
case ChatContextMenuActions.pinMessage:
onSelectMessage(event);
pinEvent();
break;
case ChatContextMenuActions.forward:
onSelectMessage(event);
forwardEventsAction();
break;
}
}

Expand Down
5 changes: 3 additions & 2 deletions lib/pages/chat/events/message_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ class MessageContent extends StatelessWidget {
leading: CloseButton(onPressed: Navigator.of(context).pop),
title: Text(
l10n.whyIsThisMessageEncrypted,
style: TextStyle(fontSize: MessageContentStyle.appBarFontSize),
style:
const TextStyle(fontSize: MessageContentStyle.appBarFontSize),
),
),
body: SafeArea(
Expand Down Expand Up @@ -426,7 +427,7 @@ class _MessageImageBuilder extends StatelessWidget {
return ImageBubble(
event,
width: MessageContentStyle.imageBubbleWidth(context),
height: MessageContentStyle.imageBubbleHeight,
height: MessageContentStyle.imageBubbleHeightForWeb,
fit: BoxFit.cover,
onTapSelectMode: onTapSelectMode,
onTapPreview: onTapPreview,
Expand Down
13 changes: 7 additions & 6 deletions lib/pages/chat/events/message_content_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ import 'package:flutter/material.dart';
class MessageContentStyle {
static ResponsiveUtils responsiveUtils = getIt.get<ResponsiveUtils>();

static int get maxLengthTextInline => 180;
static double get appBarFontSize => 16.0;
static const int maxLengthTextInline = 180;
static const double appBarFontSize = 16.0;

static double imageBubbleWidth(BuildContext context) {
if (responsiveUtils.isDesktop(context)) {
return 500;
return imageBubbleHeightForWeb;
}
return 256;
}

static double get imageBubbleHeight => 500;
static Color get backgroundColorButton => Colors.white.withAlpha(64);
static const double imageBubbleHeightForWeb = 500;
static Color backgroundColorButton = Colors.white.withAlpha(64);

static double get letterSpacingMessageContent => -0.15;
static const double letterSpacingMessageContent = -0.15;
}
4 changes: 2 additions & 2 deletions lib/pages/chat/events/sending_image_info_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ class SendingImageInfoWidget extends StatelessWidget {
child: Image.file(
File(matrixFile.filePath!),
width: MessageContentStyle.imageBubbleWidth(context),
height: MessageContentStyle.imageBubbleHeight,
cacheHeight: MessageContentStyle.imageBubbleHeight.toInt(),
height: MessageContentStyle.imageBubbleHeightForWeb,
cacheHeight: MessageContentStyle.imageBubbleHeightForWeb.toInt(),
cacheWidth: MessageContentStyle.imageBubbleWidth(context).toInt(),
fit: BoxFit.cover,
filterQuality: FilterQuality.medium,
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/chat/events/sending_video_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class _SendingVideoWidgetState extends State<SendingVideoWidget>
if (imageWidth == null || imageHeight == null) {
return (
MessageContentStyle.imageBubbleWidth(context),
MessageContentStyle.imageBubbleHeight
MessageContentStyle.imageBubbleHeightForWeb
);
}

Expand All @@ -140,7 +140,7 @@ class _SendingVideoWidgetState extends State<SendingVideoWidget>
if (imageWidth <= imageHeight) {
return (
MessageContentStyle.imageBubbleWidth(context),
MessageContentStyle.imageBubbleHeight
MessageContentStyle.imageBubbleHeightForWeb
);
} else {
return (
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/chat/events/video_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
color: Colors.black,
child: SizedBox(
width: MessageContentStyle.imageBubbleWidth(context),
height: MessageContentStyle.imageBubbleHeight,
height: MessageContentStyle.imageBubbleHeightForWeb,
child: chewieManager != null
? FittedBox(
fit: BoxFit.contain,
Expand Down

0 comments on commit 862830a

Please sign in to comment.