From 61c6ed0e1bec07a094c0755459d679e9284f74f1 Mon Sep 17 00:00:00 2001 From: wgh19 Date: Fri, 31 May 2024 19:58:06 +0800 Subject: [PATCH] fix init --- lib/foundation/app.dart | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/foundation/app.dart b/lib/foundation/app.dart index c2d3af3..d09ce02 100644 --- a/lib/foundation/app.dart +++ b/lib/foundation/app.dart @@ -48,18 +48,20 @@ class _App { init() async { cachePath = (await getApplicationCacheDirectory()).path; dataPath = (await getApplicationSupportDirectory()).path; - final deviceInfoPlugin = DeviceInfoPlugin(); - final deviceInfo = await deviceInfoPlugin.windowsInfo; - if (deviceInfo.majorVersion <= 6) { - if (deviceInfo.minorVersion < 2) { - _windowsVersion = 7; + if (App.isWindows) { + final deviceInfoPlugin = DeviceInfoPlugin(); + final deviceInfo = await deviceInfoPlugin.windowsInfo; + if (deviceInfo.majorVersion <= 6) { + if (deviceInfo.minorVersion < 2) { + _windowsVersion = 7; + } else { + _windowsVersion = 8; + } + } else if (deviceInfo.buildNumber < 22000) { + _windowsVersion = 10; } else { - _windowsVersion = 8; + _windowsVersion = 11; } - } else if (deviceInfo.buildNumber < 22000) { - _windowsVersion = 10; - } else { - _windowsVersion = 11; } }