mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
f0d5f51703
* fix:windows integration test * fix: load asset * fix: windows test * fix: test * test: refactor the folder test --------- Co-authored-by: vedon <vedon.fu@gmail.com> Co-authored-by: Lucas.Xu <lucas.xu@appflowy.io>
55 lines
1.5 KiB
Dart
55 lines
1.5 KiB
Dart
import 'dart:ui';
|
|
|
|
import 'package:appflowy/core/helpers/helpers.dart';
|
|
import 'package:appflowy/startup/startup.dart';
|
|
import 'package:appflowy/startup/tasks/app_window_size_manager.dart';
|
|
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:window_manager/window_manager.dart';
|
|
|
|
class InitAppWindowTask extends LaunchTask with WindowListener {
|
|
const InitAppWindowTask({
|
|
this.minimumSize = const Size(800, 600),
|
|
this.title = 'AppFlowy',
|
|
});
|
|
|
|
final Size minimumSize;
|
|
final String title;
|
|
|
|
@override
|
|
Future<void> initialize(LaunchContext context) async {
|
|
// Don't initialize on mobile or web.
|
|
if (!defaultTargetPlatform.isDesktop) {
|
|
return;
|
|
}
|
|
|
|
await windowManager.ensureInitialized();
|
|
windowManager.addListener(this);
|
|
|
|
Size windowSize = await WindowSizeManager().getSize();
|
|
if (context.env.isIntegrationTest) {
|
|
windowSize = const Size(1600, 1200);
|
|
}
|
|
|
|
final windowOptions = WindowOptions(
|
|
size: windowSize,
|
|
minimumSize: const Size(
|
|
WindowSizeManager.minWindowWidth,
|
|
WindowSizeManager.minWindowHeight,
|
|
),
|
|
title: title,
|
|
);
|
|
|
|
windowManager.waitUntilReadyToShow(windowOptions, () async {
|
|
await windowManager.show();
|
|
await windowManager.focus();
|
|
});
|
|
}
|
|
|
|
@override
|
|
Future<void> onWindowResize() async {
|
|
final currentWindowSize = await windowManager.getSize();
|
|
WindowSizeManager().saveSize(currentWindowSize);
|
|
}
|
|
}
|