51 lines
1.5 KiB
Dart
51 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'common/components/easy_loading.dart';
|
|
import 'common/config/strings.dart';
|
|
import 'common/theme/themes.dart';
|
|
import 'routes/app_pages.dart';
|
|
|
|
void main() async {
|
|
runApp(const MyApp());
|
|
|
|
// EasyLoading配置
|
|
configLoading();
|
|
}
|
|
|
|
class MyApp extends StatelessWidget {
|
|
const MyApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final easyLoading = EasyLoading.init();
|
|
return ScreenUtilInit(
|
|
// 设计稿中设备的尺寸(单位随意,建议dp,但在使用过程中必须保持一致)
|
|
designSize: const Size(360, 690),
|
|
// 是否根据宽度/高度中的最小值适配文字
|
|
minTextAdapt: true,
|
|
// 支持分屏尺寸
|
|
splitScreenMode: true,
|
|
builder: (context, child) {
|
|
return GetMaterialApp(
|
|
title: appName,
|
|
theme: lightTheme,
|
|
darkTheme: darkTheme,
|
|
themeMode: ThemeMode.light,
|
|
getPages: AppPages.routes,
|
|
initialRoute: AppPages.home,
|
|
builder: (context, widget) {
|
|
widget = easyLoading(context, widget);
|
|
return MediaQuery(
|
|
// 设置文字大小不随系统设置改变
|
|
data: MediaQuery.of(context).copyWith(textScaler: TextScaler.noScaling),
|
|
child: widget,
|
|
);
|
|
},
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|