From 7803a36bd91f9f32eeef29c4a89a9d56bef88669 Mon Sep 17 00:00:00 2001 From: nullpeer Date: Sun, 30 Nov 2025 15:14:27 +0300 Subject: [PATCH] context menu pc fix --- lib/screens/chats_screen.dart | 10 ++--- lib/screens/settings/settings_screen.dart | 3 +- lib/widgets/chat_message_bubble.dart | 49 +++++++++++++++++++++-- 3 files changed, 52 insertions(+), 10 deletions(-) diff --git a/lib/screens/chats_screen.dart b/lib/screens/chats_screen.dart index 40dd303..e0b18fd 100644 --- a/lib/screens/chats_screen.dart +++ b/lib/screens/chats_screen.dart @@ -744,7 +744,7 @@ class _ChatsScreenState extends State fontSize: 16, ), ), - const Spacer(), + /*const Spacer(), IconButton( icon: const Icon(Icons.search, size: 20), onPressed: () { @@ -755,7 +755,7 @@ class _ChatsScreenState extends State ); }, tooltip: 'Поиск каналов', - ), + ),*/ ], ), ), @@ -994,7 +994,7 @@ class _ChatsScreenState extends State }, ), - ListTile( + /*ListTile( leading: CircleAvatar( backgroundColor: Theme.of( context, @@ -1014,7 +1014,7 @@ class _ChatsScreenState extends State ), ); }, - ), + ),*/ ListTile( leading: CircleAvatar( @@ -3726,7 +3726,7 @@ class _ChatsScreenState extends State } } } - + void _showDeleteAccountDialog( BuildContext context, Account account, diff --git a/lib/screens/settings/settings_screen.dart b/lib/screens/settings/settings_screen.dart index 503085f..6911a6f 100644 --- a/lib/screens/settings/settings_screen.dart +++ b/lib/screens/settings/settings_screen.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:gwid/consts.dart'; import 'package:gwid/models/profile.dart'; import 'package:gwid/api/api_service.dart'; import 'package:gwid/screens/manage_account_screen.dart'; @@ -470,7 +471,7 @@ class _SettingsScreenState extends State { child: Padding( padding: const EdgeInsets.symmetric(vertical: 24.0), child: Text( - 'v0.3.0-beta.1', + version, textAlign: TextAlign.center, style: TextStyle( color: Theme.of( diff --git a/lib/widgets/chat_message_bubble.dart b/lib/widgets/chat_message_bubble.dart index 3333cb5..dbd68e2 100644 --- a/lib/widgets/chat_message_bubble.dart +++ b/lib/widgets/chat_message_bubble.dart @@ -26,9 +26,13 @@ import 'package:just_audio/just_audio.dart'; import 'package:gwid/services/cache_service.dart'; import 'package:video_player/video_player.dart'; import 'package:gwid/services/music_player_service.dart'; +import 'package:platform_info/platform_info.dart'; bool _currentIsDark = false; +bool isMobile = Platform.instance.operatingSystem.iOS || + Platform.instance.operatingSystem.android; + enum MessageReadStatus { sending, // Отправляется (часы) sent, // Отправлено (1 галочка) @@ -1081,12 +1085,22 @@ class ChatMessageBubble extends StatelessWidget { ); if (onReaction != null || (isMe && (onEdit != null || onDelete != null))) { - messageContent = GestureDetector( + if (isMobile) { + messageContent = GestureDetector( onTapDown: (TapDownDetails details) { _showMessageContextMenu(context, details.globalPosition); }, child: messageContent, ); + } else { + messageContent = GestureDetector( + onSecondaryTapDown: (TapDownDetails details) { + _showMessageContextMenu(context, details.globalPosition); + }, + child: messageContent, + ); + } + } return Column( @@ -1535,12 +1549,21 @@ class ChatMessageBubble extends StatelessWidget { ); if (onReaction != null || (isMe && (onEdit != null || onDelete != null))) { - videoContent = GestureDetector( + if (isMobile) { + videoContent = GestureDetector( onTapDown: (TapDownDetails details) { _showMessageContextMenu(context, details.globalPosition); }, child: videoContent, ); + } else { + videoContent = GestureDetector( + onSecondaryTapDown: (TapDownDetails details) { + _showMessageContextMenu(context, details.globalPosition); + }, + child: videoContent, + ); + } } return videoContent; @@ -1621,12 +1644,21 @@ class ChatMessageBubble extends StatelessWidget { ); if (onReaction != null || (isMe && (onEdit != null || onDelete != null))) { - photoContent = GestureDetector( + if (isMobile) { + photoContent = GestureDetector( onTapDown: (TapDownDetails details) { _showMessageContextMenu(context, details.globalPosition); }, child: photoContent, ); + } else { + photoContent = GestureDetector( + onTapDown: (TapDownDetails details) { + _showMessageContextMenu(context, details.globalPosition); + }, + child: photoContent, + ); + } } return photoContent; @@ -1749,12 +1781,21 @@ class ChatMessageBubble extends StatelessWidget { ); if (onReaction != null || (isMe && (onEdit != null || onDelete != null))) { - videoContent = GestureDetector( + if (isMobile) { + videoContent = GestureDetector( onTapDown: (TapDownDetails details) { _showMessageContextMenu(context, details.globalPosition); }, child: videoContent, ); + } else { + videoContent = GestureDetector( + onSecondaryTapDown: (TapDownDetails details) { + _showMessageContextMenu(context, details.globalPosition); + }, + child: videoContent, + ); + } } return videoContent;