|
|
|
@ -1,11 +1,11 @@ |
|
|
|
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'; |
|
|
|
|
|
|
|
import 'package:problem_check_system/app/core/widgets/app_bar_add.dart'; |
|
|
|
import 'package:problem_check_system/app/features/problem/presentation/controllers/problem_controller.dart'; |
|
|
|
import 'package:problem_check_system/app/features/problem/presentation/controllers/problem_controller.dart'; |
|
|
|
import 'package:problem_check_system/app/features/problem/presentation/views/problem_list_page.dart'; // 导入修正后的 ProblemListPage |
|
|
|
import 'package:problem_check_system/app/features/problem/presentation/views/widgets/problem_list_page.dart'; |
|
|
|
import 'package:problem_check_system/app/features/problem/presentation/views/widgets/current_filter_bar.dart'; |
|
|
|
import 'package:problem_check_system/app/features/problem/presentation/views/widgets/current_filter_bar.dart'; |
|
|
|
import 'package:problem_check_system/app/features/problem/presentation/views/widgets/history_filter_bar.dart'; |
|
|
|
import 'package:problem_check_system/app/features/problem/presentation/views/widgets/problem_card.dart'; |
|
|
|
import 'package:problem_check_system/app/features/problem/presentation/views/widgets/problem_card.dart'; // 导入自定义下拉菜单 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ProblemPage extends GetView<ProblemController> { |
|
|
|
class ProblemPage extends GetView<ProblemController> { |
|
|
|
const ProblemPage({super.key}); |
|
|
|
const ProblemPage({super.key}); |
|
|
|
@ -13,38 +13,9 @@ class ProblemPage extends GetView<ProblemController> { |
|
|
|
@override |
|
|
|
@override |
|
|
|
Widget build(BuildContext context) { |
|
|
|
Widget build(BuildContext context) { |
|
|
|
return Scaffold( |
|
|
|
return Scaffold( |
|
|
|
appBar: AppBar( |
|
|
|
appBar: AppBarAdd( |
|
|
|
title: Text( |
|
|
|
titleName: '问题列表', |
|
|
|
'问题列表', |
|
|
|
onAddPressed: () => controller.toProblemFormPageAndRefresh(), |
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
|
|
|
fontFamily: 'MyFont', |
|
|
|
|
|
|
|
fontSize: 18.sp, |
|
|
|
|
|
|
|
color: Colors.white, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
backgroundColor: Colors.transparent, |
|
|
|
|
|
|
|
flexibleSpace: Container( |
|
|
|
|
|
|
|
decoration: const BoxDecoration( |
|
|
|
|
|
|
|
gradient: LinearGradient( |
|
|
|
|
|
|
|
colors: [Color(0xFF418CFC), Color(0xFF3DBFFC)], |
|
|
|
|
|
|
|
begin: Alignment.centerLeft, |
|
|
|
|
|
|
|
end: Alignment.centerRight, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
elevation: 0, |
|
|
|
|
|
|
|
centerTitle: true, |
|
|
|
|
|
|
|
actions: [ |
|
|
|
|
|
|
|
IconButton( |
|
|
|
|
|
|
|
icon: Icon(Icons.add, color: Colors.white), // 使用 .sp |
|
|
|
|
|
|
|
onPressed: () {}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
IconButton( |
|
|
|
|
|
|
|
icon: Icon(Icons.upload, color: Colors.pink[300]), // 使用 .sp |
|
|
|
|
|
|
|
onPressed: () {}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
body: Column( |
|
|
|
body: Column( |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
@ -59,65 +30,65 @@ class ProblemPage extends GetView<ProblemController> { |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, |
|
|
|
// floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, |
|
|
|
// 使用 Stack 统一管理所有浮动按钮 |
|
|
|
// 使用 Stack 统一管理所有浮动按钮 |
|
|
|
floatingActionButton: Stack( |
|
|
|
// floatingActionButton: Stack( |
|
|
|
children: [ |
|
|
|
// children: [ |
|
|
|
// 固定位置的 "添加" 按钮 |
|
|
|
// // 固定位置的 "添加" 按钮 |
|
|
|
// 使用 Align 和 Positioned |
|
|
|
// // 使用 Align 和 Positioned |
|
|
|
Align( |
|
|
|
// Align( |
|
|
|
alignment: Alignment.bottomCenter, |
|
|
|
// alignment: Alignment.bottomCenter, |
|
|
|
child: Padding( |
|
|
|
// child: Padding( |
|
|
|
padding: EdgeInsets.only(bottom: 24.h), // 底部间距 |
|
|
|
// padding: EdgeInsets.only(bottom: 24.h), // 底部间距 |
|
|
|
child: FloatingActionButton( |
|
|
|
// child: FloatingActionButton( |
|
|
|
heroTag: "btn_add", |
|
|
|
// heroTag: "btn_add", |
|
|
|
onPressed: () { |
|
|
|
// onPressed: () { |
|
|
|
controller.toProblemFormPageAndRefresh(); |
|
|
|
// controller.toProblemFormPageAndRefresh(); |
|
|
|
}, |
|
|
|
// }, |
|
|
|
shape: const CircleBorder(), |
|
|
|
// shape: const CircleBorder(), |
|
|
|
backgroundColor: Colors.blue[300], |
|
|
|
// backgroundColor: Colors.blue[300], |
|
|
|
foregroundColor: Colors.white, |
|
|
|
// foregroundColor: Colors.white, |
|
|
|
child: const Icon(Icons.add), |
|
|
|
// child: const Icon(Icons.add), |
|
|
|
), |
|
|
|
// ), |
|
|
|
), |
|
|
|
// ), |
|
|
|
), |
|
|
|
// ), |
|
|
|
|
|
|
|
|
|
|
|
// 可拖动的 "上传" 按钮 |
|
|
|
// // 可拖动的 "上传" 按钮 |
|
|
|
Obx(() { |
|
|
|
// Obx(() { |
|
|
|
final isOnline = controller.isOnline.value; |
|
|
|
// final isOnline = controller.isOnline.value; |
|
|
|
return Positioned( |
|
|
|
// return Positioned( |
|
|
|
// 使用正确的坐标,left/right 对应 dx,top/bottom 对应 dy |
|
|
|
// // 使用正确的坐标,left/right 对应 dx,top/bottom 对应 dy |
|
|
|
left: controller.fabUploadPosition.value.dx, |
|
|
|
// left: controller.fabUploadPosition.value.dx, |
|
|
|
top: controller.fabUploadPosition.value.dy, |
|
|
|
// top: controller.fabUploadPosition.value.dy, |
|
|
|
child: GestureDetector( |
|
|
|
// child: GestureDetector( |
|
|
|
onPanUpdate: (details) { |
|
|
|
// onPanUpdate: (details) { |
|
|
|
// 调用控制器中的方法来更新位置 |
|
|
|
// // 调用控制器中的方法来更新位置 |
|
|
|
controller.updateFabUploadPosition(details.delta); |
|
|
|
// controller.updateFabUploadPosition(details.delta); |
|
|
|
}, |
|
|
|
// }, |
|
|
|
onPanEnd: (details) { |
|
|
|
// onPanEnd: (details) { |
|
|
|
// 拖动结束后调用吸附方法 |
|
|
|
// // 拖动结束后调用吸附方法 |
|
|
|
controller.snapToEdge(); |
|
|
|
// controller.snapToEdge(); |
|
|
|
}, |
|
|
|
// }, |
|
|
|
child: FloatingActionButton( |
|
|
|
// child: FloatingActionButton( |
|
|
|
heroTag: "btn_upload", |
|
|
|
// heroTag: "btn_upload", |
|
|
|
onPressed: isOnline |
|
|
|
// onPressed: isOnline |
|
|
|
? () => controller.showUploadPage() |
|
|
|
// ? () => controller.showUploadPage() |
|
|
|
: null, |
|
|
|
// : null, |
|
|
|
foregroundColor: Colors.white, |
|
|
|
// foregroundColor: Colors.white, |
|
|
|
backgroundColor: isOnline |
|
|
|
// backgroundColor: isOnline |
|
|
|
? Colors.red[300] |
|
|
|
// ? Colors.red[300] |
|
|
|
: Colors.grey[400], |
|
|
|
// : Colors.grey[400], |
|
|
|
child: Icon( |
|
|
|
// child: Icon( |
|
|
|
isOnline |
|
|
|
// isOnline |
|
|
|
? Icons.file_upload_outlined |
|
|
|
// ? Icons.file_upload_outlined |
|
|
|
: Icons.cloud_off_outlined, |
|
|
|
// : Icons.cloud_off_outlined, |
|
|
|
), |
|
|
|
// ), |
|
|
|
), |
|
|
|
// ), |
|
|
|
), |
|
|
|
// ), |
|
|
|
); |
|
|
|
// ); |
|
|
|
}), |
|
|
|
// }), |
|
|
|
], |
|
|
|
// ], |
|
|
|
), |
|
|
|
// ), |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|