2021-06-19 15:41:19 +00:00
|
|
|
import 'package:app_flowy/startup/startup.dart';
|
2021-07-13 00:47:26 +00:00
|
|
|
import 'package:flowy_infra/theme.dart';
|
2021-07-29 14:22:35 +00:00
|
|
|
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
2021-06-19 15:41:19 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:window_size/window_size.dart';
|
|
|
|
import 'package:app_flowy/startup/launch.dart';
|
|
|
|
|
|
|
|
class AppWidgetTask extends LaunchTask {
|
|
|
|
@override
|
|
|
|
LaunchTaskType get type => LaunchTaskType.appLauncher;
|
|
|
|
|
|
|
|
@override
|
2021-07-12 15:27:58 +00:00
|
|
|
Future<void> initialize(LaunchContext context) {
|
2021-09-12 14:19:59 +00:00
|
|
|
final widget = context.getIt<EntryPoint>().create();
|
2021-07-22 03:23:15 +00:00
|
|
|
final app = ApplicationWidget(child: widget);
|
2021-06-19 15:41:19 +00:00
|
|
|
runApp(app);
|
2021-07-12 15:27:58 +00:00
|
|
|
|
|
|
|
return Future(() => {});
|
2021-06-19 15:41:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-22 03:23:15 +00:00
|
|
|
class ApplicationWidget extends StatelessWidget {
|
2021-06-19 15:41:19 +00:00
|
|
|
final Widget child;
|
2021-07-22 03:23:15 +00:00
|
|
|
const ApplicationWidget({
|
2021-06-19 15:41:19 +00:00
|
|
|
Key? key,
|
|
|
|
required this.child,
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
setWindowMinSize(const Size(500, 500));
|
|
|
|
|
|
|
|
final theme = AppTheme.fromType(ThemeType.light);
|
|
|
|
return Provider.value(
|
|
|
|
value: theme,
|
|
|
|
child: MaterialApp(
|
2021-07-29 14:22:35 +00:00
|
|
|
builder: overlayManagerBuilder(),
|
2021-06-19 15:41:19 +00:00
|
|
|
debugShowCheckedModeBanner: false,
|
|
|
|
theme: theme.themeData,
|
|
|
|
navigatorKey: AppGlobals.rootNavKey,
|
|
|
|
home: child,
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class AppGlobals {
|
|
|
|
static GlobalKey<NavigatorState> rootNavKey = GlobalKey();
|
|
|
|
static NavigatorState get nav => rootNavKey.currentState!;
|
|
|
|
}
|