flutter_desktop: adjust window, debug done

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2022-10-10 09:56:27 +08:00
parent 2cc92c199c
commit 8ec565d5a0
2 changed files with 21 additions and 17 deletions

View File

@ -1029,12 +1029,14 @@ Future<void> saveWindowPosition(WindowType type, {int? windowId}) async {
_adjustRestoreMainWindowSize(double? width, double? height) async {
const double minWidth = 600;
const double minHeight = 100;
double maxWidth = ((isDesktop || isWebDesktop)
? kDesktopMaxDisplayWidth
: kMobileMaxDisplayWidth) as double;
double maxWidth = (((isDesktop || isWebDesktop)
? kDesktopMaxDisplayWidth
: kMobileMaxDisplayWidth))
.toDouble();
double maxHeight = ((isDesktop || isWebDesktop)
? kDesktopMaxDisplayHeight
: kMobileMaxDisplayHeight) as double;
? kDesktopMaxDisplayHeight
: kMobileMaxDisplayHeight)
.toDouble();
if (isDesktop || isWebDesktop) {
final screen = (await window_size.getWindowInfo()).screen;
@ -1044,12 +1046,12 @@ _adjustRestoreMainWindowSize(double? width, double? height) async {
}
}
final defaultWidth = ((isDesktop || isWebDesktop)
? 1280
: kMobileDefaultDisplayWidth) as double;
final defaultHeight = ((isDesktop || isWebDesktop)
? 720
: kMobileDefaultDisplayHeight) as double;
final defaultWidth =
((isDesktop || isWebDesktop) ? 1280 : kMobileDefaultDisplayWidth)
.toDouble();
final defaultHeight =
((isDesktop || isWebDesktop) ? 720 : kMobileDefaultDisplayHeight)
.toDouble();
double restoreWidth = width ?? defaultWidth;
double restoreHeight = height ?? defaultHeight;
@ -1078,11 +1080,13 @@ _adjustRestoreMainWindowOffset(double? left, double? top) async {
double frameLeft = 0;
double frameTop = 0;
double frameRight = ((isDesktop || isWebDesktop)
? kDesktopMaxDisplayWidth
: kMobileMaxDisplayWidth) as double;
? kDesktopMaxDisplayWidth
: kMobileMaxDisplayWidth)
.toDouble();
double frameBottom = ((isDesktop || isWebDesktop)
? kDesktopMaxDisplayHeight
: kMobileMaxDisplayHeight) as double;
? kDesktopMaxDisplayHeight
: kMobileMaxDisplayHeight)
.toDouble();
if (isDesktop || isWebDesktop) {
final screen = (await window_size.getWindowInfo()).screen;

View File

@ -628,8 +628,7 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
double scale = _screen!.scaleFactor;
double selfWidth = _screen!.frame.width;
double selfHeight = _screen!.frame.height;
final RxBool fullscreen = Get.find(tag: 'fullscreen');
if (fullscreen.isFalse) {
if (isFullscreen) {
selfWidth = _screen!.visibleFrame.width;
selfHeight = _screen!.visibleFrame.height;
}
@ -816,6 +815,7 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
() async {
await _updateScreen();
if (_screen != null) {
_setFullscreen(false);
double scale = _screen!.scaleFactor;
final wndRect =
await WindowController.fromWindowId(widget.windowId)