app.dart 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import 'package:fis_i18n/i18n.dart';
  2. import 'package:fis_ui/define.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:flutter_localizations/flutter_localizations.dart';
  5. import 'package:flyinsono/architecture/router/types.dart';
  6. import 'package:flyinsono/views/wechat_mini_program/wx_env/index.dart';
  7. import 'package:get/get.dart';
  8. /// Flyinsono应用
  9. class FlyinsonoApp extends GetMaterialApp implements FWidget {
  10. /// Flyinsono应用
  11. ///
  12. /// [themeMode] 主题模式
  13. ///
  14. /// [theme] 主题
  15. ///
  16. /// [darkTheme] 夜间模式主题
  17. ///
  18. /// [initialRoute] 初始静态路由
  19. ///
  20. /// [home] 初始路由
  21. ///
  22. /// [pages] 页面路由
  23. ///
  24. /// [unknownRoute] 默认 未知路由
  25. ///
  26. /// [initialBinding] 全局依赖绑定
  27. ///
  28. /// [defaultTransition] 默认 转场动画
  29. ///
  30. /// [transitionDuration] 默认 转场动画持续时长
  31. ///
  32. /// [customTransition] 自定义转场动画
  33. ///
  34. /// [supportedLocales]
  35. FlyinsonoApp({
  36. Key? key,
  37. Translations? translations,
  38. Locale? locale,
  39. Locale? fallbackLocale,
  40. ThemeMode themeMode = ThemeMode.system,
  41. ThemeData? theme,
  42. ThemeData? darkTheme,
  43. String? initialRoute,
  44. FWidget? home,
  45. List<FRouteSetting>? pages,
  46. List<NavigatorObserver> navigatorObservers = const [],
  47. FRouteSetting? unknownRoute,
  48. Bindings? initialBinding,
  49. Transition? defaultTransition,
  50. Duration? transitionDuration,
  51. CustomTransition? customTransition,
  52. TransitionBuilder? builder,
  53. ValueChanged<Routing?>? routingCallback,
  54. // Iterable<Locale>? supportedLocales,
  55. }) : super(
  56. // navigatorKey: Get.global(NavIds.ROOT),
  57. debugShowCheckedModeBanner: false, // 去除debug标签
  58. translations: translations,
  59. locale: locale,
  60. fallbackLocale: fallbackLocale,
  61. themeMode: themeMode,
  62. theme: theme,
  63. darkTheme: darkTheme,
  64. onGenerateTitle: (context) =>
  65. kIsWechat ? " " : i18nBook.common.appName.t,
  66. initialRoute: initialRoute,
  67. home: home,
  68. getPages: pages,
  69. navigatorObservers: navigatorObservers,
  70. unknownRoute: unknownRoute,
  71. initialBinding: initialBinding,
  72. defaultTransition: defaultTransition,
  73. transitionDuration: transitionDuration,
  74. customTransition: customTransition,
  75. builder: builder,
  76. localizationsDelegates: [
  77. GlobalMaterialLocalizations.delegate, // 指定本地化的字符串和一些其他的值
  78. GlobalCupertinoLocalizations.delegate, // 对应的Cupertino风格
  79. GlobalWidgetsLocalizations.delegate // 指定默认的文本排列方向, 由左到右或由右到左
  80. ],
  81. supportedLocales: [Locale("en", "US"), Locale("zh", "CN")],
  82. routingCallback: routingCallback,
  83. );
  84. }