52 lines
1.3 KiB
Dart
52 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|
|
|
import '/common/theme.dart';
|
|
import '/database/hive_database.dart';
|
|
import '/router/router.dart';
|
|
import '/models/init_get_it.dart';
|
|
import '/utils/env.dart';
|
|
import 'notification_api.dart';
|
|
|
|
final easyLoading = EasyLoading.init();
|
|
|
|
// 本地开发环境
|
|
|
|
void main() async {
|
|
await EnvConfig.loadEnv(Env.local);
|
|
initGetIt();
|
|
await NotificationAPI.init();
|
|
HiveDatabase.registerAdapter();
|
|
runApp(const Together());
|
|
}
|
|
|
|
class Together extends StatelessWidget {
|
|
const Together({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp.router(
|
|
debugShowCheckedModeBanner: false,
|
|
title: "Together",
|
|
theme: lightThemeData(context),
|
|
darkTheme: darkThemeData(context),
|
|
routerConfig: router,
|
|
// This builder is used to dismiss keyboard while tap anywhere of the
|
|
// screen excluding the input widgets.
|
|
builder: (context, child) {
|
|
child = easyLoading(context, child);
|
|
child = GestureDetector(
|
|
onTap: () {
|
|
if (FocusManager.instance.primaryFocus != null) {
|
|
FocusManager.instance.primaryFocus!.unfocus();
|
|
}
|
|
},
|
|
child: child,
|
|
);
|
|
return child;
|
|
},
|
|
);
|
|
}
|
|
}
|