|
|
|
|
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
|
import 'package:get/get.dart'; |
|
|
|
|
import 'package:image_picker/image_picker.dart'; |
|
|
|
|
import 'package:problem_check_system/app/core/models/form_mode.dart'; |
|
|
|
|
import 'package:problem_check_system/app/core/pages/widgets/custom_app_bar.dart'; |
|
|
|
|
import 'package:problem_check_system/app/features/enterprise/domain/entities/enterprise.dart'; |
|
|
|
|
import 'package:problem_check_system/app/features/problem/presentation/controllers/problem_form_controller.dart'; |
|
|
|
|
@ -455,32 +456,43 @@ class ProblemFormPage extends GetView<ProblemFormController> {
|
|
|
|
|
_buildTopSection(), |
|
|
|
|
|
|
|
|
|
// 在顶部和底部之间增加一些垂直间距 |
|
|
|
|
const SizedBox(height: 20.0), |
|
|
|
|
|
|
|
|
|
// --- 2. 底部区域:下拉选择器显示 --- |
|
|
|
|
Padding( |
|
|
|
|
padding: EdgeInsetsGeometry.only(left: 16.w, right: 16.w), |
|
|
|
|
child: DropdownButtonHideUnderline( |
|
|
|
|
child: DropdownButton<Enterprise>( |
|
|
|
|
// 提示文本 |
|
|
|
|
hint: const Text('请选择一个企业'), |
|
|
|
|
isExpanded: true, |
|
|
|
|
// 当前选中的值,直接从控制器获取 |
|
|
|
|
value: controller.selectedEnterprise.value, |
|
|
|
|
// 列表项,通过map从控制器列表动态生成 |
|
|
|
|
items: controller.enterpriseList.map((enterprise) { |
|
|
|
|
return DropdownMenuItem<Enterprise>( |
|
|
|
|
value: enterprise, // 每个选项的值是EnterpriseEntity对象本身 |
|
|
|
|
child: Text(enterprise.name), // 显示的文本是企业名称 |
|
|
|
|
); |
|
|
|
|
}).toList(), |
|
|
|
|
// 当用户选择一个新项目时,调用控制器的方法来更新状态 |
|
|
|
|
onChanged: (newValue) { |
|
|
|
|
controller.selectEnterprise(newValue); |
|
|
|
|
}, |
|
|
|
|
// SizedBox(height: 10.5.h), |
|
|
|
|
if (controller.isReadOnly) |
|
|
|
|
Padding( |
|
|
|
|
padding: EdgeInsetsGeometry.only( |
|
|
|
|
top: 10.5.w, |
|
|
|
|
bottom: 16.w, |
|
|
|
|
left: 16.w, |
|
|
|
|
right: 16.w, |
|
|
|
|
), |
|
|
|
|
child: Text(controller.enterprise.name), |
|
|
|
|
) |
|
|
|
|
else |
|
|
|
|
Padding( |
|
|
|
|
padding: EdgeInsetsGeometry.only(left: 16.w, right: 16.w), |
|
|
|
|
child: DropdownButtonHideUnderline( |
|
|
|
|
child: DropdownButton<Enterprise>( |
|
|
|
|
// 提示文本 |
|
|
|
|
hint: const Text('请选择一个企业'), |
|
|
|
|
isExpanded: true, |
|
|
|
|
// 当前选中的值,直接从控制器获取 |
|
|
|
|
value: controller.formMode == FormMode.edit |
|
|
|
|
? controller.enterprise |
|
|
|
|
: controller.selectedEnterprise.value, |
|
|
|
|
// 列表项,通过map从控制器列表动态生成 |
|
|
|
|
items: controller.enterpriseList.map((enterprise) { |
|
|
|
|
return DropdownMenuItem<Enterprise>( |
|
|
|
|
value: enterprise, // 每个选项的值是EnterpriseEntity对象本身 |
|
|
|
|
child: Text(enterprise.name), // 显示的文本是企业名称 |
|
|
|
|
); |
|
|
|
|
}).toList(), |
|
|
|
|
// 当用户选择一个新项目时,调用控制器的方法来更新状态 |
|
|
|
|
onChanged: (newValue) { |
|
|
|
|
controller.selectEnterprise(newValue); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
@ -497,10 +509,10 @@ class ProblemFormPage extends GetView<ProblemFormController> {
|
|
|
|
|
// 左侧的标题 |
|
|
|
|
Padding( |
|
|
|
|
padding: EdgeInsetsGeometry.only(left: 16.w, top: 10.5.h), |
|
|
|
|
child: const Text( |
|
|
|
|
child: Text( |
|
|
|
|
'企业名称', |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 18, |
|
|
|
|
fontSize: 15.sp, |
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
color: Colors.black87, |
|
|
|
|
), |
|
|
|
|
|