Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

render cm side page after window size change, calculate real window width

21pagesd8e51c6b14ce
diff --git a/flutter/lib/desktop/pages/server_page.dart b/flutter/lib/desktop/pages/server_page.dart
index 2ef04b244..89a43adf6 100644
--- a/flutter/lib/desktop/pages/server_page.dart
+++ b/flutter/lib/desktop/pages/server_page.dart
@@ -175,34 +175,47 @@ class ConnectionManagerState extends State<ConnectionManager> {
],
);
},
- pageViewBuilder: (pageView) => Row(
- children: [
- Consumer<ChatModel>(
- builder: (_, model, child) => model.isShowCMSidePage
- ? Expanded(
- child: buildRemoteBlock(
- child: Container(
- decoration: BoxDecoration(
- border: Border(
- right: BorderSide(
- color: Theme.of(context)
- .dividerColor))),
- child: buildSidePage()),
- ),
- flex: (kConnectionManagerWindowSizeOpenChat.width -
- kConnectionManagerWindowSizeClosedChat
- .width)
- .toInt(),
- )
- : Offstage(),
- ),
- Expanded(
- child: pageView,
- flex: kConnectionManagerWindowSizeClosedChat.width
- .toInt() -
- 4 // prevent stretch of the page view when chat is open,
- ),
- ],
+ pageViewBuilder: (pageView) => LayoutBuilder(
+ builder: (context, constrains) {
+ var borderWidth = 0.0;
+ if (constrains.maxWidth >
+ kConnectionManagerWindowSizeClosedChat.width) {
+ borderWidth = kConnectionManagerWindowSizeOpenChat.width -
+ constrains.maxWidth;
+ } else {
+ borderWidth = kConnectionManagerWindowSizeClosedChat.width -
+ constrains.maxWidth;
+ }
+ if (borderWidth < 0 || borderWidth > 50) {
+ borderWidth = 0;
+ }
+ final realClosedWidth =
+ kConnectionManagerWindowSizeClosedChat.width -
+ borderWidth;
+ final realChatPageWidth =
+ constrains.maxWidth - realClosedWidth;
+ return Row(children: [
+ if (constrains.maxWidth >
+ kConnectionManagerWindowSizeClosedChat.width)
+ Consumer<ChatModel>(
+ builder: (_, model, child) => SizedBox(
+ width: realChatPageWidth,
+ child: buildRemoteBlock(
+ child: Container(
+ decoration: BoxDecoration(
+ border: Border(
+ right: BorderSide(
+ color: Theme.of(context)
+ .dividerColor))),
+ child: buildSidePage()),
+ ),
+ )),
+ SizedBox(
+ width: realClosedWidth,
+ child:
+ SizedBox(width: realClosedWidth, child: pageView)),
+ ]);
+ },
),
),
);
@@ -966,8 +979,7 @@ class __FileTransferLogPageState extends State<_FileTransferLogPage> {
return PreferredSize(
preferredSize: const Size(200, double.infinity),
child: Container(
- margin: const EdgeInsets.only(top: 16.0, bottom: 16.0, right: 16.0),
- padding: const EdgeInsets.all(8.0),
+ padding: const EdgeInsets.all(12.0),
child: Obx(
() {
final jobTable = gFFI.cmFileModel.currentJobTable;
diff --git a/flutter/lib/models/chat_model.dart b/flutter/lib/models/chat_model.dart
index ed216e500..77eeb3a7e 100644
--- a/flutter/lib/models/chat_model.dart
+++ b/flutter/lib/models/chat_model.dart
@@ -285,7 +285,10 @@ class ChatModel with ChangeNotifier {
await toggleCMSidePage();
}
+ var _togglingCMSidePage = false; // protect order for await
toggleCMSidePage() async {
+ if (_togglingCMSidePage) return false;
+ _togglingCMSidePage = true;
if (_isShowCMSidePage) {
_isShowCMSidePage = !_isShowCMSidePage;
notifyListeners();
@@ -300,6 +303,7 @@ class ChatModel with ChangeNotifier {
_isShowCMSidePage = !_isShowCMSidePage;
notifyListeners();
}
+ _togglingCMSidePage = false;
}
changeCurrentKey(MessageKey key) {