linux support

This commit is contained in:
nyne
2024-06-12 21:30:23 +08:00
parent 7c8fabf52c
commit 4476ad7f90
12 changed files with 95 additions and 23 deletions

View File

@@ -1,3 +1,5 @@
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:pixes/utils/ext.dart';
@@ -26,6 +28,9 @@ class Log {
static bool ignoreLimitation = false;
/// only for debug
static const String? logFile = null;
static void printWarning(String text) {
print('\x1B[33m$text\x1B[0m');
}
@@ -57,6 +62,9 @@ class Log {
}
_logs.add(newLog);
if(logFile != null) {
File(logFile!).writeAsString(newLog.toString(), mode: FileMode.append);
}
if (_logs.length > maxLogNumber) {
var res = _logs.remove(
_logs.firstWhereOrNull((element) => element.level == LogLevel.info));

View File

@@ -36,13 +36,17 @@ void main() async {
await flutter_acrylic.Window.initialize();
if (App.isWindows) {
await flutter_acrylic.Window.hideWindowControls();
}
}
await WindowManager.instance.ensureInitialized();
windowManager.waitUntilReadyToShow().then((_) async {
await windowManager.setTitleBarStyle(
TitleBarStyle.hidden,
windowButtonVisibility: false,
);
if(App.isLinux) {
// https://github.com/leanflutter/window_manager/issues/460
return;
}
await windowManager.setMinimumSize(const Size(500, 600));
var placement = await WindowPlacement.loadFromFile();
await placement.applyToWindow();
@@ -51,6 +55,7 @@ void main() async {
});
}
Loop.start();
Log.info("APP", "Application started");
runApp(const MyApp());
}