render cm side page after window size change, calculate real window
width Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
563cd828ad
commit
d8e51c6b14
@ -175,34 +175,47 @@ class ConnectionManagerState extends State<ConnectionManager> {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
pageViewBuilder: (pageView) => Row(
|
pageViewBuilder: (pageView) => LayoutBuilder(
|
||||||
children: [
|
builder: (context, constrains) {
|
||||||
Consumer<ChatModel>(
|
var borderWidth = 0.0;
|
||||||
builder: (_, model, child) => model.isShowCMSidePage
|
if (constrains.maxWidth >
|
||||||
? Expanded(
|
kConnectionManagerWindowSizeClosedChat.width) {
|
||||||
child: buildRemoteBlock(
|
borderWidth = kConnectionManagerWindowSizeOpenChat.width -
|
||||||
child: Container(
|
constrains.maxWidth;
|
||||||
decoration: BoxDecoration(
|
} else {
|
||||||
border: Border(
|
borderWidth = kConnectionManagerWindowSizeClosedChat.width -
|
||||||
right: BorderSide(
|
constrains.maxWidth;
|
||||||
color: Theme.of(context)
|
}
|
||||||
.dividerColor))),
|
if (borderWidth < 0 || borderWidth > 50) {
|
||||||
child: buildSidePage()),
|
borderWidth = 0;
|
||||||
),
|
}
|
||||||
flex: (kConnectionManagerWindowSizeOpenChat.width -
|
final realClosedWidth =
|
||||||
kConnectionManagerWindowSizeClosedChat
|
kConnectionManagerWindowSizeClosedChat.width -
|
||||||
.width)
|
borderWidth;
|
||||||
.toInt(),
|
final realChatPageWidth =
|
||||||
)
|
constrains.maxWidth - realClosedWidth;
|
||||||
: Offstage(),
|
return Row(children: [
|
||||||
),
|
if (constrains.maxWidth >
|
||||||
Expanded(
|
kConnectionManagerWindowSizeClosedChat.width)
|
||||||
child: pageView,
|
Consumer<ChatModel>(
|
||||||
flex: kConnectionManagerWindowSizeClosedChat.width
|
builder: (_, model, child) => SizedBox(
|
||||||
.toInt() -
|
width: realChatPageWidth,
|
||||||
4 // prevent stretch of the page view when chat is open,
|
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(
|
return PreferredSize(
|
||||||
preferredSize: const Size(200, double.infinity),
|
preferredSize: const Size(200, double.infinity),
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.only(top: 16.0, bottom: 16.0, right: 16.0),
|
padding: const EdgeInsets.all(12.0),
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Obx(
|
child: Obx(
|
||||||
() {
|
() {
|
||||||
final jobTable = gFFI.cmFileModel.currentJobTable;
|
final jobTable = gFFI.cmFileModel.currentJobTable;
|
||||||
|
@ -285,7 +285,10 @@ class ChatModel with ChangeNotifier {
|
|||||||
await toggleCMSidePage();
|
await toggleCMSidePage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _togglingCMSidePage = false; // protect order for await
|
||||||
toggleCMSidePage() async {
|
toggleCMSidePage() async {
|
||||||
|
if (_togglingCMSidePage) return false;
|
||||||
|
_togglingCMSidePage = true;
|
||||||
if (_isShowCMSidePage) {
|
if (_isShowCMSidePage) {
|
||||||
_isShowCMSidePage = !_isShowCMSidePage;
|
_isShowCMSidePage = !_isShowCMSidePage;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
@ -300,6 +303,7 @@ class ChatModel with ChangeNotifier {
|
|||||||
_isShowCMSidePage = !_isShowCMSidePage;
|
_isShowCMSidePage = !_isShowCMSidePage;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
_togglingCMSidePage = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
changeCurrentKey(MessageKey key) {
|
changeCurrentKey(MessageKey key) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user