mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-04 00:59:50 +08:00
opt set window size/pos
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -135,10 +135,12 @@ abstract class SettingBoxKey {
|
||||
showFsScreenshotBtn = 'showFsScreenshotBtn',
|
||||
showFsLockBtn = 'showFsLockBtn',
|
||||
silentDownImg = 'silentDownImg',
|
||||
showMemberShop = 'showMemberShop',
|
||||
minimizeOnExit = 'minimizeOnExit',
|
||||
showMemberShop = 'showMemberShop';
|
||||
|
||||
static const String minimizeOnExit = 'minimizeOnExit',
|
||||
windowSize = 'windowSize',
|
||||
windowPosition = 'windowPosition';
|
||||
windowPosition = 'windowPosition',
|
||||
isWindowMaximized = 'isWindowMaximized';
|
||||
|
||||
static const String subtitlePreferenceV2 = 'subtitlePreferenceV2',
|
||||
enableDragSubtitle = 'enableDragSubtitle',
|
||||
|
||||
@@ -823,4 +823,7 @@ abstract class Pref {
|
||||
|
||||
static List<double>? get windowPosition =>
|
||||
_setting.get(SettingBoxKey.windowPosition);
|
||||
|
||||
static bool get isWindowMaximized =>
|
||||
_setting.get(SettingBoxKey.isWindowMaximized, defaultValue: false);
|
||||
}
|
||||
|
||||
@@ -4,14 +4,17 @@ import 'dart:io';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:PiliPlus/common/constants.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:flutter/material.dart' show Alignment;
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
abstract class Utils {
|
||||
static final Random random = Random();
|
||||
@@ -25,6 +28,19 @@ abstract class Utils {
|
||||
static final bool isDesktop =
|
||||
Platform.isWindows || Platform.isMacOS || Platform.isLinux;
|
||||
|
||||
static Future<({double left, double top})> get windowOffset async {
|
||||
final windowPosition = Pref.windowPosition;
|
||||
if (windowPosition != null) {
|
||||
return (left: windowPosition[0], top: windowPosition[1]);
|
||||
}
|
||||
final Size windowSize = await windowManager.getSize();
|
||||
final Offset position = await calcWindowPosition(
|
||||
windowSize,
|
||||
Alignment.center,
|
||||
);
|
||||
return (left: position.dx, top: position.dy);
|
||||
}
|
||||
|
||||
static Future<bool> get isWiFi async {
|
||||
try {
|
||||
return Utils.isMobile &&
|
||||
|
||||
Reference in New Issue
Block a user