Browse Source

feat : 使用EasyRefresh 下拉同步

dev
徐振升 2 months ago
parent
commit
bf6966bb30
  1. 5
      README.md
  2. 26
      lib/app/features/enterprise/presentation/pages/enterprise_list_page.dart
  3. 26
      lib/app/features/problem/presentation/pages/problem_list_page.dart
  4. 24
      lib/main.dart

5
README.md

@ -77,6 +77,11 @@ Image Picker: 用于从图库或相机选择图片。
HTTP/Dio: 网络请求库。推荐使用 Dio,因为它提供了更强大的拦截器、表单数据处理和错误处理功能。 HTTP/Dio: 网络请求库。推荐使用 Dio,因为它提供了更强大的拦截器、表单数据处理和错误处理功能。
1.0.0
feat : 问题功能
1.0.1
feat : 企业功能
TODO// TODO//
/// 定义了一个通用的 CRUD (Create, Read, Update, Delete) 仓库必须具备的核心能力 /// 定义了一个通用的 CRUD (Create, Read, Update, Delete) 仓库必须具备的核心能力

26
lib/app/features/enterprise/presentation/pages/enterprise_list_page.dart

@ -1,3 +1,4 @@
import 'package:easy_refresh/easy_refresh.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -181,7 +182,7 @@ class EnterpriseListPage extends GetView<EnterpriseListController> {
/// ///
Widget _buildEnterpriseList() { Widget _buildEnterpriseList() {
// 使 // 使
return RefreshIndicator( return EasyRefresh(
onRefresh: () async => controller.loadAndSyncEnterprises(), onRefresh: () async => controller.loadAndSyncEnterprises(),
child: Obx(() { child: Obx(() {
// 3. // 3.
@ -205,16 +206,31 @@ class EnterpriseListPage extends GetView<EnterpriseListController> {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Icon( Icon(
Icons.folder_off_outlined, Icons.search_off,
size: 60.sp, size: 60.sp,
color: Colors.grey[400], color: Colors.grey[400],
), ),
SizedBox(height: 16.h), SizedBox(height: 16.h),
Text( Text(
'没有找到相关企业', '找到相关企业',
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 20.sp,
color: Colors.grey[600], color: Colors.black87,
fontWeight: FontWeight.bold,
),
maxLines: 3,
textAlign: TextAlign.center,
),
Padding(
padding: EdgeInsetsGeometry.all(16.w),
child: Text(
'尝试调整您的筛选条件,或下拉页面以同步最新数据',
style: TextStyle(
fontSize: 18.sp,
color: Colors.grey[600],
),
maxLines: 3,
textAlign: TextAlign.center,
), ),
), ),
], ],

26
lib/app/features/problem/presentation/pages/problem_list_page.dart

@ -1,3 +1,4 @@
import 'package:easy_refresh/easy_refresh.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -274,7 +275,7 @@ class ProblemListPage extends GetView<ProblemListController> {
/// ///
Widget _buildProblemListList() { Widget _buildProblemListList() {
// 使 // 使
return RefreshIndicator( return EasyRefresh(
onRefresh: () async => controller.loadAndSyncProblems(), onRefresh: () async => controller.loadAndSyncProblems(),
child: Obx(() { child: Obx(() {
// 3. // 3.
@ -298,16 +299,31 @@ class ProblemListPage extends GetView<ProblemListController> {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Icon( Icon(
Icons.folder_off_outlined, Icons.search_off,
size: 60.sp, size: 60.sp,
color: Colors.grey[400], color: Colors.grey[400],
), ),
SizedBox(height: 16.h), SizedBox(height: 16.h),
Text( Text(
'没有找到相关问题', '找到相关问题',
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 20.sp,
color: Colors.grey[600], color: Colors.black87,
fontWeight: FontWeight.bold,
),
maxLines: 3,
textAlign: TextAlign.center,
),
Padding(
padding: EdgeInsetsGeometry.all(16.w),
child: Text(
'尝试调整您的筛选条件,或下拉页面以同步最新数据',
style: TextStyle(
fontSize: 18.sp,
color: Colors.grey[600],
),
maxLines: 3,
textAlign: TextAlign.center,
), ),
), ),
], ],

24
lib/main.dart

@ -1,3 +1,4 @@
import 'package:easy_refresh/easy_refresh.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -7,6 +8,29 @@ import 'package:problem_check_system/app/app.dart';
void main() async { void main() async {
// Flutter Binding // Flutter Binding
WidgetsFlutterBinding.ensureInitialized(); 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([ SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp, DeviceOrientation.portraitUp,

Loading…
Cancel
Save