fix_cm: miminize window, mid commit

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2022-11-04 17:01:49 +08:00
parent 884a223449
commit 4272f0194e
2 changed files with 33 additions and 2 deletions

View File

@ -32,6 +32,8 @@ class ChatModel with ChangeNotifier {
OverlayState? _overlayState;
OverlayEntry? chatIconOverlayEntry;
OverlayEntry? chatWindowOverlayEntry;
bool _showOnWindowRestore = false;
bool _isWindowMinimized = false;
final ChatUser me = ChatUser(
id: "",
@ -66,6 +68,14 @@ class ChatModel with ChangeNotifier {
}
}
setWindowMinimized(bool v) {
_isWindowMinimized = v;
if (!_isWindowMinimized && _showOnWindowRestore) {
showChatIconOverlay();
_showOnWindowRestore = false;
}
}
setOverlayState(OverlayState? os) {
_overlayState = os;
}
@ -101,6 +111,7 @@ class ChatModel with ChangeNotifier {
initPositionYInTop: false,
initPositionYMarginBorder: 100,
borderTopContainTopBar: true,
appBarHeight: 0,
),
child: FloatingActionButton(
onPressed: () {
@ -209,7 +220,11 @@ class ChatModel with ChangeNotifier {
if (text.isEmpty) return;
// mobile: first message show overlay icon
if (chatIconOverlayEntry == null) {
showChatIconOverlay();
if (_isWindowMinimized) {
showChatIconOverlay();
} else {
_showOnWindowRestore = true;
}
}
// desktop: show chat page
if (!_isShowChatPage) {