mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
e3eee76609
* feat: support align and upgrade appflowy_editor * chore: try to fix linux analyze error * fix: error after inserting callout block * feat: add inline board / grid plugin * feat: refactor insert_page * fix: ref view in document * chore: add asset name and description to option align type * fix: linux flutter analyze * chore: disable file export and log * fix: the window always back to center after relaunching * fix: potential data lost in nested list * feat: re-design login page * fix: can't remove background color * chore: rename bundle id and change the macos app to non sandbox app --------- Co-authored-by: nathan <nathan@appflowy.io>
52 lines
1.4 KiB
Dart
52 lines
1.4 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);
|
|
|
|
final windowSize = await WindowSizeManager().getSize();
|
|
|
|
final windowOptions = WindowOptions(
|
|
size: windowSize,
|
|
minimumSize: const Size(
|
|
WindowSizeManager.minWindowWidth,
|
|
WindowSizeManager.minWindowHeight,
|
|
),
|
|
title: title,
|
|
);
|
|
|
|
await windowManager.waitUntilReadyToShow(windowOptions, () async {
|
|
await windowManager.show();
|
|
await windowManager.focus();
|
|
});
|
|
}
|
|
|
|
@override
|
|
Future<void> onWindowResize() async {
|
|
final currentWindowSize = await windowManager.getSize();
|
|
WindowSizeManager().saveSize(currentWindowSize);
|
|
}
|
|
}
|