You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
import 'package:easy_refresh/easy_refresh.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
import 'package:get_storage/get_storage.dart';
|
|
|
|
|
import 'package:problem_check_system/app/app.dart';
|
|
|
|
|
|
|
|
|
|
void main() async {
|
|
|
|
|
// 确保 Flutter Binding 已初始化
|
|
|
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
|
// --- 【核心代码】EasyRefresh 全局配置 ---
|
|
|
|
|
EasyRefresh.defaultHeaderBuilder = () => const ClassicHeader(
|
|
|
|
|
dragText: '下拉同步',
|
|
|
|
|
armedText: '释放同步',
|
|
|
|
|
readyText: '准备同步',
|
|
|
|
|
processingText: '正在同步...',
|
|
|
|
|
processedText: '同步完成',
|
|
|
|
|
noMoreText: '没有更多了',
|
|
|
|
|
failedText: '同步失败',
|
|
|
|
|
messageText: '上次同步于 %T', // %T 是一个占位符,会自动替换为时间
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
EasyRefresh.defaultFooterBuilder = () => const ClassicFooter(
|
|
|
|
|
dragText: '上拉加载',
|
|
|
|
|
armedText: '释放加载',
|
|
|
|
|
readyText: '准备加载',
|
|
|
|
|
processingText: '正在加载...',
|
|
|
|
|
processedText: '加载完成',
|
|
|
|
|
noMoreText: '没有更多了',
|
|
|
|
|
failedText: '加载失败',
|
|
|
|
|
messageText: '上次更新于 %T',
|
|
|
|
|
);
|
|
|
|
|
// --- 全局配置结束 ---
|
|
|
|
|
// 设置应用为竖屏模式
|
|
|
|
|
SystemChrome.setPreferredOrientations([
|
|
|
|
|
DeviceOrientation.portraitUp,
|
|
|
|
|
DeviceOrientation.portraitDown,
|
|
|
|
|
]);
|
|
|
|
|
// 初始化 GetStorage,这是关键步骤
|
|
|
|
|
await GetStorage.init();
|
|
|
|
|
// Add this line
|
|
|
|
|
await ScreenUtil.ensureScreenSize();
|
|
|
|
|
|
|
|
|
|
runApp(const MainApp());
|
|
|
|
|
}
|