mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-22 01:56:47 +08:00
opt set window size/pos
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -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