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));
|
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
|
// Tabbar transition duration, now we remove the duration
|
||||||
const Duration kTabTransitionDuration = Duration.zero;
|
const Duration kTabTransitionDuration = Duration.zero;
|
||||||
const double kEmptyMarginTop = 50;
|
const double kEmptyMarginTop = 50;
|
||||||
|
@ -408,17 +408,12 @@ class _PrivilegeBoard extends StatefulWidget {
|
|||||||
|
|
||||||
class _PrivilegeBoardState extends State<_PrivilegeBoard> {
|
class _PrivilegeBoardState extends State<_PrivilegeBoard> {
|
||||||
late final client = widget.client;
|
late final client = widget.client;
|
||||||
Widget buildPermissionIcon(
|
Widget buildPermissionTile(bool enabled, ImageProvider icon,
|
||||||
bool enabled, ImageProvider icon, Function(bool)? onTap, String tooltip) {
|
Function(bool)? onTap, String tooltipText) {
|
||||||
return Tooltip(
|
return Row(
|
||||||
message: tooltip,
|
children: [
|
||||||
child: Ink(
|
Tooltip(
|
||||||
decoration:
|
message: tooltipText,
|
||||||
BoxDecoration(color: enabled ? MyTheme.accent80 : Colors.grey),
|
|
||||||
padding: EdgeInsets.all(4.0),
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () =>
|
|
||||||
checkClickTime(widget.client.id, () => onTap?.call(!enabled)),
|
|
||||||
child: Image(
|
child: Image(
|
||||||
image: icon,
|
image: icon,
|
||||||
width: 50,
|
width: 50,
|
||||||
@ -426,7 +421,12 @@ class _PrivilegeBoardState extends State<_PrivilegeBoard> {
|
|||||||
fit: BoxFit.scaleDown,
|
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,
|
height: 8.0,
|
||||||
),
|
),
|
||||||
FittedBox(
|
FittedBox(
|
||||||
child: Row(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
buildPermissionIcon(client.keyboard, iconKeyboard, (enabled) {
|
buildPermissionTile(client.keyboard, iconKeyboard, (enabled) {
|
||||||
bind.cmSwitchPermission(
|
bind.cmSwitchPermission(
|
||||||
connId: client.id, name: "keyboard", enabled: enabled);
|
connId: client.id, name: "keyboard", enabled: enabled);
|
||||||
setState(() {
|
setState(() {
|
||||||
client.keyboard = enabled;
|
client.keyboard = enabled;
|
||||||
});
|
});
|
||||||
}, translate('Allow using keyboard and mouse')),
|
}, translate('Allow using keyboard and mouse')),
|
||||||
buildPermissionIcon(client.clipboard, iconClipboard, (enabled) {
|
buildPermissionTile(client.clipboard, iconClipboard, (enabled) {
|
||||||
bind.cmSwitchPermission(
|
bind.cmSwitchPermission(
|
||||||
connId: client.id, name: "clipboard", enabled: enabled);
|
connId: client.id, name: "clipboard", enabled: enabled);
|
||||||
setState(() {
|
setState(() {
|
||||||
client.clipboard = enabled;
|
client.clipboard = enabled;
|
||||||
});
|
});
|
||||||
}, translate('Allow using clipboard')),
|
}, translate('Allow using clipboard')),
|
||||||
buildPermissionIcon(client.audio, iconAudio, (enabled) {
|
buildPermissionTile(client.audio, iconAudio, (enabled) {
|
||||||
bind.cmSwitchPermission(
|
bind.cmSwitchPermission(
|
||||||
connId: client.id, name: "audio", enabled: enabled);
|
connId: client.id, name: "audio", enabled: enabled);
|
||||||
setState(() {
|
setState(() {
|
||||||
client.audio = enabled;
|
client.audio = enabled;
|
||||||
});
|
});
|
||||||
}, translate('Allow hearing sound')),
|
}, translate('Allow hearing sound')),
|
||||||
buildPermissionIcon(client.file, iconFile, (enabled) {
|
buildPermissionTile(client.file, iconFile, (enabled) {
|
||||||
bind.cmSwitchPermission(
|
bind.cmSwitchPermission(
|
||||||
connId: client.id, name: "file", enabled: enabled);
|
connId: client.id, name: "file", enabled: enabled);
|
||||||
setState(() {
|
setState(() {
|
||||||
client.file = enabled;
|
client.file = enabled;
|
||||||
});
|
});
|
||||||
}, translate('Allow file copy and paste')),
|
}, translate('Allow file copy and paste')),
|
||||||
buildPermissionIcon(client.restart, iconRestart, (enabled) {
|
buildPermissionTile(client.restart, iconRestart, (enabled) {
|
||||||
bind.cmSwitchPermission(
|
bind.cmSwitchPermission(
|
||||||
connId: client.id, name: "restart", enabled: enabled);
|
connId: client.id, name: "restart", enabled: enabled);
|
||||||
setState(() {
|
setState(() {
|
||||||
client.restart = enabled;
|
client.restart = enabled;
|
||||||
});
|
});
|
||||||
}, translate('Allow remote restart')),
|
}, translate('Allow remote restart')),
|
||||||
buildPermissionIcon(client.recording, iconRecording, (enabled) {
|
buildPermissionTile(client.recording, iconRecording, (enabled) {
|
||||||
bind.cmSwitchPermission(
|
bind.cmSwitchPermission(
|
||||||
connId: client.id, name: "recording", enabled: enabled);
|
connId: client.id, name: "recording", enabled: enabled);
|
||||||
setState(() {
|
setState(() {
|
||||||
|
@ -233,21 +233,21 @@ void runConnectionManagerScreen(bool hide) async {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void showCmWindow() {
|
void showCmWindow() {
|
||||||
WindowOptions windowOptions =
|
WindowOptions windowOptions = getHiddenTitleBarWindowOptions(
|
||||||
getHiddenTitleBarWindowOptions(size: kConnectionManagerWindowSize);
|
size: kConnectionManagerWindowSizeClosedChat);
|
||||||
windowManager.waitUntilReadyToShow(windowOptions, () async {
|
windowManager.waitUntilReadyToShow(windowOptions, () async {
|
||||||
bind.mainHideDocker();
|
bind.mainHideDocker();
|
||||||
await windowManager.show();
|
await windowManager.show();
|
||||||
await Future.wait([windowManager.focus(), windowManager.setOpacity(1)]);
|
await Future.wait([windowManager.focus(), windowManager.setOpacity(1)]);
|
||||||
// ensure initial window size to be changed
|
// ensure initial window size to be changed
|
||||||
await windowManager.setSizeAlignment(
|
await windowManager.setSizeAlignment(
|
||||||
kConnectionManagerWindowSize, Alignment.topRight);
|
kConnectionManagerWindowSizeClosedChat, Alignment.topRight);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void hideCmWindow() {
|
void hideCmWindow() {
|
||||||
WindowOptions windowOptions =
|
WindowOptions windowOptions = getHiddenTitleBarWindowOptions(
|
||||||
getHiddenTitleBarWindowOptions(size: kConnectionManagerWindowSize);
|
size: kConnectionManagerWindowSizeClosedChat);
|
||||||
windowManager.setOpacity(0);
|
windowManager.setOpacity(0);
|
||||||
windowManager.waitUntilReadyToShow(windowOptions, () async {
|
windowManager.waitUntilReadyToShow(windowOptions, () async {
|
||||||
bind.mainHideDocker();
|
bind.mainHideDocker();
|
||||||
|
@ -203,11 +203,12 @@ class ChatModel with ChangeNotifier {
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
await windowManager.show();
|
await windowManager.show();
|
||||||
await windowManager.setSizeAlignment(
|
await windowManager.setSizeAlignment(
|
||||||
kConnectionManagerWindowSize, Alignment.topRight);
|
kConnectionManagerWindowSizeClosedChat, Alignment.topRight);
|
||||||
} else {
|
} else {
|
||||||
requestChatInputFocus();
|
requestChatInputFocus();
|
||||||
await windowManager.show();
|
await windowManager.show();
|
||||||
await windowManager.setSizeAlignment(Size(600, 400), Alignment.topRight);
|
await windowManager.setSizeAlignment(
|
||||||
|
kConnectionManagerWindowSizeOpenChat, Alignment.topRight);
|
||||||
_isShowCMChatPage = !_isShowCMChatPage;
|
_isShowCMChatPage = !_isShowCMChatPage;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
@ -45,12 +45,12 @@ void main(List<String> args) async {
|
|||||||
],
|
],
|
||||||
supportedLocales: supportedLocales,
|
supportedLocales: supportedLocales,
|
||||||
home: const DesktopServerPage()));
|
home: const DesktopServerPage()));
|
||||||
WindowOptions windowOptions =
|
WindowOptions windowOptions = getHiddenTitleBarWindowOptions(
|
||||||
getHiddenTitleBarWindowOptions(size: kConnectionManagerWindowSize);
|
size: kConnectionManagerWindowSizeClosedChat);
|
||||||
windowManager.waitUntilReadyToShow(windowOptions, () async {
|
windowManager.waitUntilReadyToShow(windowOptions, () async {
|
||||||
await windowManager.show();
|
await windowManager.show();
|
||||||
// ensure initial window size to be changed
|
// ensure initial window size to be changed
|
||||||
await windowManager.setSize(kConnectionManagerWindowSize);
|
await windowManager.setSize(kConnectionManagerWindowSizeClosedChat);
|
||||||
await Future.wait([
|
await Future.wait([
|
||||||
windowManager.setAlignment(Alignment.topRight),
|
windowManager.setAlignment(Alignment.topRight),
|
||||||
windowManager.focus(),
|
windowManager.focus(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user