feat(chat): фронт троеточия

This commit is contained in:
Jganenokk
2026-06-22 21:10:31 +07:00
parent 0f0d15f884
commit 3644c51a48
2 changed files with 271 additions and 9 deletions
+54 -9
View File
@@ -18,6 +18,7 @@ import 'package:komet/core/utils/logger.dart';
import 'package:komet/frontend/screens/chats/chat_info_screen.dart';
import 'package:komet/frontend/screens/chats/poll_create_screen.dart';
import 'package:komet/frontend/widgets/custom_notification.dart';
import 'package:komet/frontend/widgets/chat_menu_overlay.dart';
import 'package:material_symbols_icons/symbols.dart';
import '../../../main.dart';
import '../../../backend/api.dart';
@@ -1729,13 +1730,15 @@ class _ChatScreenState extends State<ChatScreen>
icon: Icon(Symbols.call, weight: 500, color: cs.onSurface),
onPressed: _startCall,
),
IconButton(
icon: Icon(
Symbols.more_vert,
weight: 500,
color: cs.onSurface,
Builder(
builder: (btnContext) => IconButton(
icon: Icon(
Symbols.more_vert,
weight: 500,
color: cs.onSurface,
),
onPressed: () => _openChatMenu(btnContext),
),
onPressed: () {},
),
],
),
@@ -1874,9 +1877,11 @@ class _ChatScreenState extends State<ChatScreen>
icon: Icon(Symbols.call, weight: 400, color: cs.onSurface),
onPressed: _startCall,
),
IconButton(
icon: Icon(Symbols.more_vert, weight: 400, color: cs.onSurface),
onPressed: () {},
Builder(
builder: (btnContext) => IconButton(
icon: Icon(Symbols.more_vert, weight: 400, color: cs.onSurface),
onPressed: () => _openChatMenu(btnContext),
),
),
],
);
@@ -1999,6 +2004,46 @@ class _ChatScreenState extends State<ChatScreen>
);
}
void _openChatMenu(BuildContext btnContext) {
final box = btnContext.findRenderObject() as RenderBox?;
if (box == null || !box.hasSize) return;
final anchorRect = box.localToGlobal(Offset.zero) & box.size;
showChatMenu(
context: context,
anchorRect: anchorRect,
items: [
ChatMenuItem(
icon: Symbols.volume_up,
label: 'Уведомления',
showChevron: true,
dividerAfter: true,
onTap: () {},
),
ChatMenuItem(
icon: Symbols.videocam,
label: 'Видеозвонок',
onTap: () {},
),
ChatMenuItem(icon: Symbols.search, label: 'Поиск', onTap: () {}),
ChatMenuItem(
icon: Symbols.wallpaper,
label: 'Изменить обои',
onTap: () {},
),
ChatMenuItem(
icon: Symbols.mop,
label: 'Очистить историю',
onTap: () {},
),
ChatMenuItem(
icon: Symbols.delete,
label: 'Удалить чат',
onTap: () {},
),
],
);
}
Future<void> _startCall() async {
if (widget.chatType != 'DIALOG') {
showCustomNotification(context, 'Звонки доступны только в диалогах');