66 lines
1.9 KiB
Dart
66 lines
1.9 KiB
Dart
import 'dart:io';
|
|
import 'dart:ui';
|
|
import 'package:elysia/plugin/Notify.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:path_provider/path_provider.dart';
|
|
import 'package:oktoast/oktoast.dart';
|
|
import 'page/LoadingPage.dart';
|
|
import 'plugin/C.dart';
|
|
|
|
void main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
await createChatConfig();
|
|
// C.init('development');
|
|
Notify.init();
|
|
C.init('release');
|
|
runApp(OKToast(child: const MyApp()));
|
|
}
|
|
|
|
Future<void> createChatConfig() async {
|
|
final appDocDir = await getApplicationDocumentsDirectory();
|
|
final configDir = Directory('${appDocDir.path}/config');
|
|
if (!await configDir.exists()) {
|
|
await configDir.create(recursive: true);
|
|
}
|
|
}
|
|
|
|
class MyApp extends StatelessWidget {
|
|
const MyApp({super.key});
|
|
|
|
static final GlobalKey<NavigatorState> navigatorKey =
|
|
GlobalKey<NavigatorState>();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
|
|
return ScreenUtilInit(
|
|
designSize: const Size(1440, 3200),
|
|
minTextAdapt: true,
|
|
splitScreenMode: true,
|
|
builder: (context, _) {
|
|
return MaterialApp(
|
|
// 强制设置为中文
|
|
locale: const Locale('zh', 'CN'),
|
|
navigatorKey: navigatorKey,
|
|
theme: ThemeData(
|
|
colorScheme: ColorScheme.light(
|
|
primary: Colors.lightBlueAccent,
|
|
onPrimary: Colors.white,
|
|
secondary: Colors.lightBlueAccent,
|
|
),
|
|
bottomNavigationBarTheme: BottomNavigationBarThemeData(
|
|
backgroundColor: Colors.white,
|
|
selectedItemColor: Colors.lightBlueAccent,
|
|
unselectedItemColor: Colors.grey,
|
|
selectedLabelStyle: TextStyle(fontWeight: FontWeight.bold),
|
|
),
|
|
useMaterial3: false,
|
|
),
|
|
home: LoadingPage(),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|