123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- import 'dart:async';
- import 'package:flutter_localizations/flutter_localizations.dart';
- import 'package:fis_i18n/i18n.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter_easyloading/flutter_easyloading.dart';
- import 'package:flyinsonolite/consultation/records/views/applyconsultationpage.dart';
- import 'package:flyinsonolite/consultation/liveconsultation/views/liveconsultationpage.dart';
- import 'package:flyinsonolite/consultation/records/views/consultationlistpage.dart';
- import 'package:flyinsonolite/controls/prompt.dart';
- import 'package:flyinsonolite/jsonrpc/fisLib/services/index.dart';
- import 'package:flyinsonolite/infrastructure/global.dart';
- import 'package:flyinsonolite/home/views/homepage.dart';
- import 'package:flyinsonolite/infrastructure/logger.dart';
- import 'package:flyinsonolite/infrastructure/storage.dart';
- import 'package:flyinsonolite/helpers/parameterhelper.dart';
- import 'package:flyinsonolite/infrastructure/routeconstants.dart';
- import 'package:get/get.dart';
- import 'login/views/loginpage.dart';
- void main() async {
- runZonedGuarded(() async {
- var route = '/login/zh/purple';
- try {
- WidgetsFlutterBinding.ensureInitialized();
- await Global.initAsync();
- if (ParameterHelper.parameterMap.containsKey('page')) {
- var pageParameter = ParameterHelper.parameterMap['page'];
- if (pageParameter == 'liveconsultation') {
- route = RouteConstants.consultationRouteConstants.liveconsultation;
- }
- }
- } catch (e) {
- loggerAsyn(FISDeviceLogCategory.Error, 'Global init Error:{$e}');
- }
- runApp(GetMaterialApp(
- theme: Storage.currentTheme.themeData,
- locale: i18nBook.locale,
- supportedLocales: const [Locale("en", "US"), Locale("zh", "CN")],
- localizationsDelegates: const [
- GlobalMaterialLocalizations.delegate, // 指定本地化的字符串和一些其他的值
- GlobalCupertinoLocalizations.delegate, // 对应的Cupertino风格
- GlobalWidgetsLocalizations.delegate // 指定默认的文本排列方向, 由左到右或由右到左
- ],
- initialRoute: route,
- getPages: [
- GetPage(name: RouteConstants.login, page: () => LoginPage()),
- GetPage(name: RouteConstants.home, page: () => HomePage()),
- GetPage(
- name: RouteConstants.consultationRouteConstants.consultationList,
- page: () => ConsultationListPage()),
- GetPage(
- name: RouteConstants.consultationRouteConstants.applyconsultation,
- page: () => const ApplyConsultationPage()),
- GetPage(
- name: RouteConstants.consultationRouteConstants.liveconsultation,
- page: () => LiveConsultationPage())
- ],
- builder: EasyLoading.init(
- builder: (context, widget) {
- Storage.isPortraitMode.value = Get.width < Get.height;
- PromptBox.init();
- return DefaultAssetBundle(
- bundle: Global.assetBundle,
- child: MediaQuery(
- data: MediaQuery.of(context),
- child: widget ?? Container(),
- ),
- );
- },
- ),
- ));
- }, (error, stack) async {
- await loggerAsyn(FISDeviceLogCategory.Error,
- 'FlyinsonoLite An unexpected exception occurs{$error}');
- });
- }
|