feat: add chat svg

This commit is contained in:
Kingtous 2023-01-31 22:49:17 +08:00
parent 2452a58eaa
commit efa4530c97
3 changed files with 58 additions and 41 deletions

1
flutter/assets/chat.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1675159173189" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1697" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512.7 797H292.9c-24 0-47.3 4.7-70 12.5-57.3 19.5-108 50.7-155.5 87.4-13 10-28.3 10.9-40.2 1.7-8.2-6.3-12.6-14.7-12.6-25.1 0-133.2-0.2-266.5 0.1-399.7 0.1-36.9 6.7-73.1 17.3-108.6 10.8-36.1 26.1-70.1 47.4-101.2 32.7-47.8 76.2-81.7 131.7-99.5 18-5.8 36.6-9 55.4-10.5 12.2-1 24.4-1.1 36.6-1.1 26.5 0 52.9-0.3 79.4 0.1 72.8 0.9 145.6 0.6 218.5 0.3 41.6-0.2 83.2-0.3 124.9-0.3 28.3 0 56.1 3.9 83 13.1 34.5 11.7 65.3 29.6 92.2 54.3 16 14.8 30.2 31.1 42.6 49 32.4 46.9 52 98.7 61.1 154.8 3.2 19.8 5.1 39.7 4.7 59.8-0.9 50.3-11.7 98.3-33 144-13 27.9-29.5 53.5-49.7 76.6-30.5 34.8-67.3 60.7-110.9 76.7-23.6 8.7-48 13.6-73 15.2-6.2 0.4-12.4 0.5-18.6 0.5H512.7z m-4.6-580.6c0-0.1 0-0.1 0 0-70.5-0.1-141-0.1-211.5-0.1-10.2 0-20.4 0.2-30.6 1.3-26.9 2.8-52.1 10.8-75.3 24.9-26.8 16.2-47.3 38.8-64.1 64.9-15 23.2-25.7 48.3-33.7 74.7-9.3 30.9-15.1 62.6-15.2 94.8-0.3 110.5-0.1 220.9-0.1 331.4 0 1-0.5 2.4 0.5 3 1 0.6 1.9-0.6 2.7-1.1 28.5-18.3 58.1-34.6 89.3-47.9 41.6-17.8 84.6-28.4 130.3-28.3 136.6 0.4 273.2 0.1 409.8 0.2 13.8 0 27.6-0.1 41.3-1.8 20.1-2.5 39.5-7.6 57.9-16.3 36.9-17.4 66.3-43.5 88.8-77.3 40-60.4 55.1-126.7 45.3-198.5-5.3-38.9-17.3-75.7-36.2-110.2-14.1-25.7-31.8-48.7-54.2-67.8-34.8-29.9-75.5-45.2-121.1-45.6-74.6-0.8-149.3-0.3-223.9-0.3z" p-id="1698"></path><path d="M548.2 673.6c-17.5 0.4-34.7-2.3-51.7-6.4-6.4-1.5-11.5-5-16.1-9.6-24.6-24.3-48.9-48.8-72.3-74.3-21.6-23.5-42.6-47.5-61.8-73.1-13.4-17.9-26.4-36.1-35.1-56.9-8.1-19.4-10.5-39.5-7.4-60.4 4.1-27.4 16.7-50.8 33.5-72.3 6.3-8 13.2-15.3 20.8-22 9.3-8.2 20.2-10.3 31.9-5.9 11.8 4.5 18.7 13.4 20.2 26.1 1.2 10.3-2.1 19.1-9.7 26.2-11.8 11.2-21.8 23.7-28.6 38.6-6.7 14.7-8.8 29.7-2.7 45.1 4 10.2 10.3 19.3 16.5 28.4 17.1 24.9 36.8 47.7 56.8 70.2 22.1 24.9 45.6 48.5 68.9 72.3 2.4 2.5 5.1 4.8 7.5 7.3 2.2 2.2 5.1 1.8 7.7 2.1 16.1 2.2 32.1 2.8 48-1.3 13.2-3.4 23.6-10.4 30.9-22.3 12-19.3 38-20.4 51.9-2.7 7.7 9.9 8.5 24.1 1.8 35.4-16 27.1-40.1 43.2-70.2 50.9-4.2 1.1-8.4 1.9-12.7 2.6-9.2 1.5-18.5 2.4-28.1 2zM532.5 315.7c0.1-10.5 10.4-18.2 20.3-15.1 22.8 7.2 43.9 17.5 63.6 31 21.2 14.6 38.1 33.1 51.9 54.6 16.2 25.1 27.7 52.3 34.8 81.2 1 4 1.8 8 2.5 12.1 1.5 8.1-3.6 16.1-11.5 18.2-7.8 2.1-16.1-2-19-9.7-0.8-2.2-1.2-4.7-1.8-7-8-35.7-22.7-68.2-46-96.7-14.3-17.4-32.4-30-52.2-40.2-10.1-5.2-20.6-9.5-31.5-13-7.1-2.2-11.1-8-11.1-15.4zM615.6 513.1c-8.1-0.1-14.1-5.1-15.8-13.6-3.2-15.8-9.1-30.5-17.6-44.1-14.4-23.1-34.1-39.9-59.3-50.2-1.5-0.6-3-0.9-4.5-1.4-8.7-2.9-13.3-11.7-10.6-20.1 2.9-8.8 11.6-13.1 20.5-10.1 38.1 12.8 65.8 38 85.4 72.5 8.5 15 14.3 31.1 17.5 48.2 1.9 9.8-5.5 18.8-15.6 18.8z" p-id="1699"></path></svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -9,6 +9,7 @@ import 'package:flutter_hbb/models/chat_model.dart';
import 'package:flutter_hbb/models/state_model.dart';
import 'package:flutter_hbb/consts.dart';
import 'package:flutter_hbb/utils/multi_window_manager.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:debounce_throttle/debounce_throttle.dart';
@ -478,20 +479,6 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
);
}
Widget _buildChat(BuildContext context) {
return IconButton(
tooltip: translate('Chat'),
onPressed: () {
widget.ffi.chatModel.changeCurrentID(ChatModel.clientModeID);
widget.ffi.chatModel.toggleChatOverlay();
},
icon: const Icon(
Icons.message,
color: _MenubarTheme.commonColor,
),
);
}
Widget _buildMonitor(BuildContext context) {
final pi = widget.ffi.ffiModel.pi;
return mod_menu.PopupMenuButton(
@ -695,6 +682,60 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
);
}
Widget _buildChat(BuildContext context) {
FfiModel ffiModel = Provider.of<FfiModel>(context);
return mod_menu.PopupMenuButton(
padding: EdgeInsets.zero,
icon: SvgPicture.asset(
"assets/chat.svg",
color: _MenubarTheme.commonColor,
width: Theme.of(context).iconTheme.size ?? 24.0,
height: Theme.of(context).iconTheme.size ?? 24.0,
),
tooltip: translate('Chat'),
position: mod_menu.PopupMenuPosition.under,
itemBuilder: (BuildContext context) => _getChatMenu(context)
.map((entry) => entry.build(
context,
const MenuConfig(
commonColor: _MenubarTheme.commonColor,
height: _MenubarTheme.height,
dividerHeight: _MenubarTheme.dividerHeight,
)))
.expand((i) => i)
.toList(),
);
}
List<MenuEntryBase<String>> _getChatMenu(BuildContext context) {
final List<MenuEntryBase<String>> chatMenu = [];
const EdgeInsets padding = EdgeInsets.only(left: 14.0, right: 5.0);
chatMenu.addAll([
MenuEntryButton<String>(
childBuilder: (TextStyle? style) => Text(
translate('Text chat'),
style: style,
),
proc: () {
widget.ffi.chatModel.changeCurrentID(ChatModel.clientModeID);
widget.ffi.chatModel.toggleChatOverlay();
},
padding: padding,
dismissOnClicked: true,
),
MenuEntryButton<String>(
childBuilder: (TextStyle? style) => Text(
translate('Voice call'),
style: style,
),
proc: () {},
padding: padding,
dismissOnClicked: true,
),
]);
return chatMenu;
}
List<MenuEntryBase<String>> _getControlMenu(BuildContext context) {
final pi = widget.ffi.ffiModel.pi;
final perms = widget.ffi.ffiModel.permissions;
@ -884,33 +925,6 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
// ));
// }
}
displayMenu.addAll([
MenuEntryDivider<String>(),
MenuEntryRadios<String>(
text: translate('Audio Transmission Mode'),
optionsGetter: () => [
MenuEntryRadioOption(
text: translate('Guest to host audio transmission'),
value: kRemoteAudioGuestToHost,
dismissOnClicked: true,
),
MenuEntryRadioOption(
text: translate('Dual-way audio transmission'),
value: kRemoteAudioDualWay,
dismissOnClicked: true,
),
],
curOptionGetter: () async =>
// null means peer id is not found, which there's no need to care about
await bind.sessionGetAudioMode(id: widget.id) ?? '',
optionSetter: (String oldValue, String newValue) async {
if (oldValue != newValue) {
await bind.sessionSetAudioMode(id: widget.id, value: newValue);
}
},
padding: padding,
),
]);
return displayMenu;
}

View File

@ -450,6 +450,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Dual way", "双向"),
("Guest to host audio transmission", "被控到主机音频传输"),
("Dual-way audio transmission", "双向音频传输"),
("Voice call", "语音通话"),
("Text chat", "文字聊天"),
("Audio Transmission Mode", "音频传输模式"),
].iter().cloned().collect();
}