linux small screen width check

This commit is contained in:
julian 2022-11-28 12:46:35 -06:00
parent 76e0616ade
commit 8960bb5764
2 changed files with 19 additions and 3 deletions

View file

@ -76,11 +76,17 @@ void main() async {
Util.libraryPath = await getLibraryDirectory();
}
Screen? screen;
if (Platform.isLinux || Util.isDesktop) {
screen = await getCurrentScreen();
Util.screenWidth = screen?.frame.width;
}
if (Util.isDesktop) {
setWindowTitle('Stack Wallet');
setWindowMinSize(const Size(1220, 100));
setWindowMaxSize(Size.infinite);
final screen = await getCurrentScreen();
final screenHeight = screen?.frame.height;
if (screenHeight != null) {
// starting to height be 3/4 screen height or 900, whichever is smaller

View file

@ -1,14 +1,24 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:path_provider/path_provider.dart';
abstract class Util {
static Directory? libraryPath;
static double? screenWidth;
static bool get isDesktop {
if(Platform.isIOS && libraryPath != null && !libraryPath!.path.contains("/var/mobile/")){
// special check for running on linux based phones
if (Platform.isLinux && screenWidth != null && screenWidth! < 800) {
return false;
}
// special check for running under ipad mode in macos
if (Platform.isIOS &&
libraryPath != null &&
!libraryPath!.path.contains("/var/mobile/")) {
return true;
}
return Platform.isLinux || Platform.isMacOS || Platform.isWindows;
}