Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

add low resolution support for windows

Prediditb636cde6832e
diff --git a/lib/main.dart b/lib/main.dart
index 1f683d78..6825db27 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -18,8 +18,9 @@ void main() async {
WidgetsFlutterBinding.ensureInitialized();
if (Utils.isDesktop()) {
await windowManager.ensureInitialized();
- WindowOptions windowOptions = const WindowOptions(
- size: Size(1280, 860),
+ bool isLowResolution = await Utils.isLowResolution();
+ WindowOptions windowOptions = WindowOptions(
+ size: isLowResolution ? const Size(800, 600) : const Size(1280, 860),
center: true,
// backgroundColor: Colors.white,
skipTaskbar: false,
diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart
index c6ce3889..6aedb2ac 100644
--- a/lib/utils/utils.dart
+++ b/lib/utils/utils.dart
@@ -15,6 +15,20 @@ import 'package:screen_pixel/screen_pixel.dart';
class Utils {
static final Random random = Random();
+ static Future<bool> isLowResolution() async {
+ try {
+ Map<String, double>? screenInfo = await getScreenInfo();
+ if (screenInfo != null) {
+ if (screenInfo['height']! / screenInfo['ratio']! < 900) {
+ return true;
+ }
+ }
+ return false;
+ } catch (_) {
+ return false;
+ }
+ }
+
static Future<Map<String, double>?> getScreenInfo() async {
final screenPixelPlugin = ScreenPixel();
Map<String, double>? screenResolution;