From 9374188ea98c8ed7b7a133fabb37462b7bb28bdf Mon Sep 17 00:00:00 2001 From: NicKoehler Date: Sun, 21 May 2023 10:20:40 +0200 Subject: [PATCH] replaced hardcoded chatpage size with expanded, alignment adjustments --- flutter/lib/common/widgets/chat_page.dart | 2 +- flutter/lib/desktop/pages/server_page.dart | 65 ++++++++++++---------- 2 files changed, 36 insertions(+), 31 deletions(-) diff --git a/flutter/lib/common/widgets/chat_page.dart b/flutter/lib/common/widgets/chat_page.dart index a88e120f1..751178ea6 100644 --- a/flutter/lib/common/widgets/chat_page.dart +++ b/flutter/lib/common/widgets/chat_page.dart @@ -48,7 +48,7 @@ class ChatPage extends StatelessWidget implements PageShape { value: chatModel, child: Container( color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(20.0), + padding: EdgeInsets.only(top: 14.0, bottom: 14.0, left: 14.0), child: Consumer( builder: (context, chatModel, child) { final currentUser = chatModel.currentUser; diff --git a/flutter/lib/desktop/pages/server_page.dart b/flutter/lib/desktop/pages/server_page.dart index 0ae067d64..5c345d50d 100644 --- a/flutter/lib/desktop/pages/server_page.dart +++ b/flutter/lib/desktop/pages/server_page.dart @@ -81,14 +81,7 @@ class _DesktopServerPageState extends State border: Border.all(color: MyTheme.color(context).border!)), child: Scaffold( backgroundColor: Theme.of(context).scaffoldBackgroundColor, - body: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded(child: ConnectionManager()), - ], - ), - ), + body: ConnectionManager(), ), ), ), @@ -170,11 +163,22 @@ class ConnectionManagerState extends State { pageViewBuilder: (pageView) => Row( children: [ Consumer( - builder: (_, model, child) => model.isShowCMChatPage - ? Container( - width: 400, child: Scaffold(body: ChatPage())) - : Offstage()), - Expanded(child: pageView), + builder: (_, model, child) => model.isShowCMChatPage + ? Expanded( + child: ChatPage(), + 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, + ), ], ), ), @@ -246,23 +250,24 @@ class ConnectionManagerState extends State { Widget buildConnectionCard(Client client) { return Consumer( - builder: (context, value, child) => Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - key: ValueKey(client.id), - children: [ - _CmHeader(client: client), - client.type_() != ClientType.remote || client.disconnected - ? Offstage() - : _PrivilegeBoard(client: client), - Expanded( - child: Align( - alignment: Alignment.bottomCenter, - child: _CmControlPanel(client: client), - ), - ) - ], - ).paddingSymmetric(vertical: 8.0, horizontal: 8.0)); + builder: (context, value, child) => Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + key: ValueKey(client.id), + children: [ + _CmHeader(client: client), + client.type_() != ClientType.remote || client.disconnected + ? Offstage() + : _PrivilegeBoard(client: client), + Expanded( + child: Align( + alignment: Alignment.bottomCenter, + child: _CmControlPanel(client: client), + ), + ) + ], + ).paddingSymmetric(vertical: 4.0, horizontal: 8.0), + ); } class _AppIcon extends StatelessWidget {