mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-27 23:19:02 +08:00
replaced buttons with switches
This commit is contained in:
parent
8706541aa9
commit
ec4a95f906
@ -76,7 +76,8 @@ extension StringExtension on String {
|
||||
String get nonBreaking => replaceAll(' ', String.fromCharCode($nbsp));
|
||||
}
|
||||
|
||||
const Size kConnectionManagerWindowSize = Size(300, 400);
|
||||
const Size kConnectionManagerWindowSizeClosedChat = Size(300, 500);
|
||||
const Size kConnectionManagerWindowSizeOpenChat = Size(600, 500);
|
||||
// Tabbar transition duration, now we remove the duration
|
||||
const Duration kTabTransitionDuration = Duration.zero;
|
||||
const double kEmptyMarginTop = 50;
|
||||
|
@ -408,17 +408,12 @@ class _PrivilegeBoard extends StatefulWidget {
|
||||
|
||||
class _PrivilegeBoardState extends State<_PrivilegeBoard> {
|
||||
late final client = widget.client;
|
||||
Widget buildPermissionIcon(
|
||||
bool enabled, ImageProvider icon, Function(bool)? onTap, String tooltip) {
|
||||
return Tooltip(
|
||||
message: tooltip,
|
||||
child: Ink(
|
||||
decoration:
|
||||
BoxDecoration(color: enabled ? MyTheme.accent80 : Colors.grey),
|
||||
padding: EdgeInsets.all(4.0),
|
||||
child: InkWell(
|
||||
onTap: () =>
|
||||
checkClickTime(widget.client.id, () => onTap?.call(!enabled)),
|
||||
Widget buildPermissionTile(bool enabled, ImageProvider icon,
|
||||
Function(bool)? onTap, String tooltipText) {
|
||||
return Row(
|
||||
children: [
|
||||
Tooltip(
|
||||
message: tooltipText,
|
||||
child: Image(
|
||||
image: icon,
|
||||
width: 50,
|
||||
@ -426,7 +421,12 @@ class _PrivilegeBoardState extends State<_PrivilegeBoard> {
|
||||
fit: BoxFit.scaleDown,
|
||||
),
|
||||
),
|
||||
).marginSymmetric(horizontal: 4.0),
|
||||
Switch(
|
||||
value: enabled,
|
||||
onChanged: (v) =>
|
||||
checkClickTime(widget.client.id, () => onTap?.call(v)),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@ -445,44 +445,44 @@ class _PrivilegeBoardState extends State<_PrivilegeBoard> {
|
||||
height: 8.0,
|
||||
),
|
||||
FittedBox(
|
||||
child: Row(
|
||||
child: Column(
|
||||
children: [
|
||||
buildPermissionIcon(client.keyboard, iconKeyboard, (enabled) {
|
||||
buildPermissionTile(client.keyboard, iconKeyboard, (enabled) {
|
||||
bind.cmSwitchPermission(
|
||||
connId: client.id, name: "keyboard", enabled: enabled);
|
||||
setState(() {
|
||||
client.keyboard = enabled;
|
||||
});
|
||||
}, translate('Allow using keyboard and mouse')),
|
||||
buildPermissionIcon(client.clipboard, iconClipboard, (enabled) {
|
||||
buildPermissionTile(client.clipboard, iconClipboard, (enabled) {
|
||||
bind.cmSwitchPermission(
|
||||
connId: client.id, name: "clipboard", enabled: enabled);
|
||||
setState(() {
|
||||
client.clipboard = enabled;
|
||||
});
|
||||
}, translate('Allow using clipboard')),
|
||||
buildPermissionIcon(client.audio, iconAudio, (enabled) {
|
||||
buildPermissionTile(client.audio, iconAudio, (enabled) {
|
||||
bind.cmSwitchPermission(
|
||||
connId: client.id, name: "audio", enabled: enabled);
|
||||
setState(() {
|
||||
client.audio = enabled;
|
||||
});
|
||||
}, translate('Allow hearing sound')),
|
||||
buildPermissionIcon(client.file, iconFile, (enabled) {
|
||||
buildPermissionTile(client.file, iconFile, (enabled) {
|
||||
bind.cmSwitchPermission(
|
||||
connId: client.id, name: "file", enabled: enabled);
|
||||
setState(() {
|
||||
client.file = enabled;
|
||||
});
|
||||
}, translate('Allow file copy and paste')),
|
||||
buildPermissionIcon(client.restart, iconRestart, (enabled) {
|
||||
buildPermissionTile(client.restart, iconRestart, (enabled) {
|
||||
bind.cmSwitchPermission(
|
||||
connId: client.id, name: "restart", enabled: enabled);
|
||||
setState(() {
|
||||
client.restart = enabled;
|
||||
});
|
||||
}, translate('Allow remote restart')),
|
||||
buildPermissionIcon(client.recording, iconRecording, (enabled) {
|
||||
buildPermissionTile(client.recording, iconRecording, (enabled) {
|
||||
bind.cmSwitchPermission(
|
||||
connId: client.id, name: "recording", enabled: enabled);
|
||||
setState(() {
|
||||
|
@ -233,21 +233,21 @@ void runConnectionManagerScreen(bool hide) async {
|
||||
}
|
||||
|
||||
void showCmWindow() {
|
||||
WindowOptions windowOptions =
|
||||
getHiddenTitleBarWindowOptions(size: kConnectionManagerWindowSize);
|
||||
WindowOptions windowOptions = getHiddenTitleBarWindowOptions(
|
||||
size: kConnectionManagerWindowSizeClosedChat);
|
||||
windowManager.waitUntilReadyToShow(windowOptions, () async {
|
||||
bind.mainHideDocker();
|
||||
await windowManager.show();
|
||||
await Future.wait([windowManager.focus(), windowManager.setOpacity(1)]);
|
||||
// ensure initial window size to be changed
|
||||
await windowManager.setSizeAlignment(
|
||||
kConnectionManagerWindowSize, Alignment.topRight);
|
||||
kConnectionManagerWindowSizeClosedChat, Alignment.topRight);
|
||||
});
|
||||
}
|
||||
|
||||
void hideCmWindow() {
|
||||
WindowOptions windowOptions =
|
||||
getHiddenTitleBarWindowOptions(size: kConnectionManagerWindowSize);
|
||||
WindowOptions windowOptions = getHiddenTitleBarWindowOptions(
|
||||
size: kConnectionManagerWindowSizeClosedChat);
|
||||
windowManager.setOpacity(0);
|
||||
windowManager.waitUntilReadyToShow(windowOptions, () async {
|
||||
bind.mainHideDocker();
|
||||
|
@ -203,11 +203,12 @@ class ChatModel with ChangeNotifier {
|
||||
notifyListeners();
|
||||
await windowManager.show();
|
||||
await windowManager.setSizeAlignment(
|
||||
kConnectionManagerWindowSize, Alignment.topRight);
|
||||
kConnectionManagerWindowSizeClosedChat, Alignment.topRight);
|
||||
} else {
|
||||
requestChatInputFocus();
|
||||
await windowManager.show();
|
||||
await windowManager.setSizeAlignment(Size(600, 400), Alignment.topRight);
|
||||
await windowManager.setSizeAlignment(
|
||||
kConnectionManagerWindowSizeOpenChat, Alignment.topRight);
|
||||
_isShowCMChatPage = !_isShowCMChatPage;
|
||||
notifyListeners();
|
||||
}
|
||||
|
@ -45,12 +45,12 @@ void main(List<String> args) async {
|
||||
],
|
||||
supportedLocales: supportedLocales,
|
||||
home: const DesktopServerPage()));
|
||||
WindowOptions windowOptions =
|
||||
getHiddenTitleBarWindowOptions(size: kConnectionManagerWindowSize);
|
||||
WindowOptions windowOptions = getHiddenTitleBarWindowOptions(
|
||||
size: kConnectionManagerWindowSizeClosedChat);
|
||||
windowManager.waitUntilReadyToShow(windowOptions, () async {
|
||||
await windowManager.show();
|
||||
// ensure initial window size to be changed
|
||||
await windowManager.setSize(kConnectionManagerWindowSize);
|
||||
await windowManager.setSize(kConnectionManagerWindowSizeClosedChat);
|
||||
await Future.wait([
|
||||
windowManager.setAlignment(Alignment.topRight),
|
||||
windowManager.focus(),
|
||||
|
Loading…
Reference in New Issue
Block a user