2021-12-07 22:58:50 +05:30
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
2021-06-19 23:41:19 +08:00
|
|
|
import 'package:flutter/material.dart';
|
2022-12-20 11:14:42 +08:00
|
|
|
import 'package:hotkey_manager/hotkey_manager.dart';
|
2023-02-09 01:42:18 -05:00
|
|
|
import 'package:window_manager/window_manager.dart';
|
2022-12-20 11:14:42 +08:00
|
|
|
|
|
|
|
import 'startup/launch_configuration.dart';
|
|
|
|
import 'startup/startup.dart';
|
|
|
|
import 'user/presentation/splash_screen.dart';
|
2021-06-19 23:41:19 +08:00
|
|
|
|
2021-09-12 22:19:59 +08:00
|
|
|
class FlowyApp implements EntryPoint {
|
2021-06-19 23:41:19 +08:00
|
|
|
@override
|
2022-12-20 11:14:42 +08:00
|
|
|
Widget create(LaunchConfiguration config) {
|
|
|
|
return SplashScreen(
|
|
|
|
autoRegister: config.autoRegistrationSupported,
|
|
|
|
);
|
2021-06-19 23:41:19 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-20 11:14:42 +08:00
|
|
|
Future<void> main() async {
|
2021-12-07 22:58:50 +05:30
|
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
|
2023-02-09 01:42:18 -05:00
|
|
|
await EasyLocalization.ensureInitialized();
|
2022-08-08 16:36:26 +08:00
|
|
|
await hotKeyManager.unregisterAll();
|
2023-02-09 01:42:18 -05:00
|
|
|
await windowManager.ensureInitialized();
|
|
|
|
|
|
|
|
await setWindowOptions();
|
2022-08-08 16:36:26 +08:00
|
|
|
|
2022-02-20 16:10:50 +08:00
|
|
|
await FlowyRunner.run(FlowyApp());
|
2021-06-19 23:41:19 +08:00
|
|
|
}
|
2023-02-09 01:42:18 -05:00
|
|
|
|
|
|
|
Future<void> setWindowOptions() async {
|
|
|
|
WindowOptions windowOptions = const WindowOptions(
|
|
|
|
minimumSize: Size(600, 400),
|
|
|
|
);
|
|
|
|
return windowManager.waitUntilReadyToShow(windowOptions, () async {
|
|
|
|
await windowManager.show();
|
|
|
|
await windowManager.focus();
|
|
|
|
});
|
|
|
|
}
|