diff --git a/lib/data/repositories/problem_repository.dart b/lib/data/repositories/problem_repository.dart index a28a430..66c2df1 100644 --- a/lib/data/repositories/problem_repository.dart +++ b/lib/data/repositories/problem_repository.dart @@ -44,17 +44,19 @@ class ProblemRepository extends GetxService { /// 通用查询方法,根据可选的筛选条件获取问题列表。 /// - `startDate`/`endDate`:筛选创建时间范围。 - /// - `uploadStatus`:筛选上传状态('已上传', '未上传', '全部')。 + /// - `syncStatus`:筛选上传状态('已上传', '未上传', '全部')。 /// - `bindStatus`:筛选绑定状态('已绑定', '未绑定', '全部')。 Future getProblems({ DateTime? startDate, DateTime? endDate, - String? uploadStatus, + String? syncStatus, String? bindStatus, }) async { return await sqliteProvider.getProblems( startDate: startDate, endDate: endDate, + syncStatus: syncStatus, + bindStatus: bindStatus, ); } diff --git a/lib/modules/problem/bindings/problem_form_binding.dart b/lib/modules/problem/bindings/problem_form_binding.dart index dd13cf5..d357bc2 100644 --- a/lib/modules/problem/bindings/problem_form_binding.dart +++ b/lib/modules/problem/bindings/problem_form_binding.dart @@ -1,11 +1,23 @@ import 'package:get/get.dart'; +import 'package:problem_check_system/data/models/problem_model.dart'; import 'package:problem_check_system/modules/problem/controllers/problem_form_controller.dart'; class ProblemFormBinding extends Bindings { @override void dependencies() { + final dynamic arguments = Get.arguments; + final bool readOnly = Get.parameters['isReadOnly'] == 'true'; + + Problem? problem; + if (arguments != null && arguments is Problem) { + problem = arguments; + } Get.lazyPut( - () => ProblemFormController(problemRepository: Get.find()), + () => ProblemFormController( + problemRepository: Get.find(), + problem: problem, + isReadOnly: readOnly, + ), ); } } diff --git a/lib/modules/problem/controllers/problem_controller.dart b/lib/modules/problem/controllers/problem_controller.dart index 066b94a..b44d007 100644 --- a/lib/modules/problem/controllers/problem_controller.dart +++ b/lib/modules/problem/controllers/problem_controller.dart @@ -59,7 +59,9 @@ class ProblemController extends GetxController final RxString currentBindFilter = '全部'.obs; // 历史问题列表筛选条件 - final Rx historyStartTime = DateTime.now().obs; + final Rx historyStartTime = DateTime.now() + .subtract(const Duration(days: 7)) + .obs; final Rx historyEndTime = DateTime.now().obs; final RxString historyUploadFilter = '全部'.obs; final RxString historyBindFilter = '全部'.obs; @@ -285,8 +287,9 @@ class ProblemController extends GetxController } // #endregion + // 添加筛选方法 // 更新日期范围的方法 - void updateDateRange(String rangeValue) { + void updateCurrentDateRange(String rangeValue) { final newRange = rangeValue.toDateRange(); if (newRange != null) { currentDateRange.value = newRange; @@ -294,17 +297,50 @@ class ProblemController extends GetxController } } - // 添加筛选方法 - void updateUploadFilter(String value) { + void updateCurrentUpload(String value) { currentUploadFilter.value = value; loadProblems(); // 重新加载数据 } - void updateBindFilter(String value) { + void updateCurrentBind(String value) { currentBindFilter.value = value; loadProblems(); // 重新加载数据 } + // 添加筛选方法 + /// 显示日期选择器 + Future selectDateRange(BuildContext context) async { + final initialDateRange = DateTimeRange( + start: historyStartTime.value, + end: historyEndTime.value, + ); + + final DateTimeRange? picked = await showDateRangePicker( + context: context, + firstDate: DateTime(2025, 8, 1), // 可选的最早日期 + lastDate: DateTime(2101), // 可选的最晚日期 + initialDateRange: initialDateRange, + ); + + if (picked != null) { + // 处理用户选择的日期范围 + historyStartTime.value = picked.start; + historyEndTime.value = picked.end; + loadProblems(); + log('选择的日期范围是: ${picked.start} 到 ${picked.end}'); + } + } + + void updateHistoryUpload(String value) { + historyUploadFilter.value = value; + loadProblems(); // 重新加载数据 + } + + void updateHistoryBind(String value) { + historyBindFilter.value = value; + loadProblems(); // 重新加载数据 + } + /// 加载 Future loadProblems() async { isLoading.value = true; @@ -332,7 +368,7 @@ class ProblemController extends GetxController final loadedProblems = await problemRepository.getProblems( startDate: startDate, endDate: endDate, - uploadStatus: uploadStatus, + syncStatus: uploadStatus, bindStatus: bindStatus, ); @@ -409,27 +445,6 @@ class ProblemController extends GetxController } } - /// 显示日期选择器 - /// - Future selectDateRange(BuildContext context) async { - final initialDateRange = DateTimeRange( - start: DateTime.now().subtract(const Duration(days: 7)), - end: DateTime.now(), - ); - - final DateTimeRange? picked = await showDateRangePicker( - context: context, - firstDate: DateTime(2025, 8, 1), // 可选的最早日期 - lastDate: DateTime(2101), // 可选的最晚日期 - initialDateRange: initialDateRange, - ); - - if (picked != null) { - // 处理用户选择的日期范围 - log('选择的日期范围是: ${picked.start} 到 ${picked.end}'); - } - } - Future toProblemFormPageAndRefresh() async { await Get.toNamed(AppRoutes.problemForm); loadProblems(); diff --git a/lib/modules/problem/controllers/problem_form_controller.dart b/lib/modules/problem/controllers/problem_form_controller.dart index b4ce3e9..8c40182 100644 --- a/lib/modules/problem/controllers/problem_form_controller.dart +++ b/lib/modules/problem/controllers/problem_form_controller.dart @@ -11,31 +11,27 @@ import 'package:problem_check_system/data/models/problem_model.dart'; import 'package:problem_check_system/data/repositories/problem_repository.dart'; class ProblemFormController extends GetxController { + final Problem? problem; + final bool isReadOnly; + final ProblemRepository problemRepository; final TextEditingController descriptionController = TextEditingController(); final TextEditingController locationController = TextEditingController(); final RxList selectedImages = [].obs; final RxBool isLoading = false.obs; - // 当前正在编辑的问题 - Problem? _currentProblem; - // 使用依赖注入,便于测试 - ProblemFormController({required this.problemRepository}); - - /// 初始化方法,用于加载现有问题数据 - void init(Problem? problem) { - _currentProblem = problem; + ProblemFormController({ + required this.problemRepository, + this.problem, + this.isReadOnly = false, + }) { if (problem != null) { - descriptionController.text = problem.description; - locationController.text = problem.location; - - // 清空旧数据,并从 ImageMetadata 中加载图片路径 - // 假定您需要一个List来存储图片路径 - final imagePaths = problem.imageUrls + descriptionController.text = problem!.description; + locationController.text = problem!.location; + final imagePaths = problem!.imageUrls .map((meta) => XFile(meta.localPath)) .toList(); - // 假设您的selectedImages是一个RxList或类似的列表,支触发一次UI重建 selectedImages.assignAll(imagePaths); } else { descriptionController.clear(); @@ -144,9 +140,9 @@ class ProblemFormController extends GetxController { // 保存图片到本地 final List imagePaths = await _saveImagesToLocal(); - if (_currentProblem != null) { + if (problem != null) { // 编辑模式:更新现有问题 - final updatedProblem = _currentProblem!.copyWith( + final updatedProblem = problem!.copyWith( description: descriptionController.text, location: locationController.text, imageUrls: imagePaths, @@ -238,7 +234,7 @@ class ProblemFormController extends GetxController { // 检查表单是否有更改 bool _hasFormChanges() { - if (_currentProblem == null) { + if (problem == null) { // 新增模式:只要有内容就是有更改 return descriptionController.text.isNotEmpty || locationController.text.isNotEmpty || @@ -246,9 +242,9 @@ class ProblemFormController extends GetxController { } // 编辑模式:检查与原始值的差异 - return descriptionController.text != _currentProblem!.description || - locationController.text != _currentProblem!.location || - selectedImages.length != _currentProblem!.imageUrls.length; + return descriptionController.text != problem!.description || + locationController.text != problem!.location || + selectedImages.length != problem!.imageUrls.length; } @override diff --git a/lib/modules/problem/views/problem_form_page.dart b/lib/modules/problem/views/problem_form_page.dart index 7db53ca..da69250 100644 --- a/lib/modules/problem/views/problem_form_page.dart +++ b/lib/modules/problem/views/problem_form_page.dart @@ -4,18 +4,13 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:image_picker/image_picker.dart'; import 'package:problem_check_system/modules/problem/controllers/problem_form_controller.dart'; -import 'package:problem_check_system/data/models/problem_model.dart'; class ProblemFormPage extends GetView { - final Problem? problem; - final bool isReadOnly; - // 构造函数,接收只读标志 - const ProblemFormPage({super.key, this.problem, this.isReadOnly = false}); + const ProblemFormPage({super.key}); @override Widget build(BuildContext context) { - controller.init(problem); return Scaffold( appBar: AppBar( flexibleSpace: Container( @@ -38,7 +33,9 @@ class ProblemFormPage extends GetView { ), // 根据只读模式和问题对象动态设置标题 title: Text( - isReadOnly ? '问题详情' : (problem == null ? '新增问题' : '编辑问题'), + controller.isReadOnly + ? '问题详情' + : (controller.problem == null ? '新增问题' : '编辑问题'), style: const TextStyle(color: Colors.white), ), centerTitle: true, @@ -52,12 +49,12 @@ class ProblemFormPage extends GetView { children: [ _buildInputCard( title: '问题描述', - controller: controller.descriptionController, + textController: controller.descriptionController, hintText: '请输入问题描述', ), _buildInputCard( title: '所在位置', - controller: controller.locationController, + textController: controller.locationController, hintText: '请输入问题所在位置', ), _buildImageCard(context), @@ -66,7 +63,7 @@ class ProblemFormPage extends GetView { ), ), // 只有在非只读模式下才显示底部操作按钮 - if (!isReadOnly) _bottomButton(), + if (!controller.isReadOnly) _bottomButton(), ], ), ); @@ -75,7 +72,7 @@ class ProblemFormPage extends GetView { /// 构建输入框卡片 Widget _buildInputCard({ required String title, - required TextEditingController controller, + required TextEditingController textController, required String hintText, }) { return Card( @@ -92,8 +89,8 @@ class ProblemFormPage extends GetView { padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h), child: TextField( maxLines: null, - controller: controller, - readOnly: isReadOnly, // 关键:根据只读标志设置可编辑性 + controller: textController, + readOnly: controller.isReadOnly, // 关键:根据只读标志设置可编辑性 decoration: InputDecoration( hintText: hintText, border: InputBorder.none, @@ -130,7 +127,7 @@ class ProblemFormPage extends GetView { Widget _buildImageGrid(BuildContext context) { return Obx(() { // 在只读模式下不显示添加按钮 - final bool showAddButton = !isReadOnly; + final bool showAddButton = !controller.isReadOnly; final int itemCount = controller.selectedImages.length + (showAddButton ? 1 : 0); @@ -202,7 +199,7 @@ class ProblemFormPage extends GetView { ), ), // 只有在非只读模式下才显示删除按钮 - if (!isReadOnly) + if (!controller.isReadOnly) Positioned( top: 0, right: 0, diff --git a/lib/modules/problem/views/problem_page.dart b/lib/modules/problem/views/problem_page.dart index 2de02aa..397b153 100644 --- a/lib/modules/problem/views/problem_page.dart +++ b/lib/modules/problem/views/problem_page.dart @@ -4,8 +4,8 @@ import 'package:get/get.dart'; import 'package:problem_check_system/app/routes/app_routes.dart'; import 'package:problem_check_system/modules/problem/controllers/problem_controller.dart'; import 'package:problem_check_system/modules/problem/views/problem_list_page.dart'; // 导入修正后的 ProblemListPage -import 'package:problem_check_system/modules/problem/views/widgets/compact_filter_bar.dart'; -import 'package:problem_check_system/modules/problem/views/widgets/custom_object_dropdown.dart'; +import 'package:problem_check_system/modules/problem/views/widgets/current_filter_bar.dart'; +import 'package:problem_check_system/modules/problem/views/widgets/history_filter_bar.dart'; import 'package:problem_check_system/modules/problem/views/widgets/problem_card.dart'; // 导入自定义下拉菜单 class ProblemPage extends GetView { @@ -68,16 +68,7 @@ class ProblemPage extends GetView { decoration: BoxDecoration(color: Color(0xfff7f7f7)), child: Column( children: [ - CompactFilterBar( - showDateRangeFilter: true, - showUploadFilter: true, - showBindFilter: true, - padding: EdgeInsets.symmetric( - horizontal: 17.w, - vertical: 0.h, - ), - ), - + CurrentFilterBar(), Expanded( child: // 使用通用列表组件 ProblemListPage( @@ -93,26 +84,11 @@ class ProblemPage extends GetView { decoration: BoxDecoration(color: Color(0xfff7f7f7)), child: Column( children: [ - CompactFilterBar( - showDateRangeFilter: false, - showUploadFilter: true, - showBindFilter: true, - showCustomButton: true, - customButtonIcon: Icons.date_range, - customButtonText: "选择日期", - onCustomButtonPressed: () { - // 设置逻辑 - }, - // padding: EdgeInsets.symmetric( - // horizontal: 0.w, - // vertical: 0.h, - // ), - ), - + HistoryFilterBar(), Expanded( child: // 使用通用列表组件 ProblemListPage( - problemsToShow: controller.problems, + problemsToShow: controller.historyProblems, viewType: ProblemCardViewType.buttons, ), ), diff --git a/lib/modules/problem/views/widgets/compact_filter_bar.dart b/lib/modules/problem/views/widgets/compact_filter_bar.dart deleted file mode 100644 index 19847f7..0000000 --- a/lib/modules/problem/views/widgets/compact_filter_bar.dart +++ /dev/null @@ -1,122 +0,0 @@ -// widgets/compact_filter_bar.dart -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:problem_check_system/modules/problem/controllers/problem_controller.dart'; - -import 'custom_filter_dropdown.dart'; - -class CompactFilterBar extends GetView { - final bool showDateRangeFilter; - final bool showUploadFilter; - final bool showBindFilter; - final bool showCustomButton; // 新增:是否显示自定义按钮 - final String? customButtonText; // 新增:自定义按钮文本 - final IconData? customButtonIcon; // 新增:自定义按钮图标 - final VoidCallback? onCustomButtonPressed; // 新增:自定义按钮点击回调 - final EdgeInsetsGeometry? padding; - - const CompactFilterBar({ - super.key, - this.showDateRangeFilter = true, - this.showUploadFilter = true, - this.showBindFilter = true, - this.showCustomButton = false, // 默认不显示 - this.customButtonText, - this.customButtonIcon, - this.onCustomButtonPressed, - this.padding, - }); - - @override - Widget build(BuildContext context) { - return Container( - padding: padding ?? EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h), - color: Colors.grey[50], - child: Row( - children: [ - // 自定义按钮 - if (showCustomButton) ...[_buildCustomButton()], - // 日期范围筛选 - if (showDateRangeFilter) ...[ - Obx( - () => CustomFilterDropdown( - title: '时间范围', - options: controller.dateRangeOptions, - selectedValue: controller.currentDateRange.value.name, - onChanged: controller.updateDateRange, - width: 100.w, - showBorder: false, - ), - ), - ], - - // 上传状态筛选 - if (showUploadFilter) ...[ - Obx( - () => CustomFilterDropdown( - title: '上传状态', - options: controller.uploadOptions, - selectedValue: controller.currentUploadFilter.value, - onChanged: controller.updateUploadFilter, - width: 100.w, - showBorder: false, - ), - ), - ], - - // 绑定状态筛选 - if (showBindFilter) ...[ - Obx( - () => CustomFilterDropdown( - title: '绑定状态', - options: controller.bindOptions, - selectedValue: controller.currentBindFilter.value, - onChanged: controller.updateBindFilter, - width: 100.w, - showBorder: false, - ), - ), - ], - ], - ), - ); - } - - // 构建自定义按钮 - Widget _buildCustomButton() { - return SizedBox( - width: 110.w, - // decoration: BoxDecoration( - // border: Border.all(color: Colors.grey.shade300), - // borderRadius: BorderRadius.circular(8.r), - // ), - child: TextButton( - onPressed: onCustomButtonPressed, - style: TextButton.styleFrom( - padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 4.h), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8.r), - ), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - if (customButtonIcon != null) ...[ - Icon(customButtonIcon, size: 16.sp, color: Colors.grey[700]), - SizedBox(width: 4.w), - ], - Text( - customButtonText ?? '自定义', - style: TextStyle( - fontSize: 14.sp, - color: Colors.black87, - fontWeight: FontWeight.normal, - ), - ), - ], - ), - ), - ); - } -} diff --git a/lib/modules/problem/views/widgets/current_filter_bar.dart b/lib/modules/problem/views/widgets/current_filter_bar.dart new file mode 100644 index 0000000..37b9db0 --- /dev/null +++ b/lib/modules/problem/views/widgets/current_filter_bar.dart @@ -0,0 +1,66 @@ +// widgets/compact_filter_bar.dart +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:problem_check_system/modules/problem/controllers/problem_controller.dart'; + +import 'custom_filter_dropdown.dart'; + +class CurrentFilterBar extends GetView { + final EdgeInsetsGeometry? padding; + + const CurrentFilterBar({super.key, this.padding}); + + @override + Widget build(BuildContext context) { + return Container( + padding: padding ?? EdgeInsets.symmetric(horizontal: 16.w, vertical: 5.h), + color: Colors.grey[50], + child: Row( + children: [ + // 日期范围筛选 + ...[ + Obx( + () => CustomFilterDropdown( + title: '时间范围', + options: controller.dateRangeOptions, + selectedValue: controller.currentDateRange.value.name, + onChanged: controller.updateCurrentDateRange, + width: 100.w, + showBorder: false, + ), + ), + ], + + // 上传状态筛选 + ...[ + Obx( + () => CustomFilterDropdown( + title: '上传状态', + options: controller.uploadOptions, + selectedValue: controller.currentUploadFilter.value, + onChanged: controller.updateCurrentUpload, + width: 100.w, + showBorder: false, + ), + ), + ], + + // 绑定状态筛选 + ...[ + Obx( + () => CustomFilterDropdown( + title: '绑定状态', + options: controller.bindOptions, + selectedValue: controller.currentBindFilter.value, + onChanged: controller.updateCurrentBind, + width: 100.w, + showBorder: false, + ), + ), + ], + ], + ), + ); + } +} diff --git a/lib/modules/problem/views/widgets/custom_object_dropdown.dart b/lib/modules/problem/views/widgets/custom_object_dropdown.dart deleted file mode 100644 index 9ad92d8..0000000 --- a/lib/modules/problem/views/widgets/custom_object_dropdown.dart +++ /dev/null @@ -1,53 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; -import 'package:problem_check_system/modules/problem/views/widgets/models/dropdown_option.dart'; - -class CustomObjectDropdown extends StatelessWidget { - final RxString selectedValue; - final List items; - final Function(String) onChanged; - - const CustomObjectDropdown({ - super.key, - required this.selectedValue, - required this.items, - required this.onChanged, - }); - - @override - Widget build(BuildContext context) { - return Obx( - () => Container( - height: 30.h, - margin: EdgeInsets.only(right: 10.w, top: 10.w, bottom: 10.w), - alignment: Alignment.center, - padding: EdgeInsets.symmetric(horizontal: 12.5.w, vertical: 7.5.h), - decoration: BoxDecoration( - color: const Color.fromARGB(90, 158, 158, 158), - borderRadius: BorderRadius.circular(7.5.w), - ), - child: DropdownButtonHideUnderline( - child: DropdownButton( - value: selectedValue.value, - onChanged: (String? newValue) { - if (newValue != null) { - onChanged(newValue); - } - }, - items: items.map((DropdownOption option) { - return DropdownMenuItem( - value: option.value, - child: Text(option.label), - ); - }).toList(), - icon: const Icon(Icons.arrow_drop_down, size: 15), - style: TextStyle(fontSize: 10.sp, color: Colors.black), - dropdownColor: Colors.white, - underline: const SizedBox.shrink(), - ), - ), - ), - ); - } -} diff --git a/lib/modules/problem/views/widgets/history_filter_bar.dart b/lib/modules/problem/views/widgets/history_filter_bar.dart new file mode 100644 index 0000000..762f6eb --- /dev/null +++ b/lib/modules/problem/views/widgets/history_filter_bar.dart @@ -0,0 +1,97 @@ +// widgets/compact_filter_bar.dart +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:problem_check_system/modules/problem/controllers/problem_controller.dart'; + +import 'custom_filter_dropdown.dart'; + +class HistoryFilterBar extends GetView { + final EdgeInsetsGeometry? padding; + + const HistoryFilterBar({super.key, this.padding}); + + @override + Widget build(BuildContext context) { + return Container( + padding: padding ?? EdgeInsets.symmetric(horizontal: 16.w, vertical: 5.h), + color: Colors.grey[50], + child: Row( + children: [ + // 显示日期选择 + ...[ + SizedBox( + width: 110.w, + // decoration: BoxDecoration( + // border: Border.all(color: Colors.grey.shade300), + // borderRadius: BorderRadius.circular(8.r), + // ), + child: TextButton( + onPressed: () { + controller.selectDateRange(context); + }, + style: TextButton.styleFrom( + padding: EdgeInsets.symmetric( + horizontal: 12.w, + vertical: 4.h, + ), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8.r), + ), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.date_range, + size: 16.sp, + color: Colors.grey[700], + ), + SizedBox(width: 4.w), + + Text( + '选择日期', + style: TextStyle( + fontSize: 14.sp, + color: Colors.black87, + fontWeight: FontWeight.normal, + ), + ), + ], + ), + ), + ), + ], + + // 上传状态筛选 + ...[ + Obx( + () => CustomFilterDropdown( + title: '上传状态', + options: controller.uploadOptions, + selectedValue: controller.historyUploadFilter.value, + onChanged: controller.updateHistoryUpload, + width: 100.w, + showBorder: false, + ), + ), + ], + + // 绑定状态筛选 + ...[ + Obx( + () => CustomFilterDropdown( + title: '绑定状态', + options: controller.bindOptions, + selectedValue: controller.historyBindFilter.value, + onChanged: controller.updateHistoryBind, + width: 100.w, + showBorder: false, + ), + ), + ], + ], + ), + ); + } +} diff --git a/lib/modules/problem/views/widgets/problem_card.dart b/lib/modules/problem/views/widgets/problem_card.dart index 947e127..d8d24b5 100644 --- a/lib/modules/problem/views/widgets/problem_card.dart +++ b/lib/modules/problem/views/widgets/problem_card.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:intl/intl.dart'; +import 'package:problem_check_system/app/routes/app_routes.dart'; import 'package:problem_check_system/data/models/sync_status.dart'; import 'package:problem_check_system/data/models/problem_model.dart'; import 'package:problem_check_system/modules/problem/views/widgets/custom_button.dart'; @@ -122,14 +123,18 @@ class ProblemCard extends StatelessWidget { CustomButton( text: '修改', onTap: () { - Get.to(ProblemFormPage(problem: problem)); + Get.toNamed(AppRoutes.problemForm, arguments: problem); }, ), SizedBox(width: 8.w), CustomButton( text: '查看', onTap: () { - Get.to(ProblemFormPage(problem: problem, isReadOnly: true)); + Get.toNamed( + AppRoutes.problemForm, + arguments: problem, + parameters: {'isReadOnly': 'true'}, + ); }, ), SizedBox(width: 16.w),