|
|
|
|
@ -24,7 +24,7 @@ class ProblemFormPage extends GetView<ProblemFormController> {
|
|
|
|
|
child: SingleChildScrollView( |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
if (controller.problem?.bindData != null) |
|
|
|
|
if (controller.isShowBindData) |
|
|
|
|
Container( |
|
|
|
|
color: Colors.white, |
|
|
|
|
padding: const EdgeInsets.symmetric( |
|
|
|
|
@ -65,6 +65,7 @@ class ProblemFormPage extends GetView<ProblemFormController> {
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
_buildDropDownCard(title: '企业名称'), |
|
|
|
|
_buildInputCard( |
|
|
|
|
title: '问题描述', |
|
|
|
|
textController: controller.descriptionController, |
|
|
|
|
@ -150,7 +151,7 @@ class ProblemFormPage extends GetView<ProblemFormController> {
|
|
|
|
|
required String hintText, |
|
|
|
|
}) { |
|
|
|
|
return Card( |
|
|
|
|
margin: EdgeInsets.all(17.w), |
|
|
|
|
margin: EdgeInsets.all(16.w), |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
ListTile( |
|
|
|
|
@ -179,7 +180,7 @@ class ProblemFormPage extends GetView<ProblemFormController> {
|
|
|
|
|
/// 构建图片展示卡片 |
|
|
|
|
Widget _buildImageCard(BuildContext context) { |
|
|
|
|
return Card( |
|
|
|
|
margin: EdgeInsets.all(17.w), |
|
|
|
|
margin: EdgeInsets.all(16.w), |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
const ListTile( |
|
|
|
|
@ -414,4 +415,105 @@ class ProblemFormPage extends GetView<ProblemFormController> {
|
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Widget _buildDropDownCard({required String title}) { |
|
|
|
|
return Card( |
|
|
|
|
// margin 让卡片与屏幕边缘有间距 |
|
|
|
|
margin: const EdgeInsets.all(16.0), |
|
|
|
|
// elevation 控制阴影大小 |
|
|
|
|
elevation: 2, |
|
|
|
|
clipBehavior: Clip.antiAlias, |
|
|
|
|
child: Column( |
|
|
|
|
// mainAxisSize.min 让 Column 的高度自适应内容 |
|
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
|
// crossAxisAlignment.start 让子组件默认左对齐 |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
// --- 1. 顶部区域:标签和按钮 --- |
|
|
|
|
_buildTopSection(), |
|
|
|
|
|
|
|
|
|
// 在顶部和底部之间增加一些垂直间距 |
|
|
|
|
const SizedBox(height: 20.0), |
|
|
|
|
|
|
|
|
|
// --- 2. 底部区域:下拉选择器显示 --- |
|
|
|
|
_buildDropdownSelector(), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// 构建顶部区域的私有方法,包含“企业名称”和“新增企业”按钮 |
|
|
|
|
Widget _buildTopSection() { |
|
|
|
|
return Row( |
|
|
|
|
// [核心] 使用 MainAxisAlignment.spaceBetween 将子组件推向两端 |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
|
// crossAxisAlignment.start 确保按钮和文本在垂直方向上顶部对齐 |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
// 左侧的标题 |
|
|
|
|
Padding( |
|
|
|
|
padding: EdgeInsetsGeometry.only(left: 16.w, top: 10.5.h), |
|
|
|
|
child: const Text( |
|
|
|
|
'企业名称', |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 18, |
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
color: Colors.black87, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
// 右侧的按钮 |
|
|
|
|
ElevatedButton( |
|
|
|
|
onPressed: () {}, |
|
|
|
|
style: ElevatedButton.styleFrom( |
|
|
|
|
backgroundColor: const Color(0xFF42A5F5), |
|
|
|
|
foregroundColor: Colors.white, |
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 12.h), |
|
|
|
|
tapTargetSize: MaterialTapTargetSize.shrinkWrap, |
|
|
|
|
// [!!!] 移除按钮自身的阴影,因为它现在在卡片内部 |
|
|
|
|
// elevation: 0, |
|
|
|
|
// [!!!] 自定义形状,只保留左下角圆角,以完美贴合卡片边缘 |
|
|
|
|
shape: RoundedRectangleBorder( |
|
|
|
|
borderRadius: BorderRadius.only( |
|
|
|
|
bottomLeft: Radius.circular(12.r), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
child: Text( |
|
|
|
|
"新增企业", |
|
|
|
|
style: TextStyle(fontSize: 13.sp, fontWeight: FontWeight.bold), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// 构建底部类似下拉菜单的显示区域 |
|
|
|
|
Widget _buildDropdownSelector() { |
|
|
|
|
// 使用 InkWell 包裹,使整个区域都可以响应点击事件 |
|
|
|
|
return InkWell( |
|
|
|
|
onTap: () { |
|
|
|
|
// 在这里处理点击事件,例如弹出一个选择企业的对话框或页面 |
|
|
|
|
print('下拉选择区域被点击'); |
|
|
|
|
}, |
|
|
|
|
// 自定义圆角,使其与外部容器的点击效果一致 |
|
|
|
|
borderRadius: BorderRadius.circular(8.0), |
|
|
|
|
child: Padding( |
|
|
|
|
padding: EdgeInsets.only(left: 16.w, top: 0, right: 16.w, bottom: 16.h), |
|
|
|
|
child: Row( |
|
|
|
|
// 同样使用 spaceBetween 将文本和图标推向两端 |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
|
children: [ |
|
|
|
|
// 左侧的企业名称文本 |
|
|
|
|
const Text( |
|
|
|
|
'山东汇丰石化集团有限公司', |
|
|
|
|
style: TextStyle(fontSize: 16, color: Colors.black54), |
|
|
|
|
), |
|
|
|
|
// 右侧的下拉箭头图标 |
|
|
|
|
Icon(Icons.arrow_drop_down, color: Colors.grey[700]), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|