desktop cm: auto focus & merge setSizeAlignment

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2022-11-05 10:35:56 +08:00
parent e7ac6eb0d2
commit 4f7af964c6
4 changed files with 7 additions and 14 deletions

View File

@ -54,6 +54,7 @@ class ChatPage extends StatelessWidget implements PageShape {
return DashChat(
onSend: (chatMsg) {
chatModel.send(chatMsg);
chatModel.inputNode.requestFocus();
},
currentUser: chatModel.me,
messages: chatModel

View File

@ -160,15 +160,10 @@ void runConnectionManagerScreen() async {
);
windowManager.waitUntilReadyToShow(windowOptions, () async {
await windowManager.show();
await Future.wait([windowManager.focus(), windowManager.setOpacity(1)]);
// ensure initial window size to be changed
await windowManager.setSize(kConnectionManagerWindowSize);
await Future.wait([
windowManager.setAlignment(Alignment.topRight),
windowManager.focus(),
windowManager.setOpacity(1)
]);
// ensure
windowManager.setAlignment(Alignment.topRight);
await windowManager.setSizeAlignment(
kConnectionManagerWindowSize, Alignment.topRight);
});
}

View File

@ -193,12 +193,9 @@ class ChatModel with ChangeNotifier {
if (_isShowCMChatPage) {
_isShowCMChatPage = !_isShowCMChatPage;
notifyListeners();
await windowManager.setSize(Size(300, 400));
await windowManager.setAlignment(Alignment.topRight);
await windowManager.setSizeAlignment(Size(300, 400), Alignment.topRight);
} else {
await windowManager.setSize(Size(600, 400));
await Future.delayed(Duration(milliseconds: 100));
await windowManager.setAlignment(Alignment.topRight);
await windowManager.setSizeAlignment(Size(600, 400), Alignment.topRight);
_isShowCMChatPage = !_isShowCMChatPage;
notifyListeners();
}

View File

@ -60,7 +60,7 @@ dependencies:
window_manager:
git:
url: https://github.com/Kingtous/rustdesk_window_manager
ref: 88487257cbafc501599ab4f82ec343b46acec020
ref: d1e4b40f4a1ffeb8630696be6883dd31bf307998
desktop_multi_window:
git:
url: https://github.com/Kingtous/rustdesk_desktop_multi_window