Add Windows runner files for high DPI support and console output
- Created runner.exe.manifest to enable DPI awareness and dark mode support. - Implemented utility functions in utils.cpp and utils.h for console creation and command line argument handling. - Developed Win32Window class in win32_window.cpp and win32_window.h to manage high DPI-aware windows, including theme updates and message handling.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
export 'app_platform_stub.dart' if (dart.library.io) 'app_platform_io.dart';
|
||||
@@ -0,0 +1,13 @@
|
||||
import 'dart:io' show Platform;
|
||||
|
||||
bool get isAndroid => Platform.isAndroid;
|
||||
|
||||
bool get isIOS => Platform.isIOS;
|
||||
|
||||
bool get isLinux => Platform.isLinux;
|
||||
|
||||
bool get isMacOS => Platform.isMacOS;
|
||||
|
||||
bool get isWindows => Platform.isWindows;
|
||||
|
||||
bool get isDesktop => isLinux || isMacOS || isWindows;
|
||||
@@ -0,0 +1,11 @@
|
||||
bool get isAndroid => false;
|
||||
|
||||
bool get isIOS => false;
|
||||
|
||||
bool get isLinux => false;
|
||||
|
||||
bool get isMacOS => false;
|
||||
|
||||
bool get isWindows => false;
|
||||
|
||||
bool get isDesktop => false;
|
||||
@@ -0,0 +1 @@
|
||||
export 'window_bootstrap_stub.dart' if (dart.library.io) 'window_bootstrap_io.dart';
|
||||
@@ -0,0 +1,29 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:notas/platform/app_platform.dart';
|
||||
import 'package:notas/platform/window_state.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
Future<void> bootstrapWindow() async {
|
||||
if (!isDesktop) {
|
||||
return;
|
||||
}
|
||||
|
||||
await windowManager.ensureInitialized();
|
||||
|
||||
final Size initialSize =
|
||||
await WindowStateStore.instance.loadWindowSize() ?? const Size(900, 700);
|
||||
|
||||
final WindowOptions windowOptions = WindowOptions(
|
||||
size: initialSize,
|
||||
minimumSize: Size(400, 600),
|
||||
center: true,
|
||||
titleBarStyle: TitleBarStyle.hidden,
|
||||
);
|
||||
|
||||
windowManager.waitUntilReadyToShow(windowOptions, () async {
|
||||
await windowManager.show();
|
||||
await windowManager.setMinimumSize(const Size(400, 600));
|
||||
await windowManager.setSize(initialSize);
|
||||
await windowManager.focus();
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
Future<void> bootstrapWindow() async {}
|
||||
@@ -0,0 +1 @@
|
||||
export 'window_state_stub.dart' if (dart.library.io) 'window_state_io.dart';
|
||||
@@ -0,0 +1,30 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class WindowStateStore {
|
||||
WindowStateStore._();
|
||||
|
||||
static final WindowStateStore instance = WindowStateStore._();
|
||||
|
||||
static const String _widthKey = 'window_width';
|
||||
static const String _heightKey = 'window_height';
|
||||
|
||||
Future<Size?> loadWindowSize() async {
|
||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
final double? width = prefs.getDouble(_widthKey);
|
||||
final double? height = prefs.getDouble(_heightKey);
|
||||
|
||||
if (width == null || height == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return Size(width, height);
|
||||
}
|
||||
|
||||
Future<void> saveWindowSize(Size size) async {
|
||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setDouble(_widthKey, size.width);
|
||||
await prefs.setDouble(_heightKey, size.height);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import 'dart:ui';
|
||||
|
||||
class WindowStateStore {
|
||||
WindowStateStore._();
|
||||
|
||||
static final WindowStateStore instance = WindowStateStore._();
|
||||
|
||||
Future<Size?> loadWindowSize() async {
|
||||
return null;
|
||||
}
|
||||
|
||||
Future<void> saveWindowSize(Size size) async {}
|
||||
}
|
||||
Reference in New Issue
Block a user