|
|
@@ -14,9 +14,11 @@ import 'package:keyboard/router/app_pages.dart';
|
|
|
import 'package:keyboard/utils/app_info_util.dart';
|
|
|
import 'package:keyboard/utils/atmob_log.dart';
|
|
|
import 'package:keyboard/utils/channel_util.dart';
|
|
|
+import 'package:keyboard/utils/floating_window_helper.dart';
|
|
|
import 'package:keyboard/utils/mmkv_util.dart';
|
|
|
import 'package:keyboard/utils/privacy_compliance.dart';
|
|
|
import 'package:keyboard/utils/toast_util.dart';
|
|
|
+import 'package:keyboard/widget/app_lifecycle_widget.dart';
|
|
|
|
|
|
import 'data/consts/build_config.dart';
|
|
|
import 'data/consts/constants.dart';
|
|
|
@@ -100,24 +102,32 @@ class MyApp extends StatelessWidget {
|
|
|
}
|
|
|
|
|
|
_buildMaterialApp() {
|
|
|
- return GetMaterialApp(
|
|
|
- onGenerateTitle: AppCommonConfig.appName,
|
|
|
- getPages: AppCommonConfig.getPages,
|
|
|
- initialRoute: AppCommonConfig.initialRoute,
|
|
|
- initialBinding: AppCommonConfig.initialBinding,
|
|
|
- theme: ThemeData(
|
|
|
- useMaterial3: true,
|
|
|
- textSelectionTheme: const TextSelectionThemeData(
|
|
|
- cursorColor: ColorName.colorPrimary, // 设置默认光标颜色
|
|
|
- selectionHandleColor: ColorName.colorPrimary, // 设置光标下面水滴的颜色
|
|
|
+ return AppLifecycleWidget(
|
|
|
+ onAppLifecycleCallback: (isForeground) {
|
|
|
+ if (isForeground) {
|
|
|
+ // 更新悬浮窗权限状态
|
|
|
+ FloatingWindowHelper.updatePermissionState();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ child: GetMaterialApp(
|
|
|
+ onGenerateTitle: AppCommonConfig.appName,
|
|
|
+ getPages: AppCommonConfig.getPages,
|
|
|
+ initialRoute: AppCommonConfig.initialRoute,
|
|
|
+ initialBinding: AppCommonConfig.initialBinding,
|
|
|
+ theme: ThemeData(
|
|
|
+ useMaterial3: true,
|
|
|
+ textSelectionTheme: const TextSelectionThemeData(
|
|
|
+ cursorColor: ColorName.colorPrimary, // 设置默认光标颜色
|
|
|
+ selectionHandleColor: ColorName.colorPrimary, // 设置光标下面水滴的颜色
|
|
|
+ ),
|
|
|
),
|
|
|
+ navigatorObservers: AppCommonConfig.navigatorObservers,
|
|
|
+ builder: AppCommonConfig.builder,
|
|
|
+ translations: AppCommonConfig.localizationsTranslations,
|
|
|
+ localizationsDelegates: AppCommonConfig.localizations.delegates,
|
|
|
+ locale: AppCommonConfig.localizations.locale,
|
|
|
+ fallbackLocale: AppCommonConfig.localizations.fallbackLocale,
|
|
|
),
|
|
|
- navigatorObservers: AppCommonConfig.navigatorObservers,
|
|
|
- builder: AppCommonConfig.builder,
|
|
|
- translations: AppCommonConfig.localizationsTranslations,
|
|
|
- localizationsDelegates: AppCommonConfig.localizations.delegates,
|
|
|
- locale: AppCommonConfig.localizations.locale,
|
|
|
- fallbackLocale: AppCommonConfig.localizations.fallbackLocale,
|
|
|
);
|
|
|
}
|
|
|
|