import 'package:fis_i18n/i18n.dart';
import 'package:fis_ui/define.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flyinsono/architecture/router/types.dart';
import 'package:flyinsono/views/wechat_mini_program/wx_env/index.dart';
import 'package:get/get.dart';

/// Flyinsono应用
class FlyinsonoApp extends GetMaterialApp implements FWidget {
  /// Flyinsono应用
  ///
  /// [themeMode] 主题模式
  ///
  /// [theme] 主题
  ///
  /// [darkTheme] 夜间模式主题
  ///
  /// [initialRoute] 初始静态路由
  ///
  /// [home] 初始路由
  ///
  /// [pages] 页面路由
  ///
  /// [unknownRoute] 默认 未知路由
  ///
  /// [initialBinding] 全局依赖绑定
  ///
  /// [defaultTransition] 默认 转场动画
  ///
  /// [transitionDuration] 默认 转场动画持续时长
  ///
  /// [customTransition] 自定义转场动画
  ///
  /// [supportedLocales]
  FlyinsonoApp({
    Key? key,
    Translations? translations,
    Locale? locale,
    Locale? fallbackLocale,
    ThemeMode themeMode = ThemeMode.system,
    ThemeData? theme,
    ThemeData? darkTheme,
    String? initialRoute,
    FWidget? home,
    List<FRouteSetting>? pages,
    List<NavigatorObserver> navigatorObservers = const [],
    FRouteSetting? unknownRoute,
    Bindings? initialBinding,
    Transition? defaultTransition,
    Duration? transitionDuration,
    CustomTransition? customTransition,
    TransitionBuilder? builder,
    ValueChanged<Routing?>? routingCallback,
    // Iterable<Locale>? supportedLocales,
  }) : super(
          // navigatorKey: Get.global(NavIds.ROOT),
          debugShowCheckedModeBanner: false, // 去除debug标签
          translations: translations,
          locale: locale,
          fallbackLocale: fallbackLocale,
          themeMode: themeMode,
          theme: theme,
          darkTheme: darkTheme,
          onGenerateTitle: (context) =>
              kIsWechat ? " " : i18nBook.common.appName.t,
          initialRoute: initialRoute,
          home: home,
          getPages: pages,
          navigatorObservers: navigatorObservers,
          unknownRoute: unknownRoute,
          initialBinding: initialBinding,
          defaultTransition: defaultTransition,
          transitionDuration: transitionDuration,
          customTransition: customTransition,
          builder: builder,
          localizationsDelegates: [
            GlobalMaterialLocalizations.delegate, // 指定本地化的字符串和一些其他的值
            GlobalCupertinoLocalizations.delegate, // 对应的Cupertino风格
            GlobalWidgetsLocalizations.delegate // 指定默认的文本排列方向, 由左到右或由右到左
          ],
          supportedLocales: [Locale("en", "US"), Locale("zh", "CN")],
          routingCallback: routingCallback,
        );
}
