AppFlowy/frontend/app_flowy/lib/main.dart
Kristen McWilliam 6c895ad4fe
Refactor: app window logic (#1842)
* feat: add TargetPlatform `isDesktop` helper

Safe and convenient way to check if the current platform is a desktop platform.

* refactor: move window logic to separate class

This is much cleaner and better encapsulated. Sets up an area for
further window management in the future.

Does not try to initialize on mobile or web, which would crash.

* fix: isDesktop doc comment

* fix: set window title

Currently only displays "app_flowy" as the window title. This commit
sets the window title to "AppFlowy" as part of the init process.
2023-02-11 14:16:38 +08:00

29 lines
727 B
Dart

import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hotkey_manager/hotkey_manager.dart';
import 'startup/launch_configuration.dart';
import 'startup/startup.dart';
import 'user/presentation/splash_screen.dart';
import 'window/window.dart';
class FlowyApp implements EntryPoint {
@override
Widget create(LaunchConfiguration config) {
return SplashScreen(
autoRegister: config.autoRegistrationSupported,
);
}
}
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await EasyLocalization.ensureInitialized();
await hotKeyManager.unregisterAll();
await AppWindow.initialize();
await FlowyRunner.run(FlowyApp());
}