You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.7 KiB

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
4 years ago
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:aku_community/constants/app_theme.dart';
import 'package:aku_community/main_initialize.dart';
import 'package:aku_community/pages/splash/splash_page.dart';
import 'package:aku_community/provider/app_provider.dart';
import 'package:aku_community/provider/sign_up_provider.dart';
import 'package:aku_community/provider/user_provider.dart';
import 'package:aku_community/utils/developer_util.dart';
import 'package:aku_community/utils/headers.dart';
4 years ago
void main() async {
DeveloperUtil.setDev(true);
WidgetsFlutterBinding.ensureInitialized();
///firebase crashlytics initalize
await MainInitialize.initFirebase();
MainInitialize.initTheme();
await MainInitialize.initJPush();
MainInitialize.initWechat();
runApp(MyApp());
}
class MyApp extends StatefulWidget {
4 years ago
MyApp({Key? key}) : super(key: key);
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MultiProvider(
providers: [
4 years ago
ChangeNotifierProvider(create: (context) => UserProvider()),
ChangeNotifierProvider(create: (context) => AppProvider()),
ChangeNotifierProvider(create: (context) => SignUpProvider()),
],
child: GestureDetector(
onTap: () {
//点击输入框外部隐藏键盘⌨️
//只能响应点击非手势识别的组件
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus &&
currentFocus.focusedChild != null) {
4 years ago
FocusManager.instance.primaryFocus!.unfocus();
}
},
child: ScreenUtilInit(
designSize: Size(750, 1334),
builder: () => GetMaterialApp(
4 years ago
onGenerateTitle: (context) => S.of(context)!.appName,
debugShowCheckedModeBanner: false,
theme: AppTheme.theme,
home: SplashPage(),
//国际化支持
localizationsDelegates: [
4 years ago
S.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
4 years ago
supportedLocales: [const Locale('zh')],
locale: Locale('zh'),
builder: BotToastInit(),
navigatorObservers: [BotToastNavigatorObserver()],
),
),
),
);
}
}