123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- import 'dart:async';
- import 'package:flutter/material.dart';
- import 'package:fis_common/logger/logger.dart';
- import 'package:flutter_easyloading/flutter_easyloading.dart';
- import 'package:get/get.dart';
- import 'package:vitalapp/components/floating_window/index.dart';
- import 'package:vitalapp/store/store.dart';
- import 'global.dart';
- import 'routes/routes.dart';
- void main() async {
- runZonedGuarded(
- () async {
- try {
- WidgetsFlutterBinding.ensureInitialized();
- await Global.init();
- } catch (e) {
- logger.e('Global init Error', e);
- }
- runApp(const _App());
- },
- (error, stack) {
- logger.e('runZonedGuarded Error', error);
- // GlobalErrorHandler.handle(error, stack);
- },
- );
- }
- class _App extends StatelessWidget {
- const _App();
- @override
- Widget build(BuildContext context) {
- return GetMaterialApp(
- title: "杏聆荟健康平台",
- theme: ThemeData(
- // primaryColor: const Color.fromRGBO(0, 178, 237, 1),
- // TODO:
- primaryColor: Colors.blue,
- colorScheme:
- ColorScheme.fromSeed(seedColor: Color(Colors.blue.value - 40)),
- // colorScheme: ColorScheme.fromSeed(
- // // seedColor: const Color.fromRGBO(44, 119, 229, 1),
- // // seedColor: Colors.lightBlue,
- // seedColor: const Color.fromRGBO(0, 178, 237, 1),
- // ),
- // colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
- useMaterial3: true,
- fontFamily: "NotoSansSC-R-fixed",
- fontFamilyFallback: const ["NotoSansSC-R-fixed"],
- ),
- debugShowCheckedModeBanner: false,
- getPages: Routes.routes,
- initialRoute: "splash",
- // initialRoute: "/patient/create",
- // initialRoute: "/contract/signature",
- // initialRoute: "/",
- builder: EasyLoading.init(
- builder: (context, widget) {
- const designWidth = 1280.0; // 设计尺寸宽度:1280
- final size = MediaQuery.of(context).size;
- final scale = size.width / designWidth; // 计算缩放比例
- return FittedBox(
- fit: BoxFit.fitWidth,
- child: SizedBox(
- width: designWidth,
- height: size.height / scale,
- child: Center(child: widget ?? const SizedBox()),
- ),
- );
- },
- ),
- );
- }
- Widget _buildPatient() {
- if (Store.user.currentSelectPatientInfo?.patientName?.isNotEmpty ?? false) {
- return Text(
- Store.user.currentSelectPatientInfo?.patientName ?? '',
- style: const TextStyle(
- color: Colors.white,
- fontSize: 20,
- ),
- overflow: TextOverflow.ellipsis,
- );
- } else {
- return const Icon(
- Icons.add,
- size: 40,
- color: Colors.white,
- );
- }
- }
- }
|