mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-27 14:59:02 +08:00
fix: web chat (#9588)
* fix: web chat Signed-off-by: fufesou <linlong1266@gmail.com> * add missing svg Signed-off-by: fufesou <linlong1266@gmail.com> --------- Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
parent
9bcd0d1b03
commit
2591d4f044
1
flutter/assets/message_24dp_5F6368.svg
Normal file
1
flutter/assets/message_24dp_5F6368.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="-4 -4 32 32" width="24px" fill="#5f6368"><path d="M0 0h24v24H0z" fill="none"/><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 12H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z"/></svg>
|
After Width: | Height: | Size: 277 B |
@ -479,8 +479,8 @@ class _RemoteToolbarState extends State<RemoteToolbar> {
|
|||||||
setFullscreen: _setFullscreen,
|
setFullscreen: _setFullscreen,
|
||||||
));
|
));
|
||||||
toolbarItems.add(_KeyboardMenu(id: widget.id, ffi: widget.ffi));
|
toolbarItems.add(_KeyboardMenu(id: widget.id, ffi: widget.ffi));
|
||||||
|
toolbarItems.add(_ChatMenu(id: widget.id, ffi: widget.ffi));
|
||||||
if (!isWeb) {
|
if (!isWeb) {
|
||||||
toolbarItems.add(_ChatMenu(id: widget.id, ffi: widget.ffi));
|
|
||||||
toolbarItems.add(_VoiceCallMenu(id: widget.id, ffi: widget.ffi));
|
toolbarItems.add(_VoiceCallMenu(id: widget.id, ffi: widget.ffi));
|
||||||
}
|
}
|
||||||
if (!isWeb) toolbarItems.add(_RecordMenu());
|
if (!isWeb) toolbarItems.add(_RecordMenu());
|
||||||
@ -1781,34 +1781,49 @@ class _ChatMenuState extends State<_ChatMenu> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return _IconSubmenuButton(
|
if (isWeb) {
|
||||||
tooltip: 'Chat',
|
return buildTextChatButton();
|
||||||
key: chatButtonKey,
|
} else {
|
||||||
svg: 'assets/chat.svg',
|
return _IconSubmenuButton(
|
||||||
ffi: widget.ffi,
|
tooltip: 'Chat',
|
||||||
color: _ToolbarTheme.blueColor,
|
key: chatButtonKey,
|
||||||
hoverColor: _ToolbarTheme.hoverBlueColor,
|
svg: 'assets/chat.svg',
|
||||||
menuChildrenGetter: () => [textChat(), voiceCall()]);
|
ffi: widget.ffi,
|
||||||
|
color: _ToolbarTheme.blueColor,
|
||||||
|
hoverColor: _ToolbarTheme.hoverBlueColor,
|
||||||
|
menuChildrenGetter: () => [textChat(), voiceCall()]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTextChatButton() {
|
||||||
|
return _IconMenuButton(
|
||||||
|
assetName: 'assets/message_24dp_5F6368.svg',
|
||||||
|
tooltip: 'Text chat',
|
||||||
|
key: chatButtonKey,
|
||||||
|
onPressed: _textChatOnPressed,
|
||||||
|
color: _ToolbarTheme.blueColor,
|
||||||
|
hoverColor: _ToolbarTheme.hoverBlueColor,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
textChat() {
|
textChat() {
|
||||||
return MenuButton(
|
return MenuButton(
|
||||||
child: Text(translate('Text chat')),
|
child: Text(translate('Text chat')),
|
||||||
ffi: widget.ffi,
|
ffi: widget.ffi,
|
||||||
onPressed: () {
|
onPressed: _textChatOnPressed);
|
||||||
RenderBox? renderBox =
|
}
|
||||||
chatButtonKey.currentContext?.findRenderObject() as RenderBox?;
|
|
||||||
|
|
||||||
Offset? initPos;
|
_textChatOnPressed() {
|
||||||
if (renderBox != null) {
|
RenderBox? renderBox =
|
||||||
final pos = renderBox.localToGlobal(Offset.zero);
|
chatButtonKey.currentContext?.findRenderObject() as RenderBox?;
|
||||||
initPos = Offset(pos.dx, pos.dy + _ToolbarTheme.dividerHeight);
|
Offset? initPos;
|
||||||
}
|
if (renderBox != null) {
|
||||||
|
final pos = renderBox.localToGlobal(Offset.zero);
|
||||||
widget.ffi.chatModel.changeCurrentKey(
|
initPos = Offset(pos.dx, pos.dy + _ToolbarTheme.dividerHeight);
|
||||||
MessageKey(widget.ffi.id, ChatModel.clientModeID));
|
}
|
||||||
widget.ffi.chatModel.toggleChatOverlay(chatInitPos: initPos);
|
widget.ffi.chatModel
|
||||||
});
|
.changeCurrentKey(MessageKey(widget.ffi.id, ChatModel.clientModeID));
|
||||||
|
widget.ffi.chatModel.toggleChatOverlay(chatInitPos: initPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
voiceCall() {
|
voiceCall() {
|
||||||
|
@ -235,13 +235,14 @@ class ChatModel with ChangeNotifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_isChatOverlayHide() => ((!isDesktop && chatIconOverlayEntry == null) ||
|
_isChatOverlayHide() =>
|
||||||
chatWindowOverlayEntry == null);
|
((!(isDesktop || isWebDesktop) && chatIconOverlayEntry == null) ||
|
||||||
|
chatWindowOverlayEntry == null);
|
||||||
|
|
||||||
toggleChatOverlay({Offset? chatInitPos}) {
|
toggleChatOverlay({Offset? chatInitPos}) {
|
||||||
if (_isChatOverlayHide()) {
|
if (_isChatOverlayHide()) {
|
||||||
gFFI.invokeMethod("enable_soft_keyboard", true);
|
gFFI.invokeMethod("enable_soft_keyboard", true);
|
||||||
if (!isDesktop) {
|
if (!(isDesktop || isWebDesktop)) {
|
||||||
showChatIconOverlay();
|
showChatIconOverlay();
|
||||||
}
|
}
|
||||||
showChatWindowOverlay(chatInitPos: chatInitPos);
|
showChatWindowOverlay(chatInitPos: chatInitPos);
|
||||||
|
@ -468,7 +468,8 @@ class RustdeskImpl {
|
|||||||
|
|
||||||
Future<void> sessionSendChat(
|
Future<void> sessionSendChat(
|
||||||
{required UuidValue sessionId, required String text, dynamic hint}) {
|
{required UuidValue sessionId, required String text, dynamic hint}) {
|
||||||
throw UnimplementedError();
|
return Future(
|
||||||
|
() => js.context.callMethod('setByName', ['send_chat', text]));
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> sessionPeerOption(
|
Future<void> sessionPeerOption(
|
||||||
@ -1188,7 +1189,8 @@ class RustdeskImpl {
|
|||||||
|
|
||||||
Future<void> sessionSendNote(
|
Future<void> sessionSendNote(
|
||||||
{required UuidValue sessionId, required String note, dynamic hint}) {
|
{required UuidValue sessionId, required String note, dynamic hint}) {
|
||||||
return Future(() => js.context.callMethod('setByName', ['send_note', note]));
|
return Future(
|
||||||
|
() => js.context.callMethod('setByName', ['send_note', note]));
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> sessionAlternativeCodecs(
|
Future<String> sessionAlternativeCodecs(
|
||||||
|
Loading…
Reference in New Issue
Block a user