路径规划作业列表 其余界面优化
This commit is contained in:
@@ -165,97 +165,105 @@ class _WorkParamsCardState extends State<WorkParamsCard> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 顶部拖拽指示器
|
||||
Center(
|
||||
child: Container(
|
||||
width: 40,
|
||||
height: 4,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[300],
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
// 顶部区域:拖拽指示器 + 标题 + 关闭按钮
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
// 顶部拖拽指示器(居中改左对齐,和关闭按钮形成布局)
|
||||
Center(child: Container(width: 40, height: 4)),
|
||||
const Text(
|
||||
'历史记录详情',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
),
|
||||
// 右上角关闭按钮(X号)
|
||||
IconButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
icon: const Icon(Icons.close, color: Colors.grey, size: 24),
|
||||
padding: EdgeInsets.zero,
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
// 标题
|
||||
const Text(
|
||||
'历史记录详情',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
// 内容区域
|
||||
const SizedBox(height: 10),
|
||||
// 内容区域(增加无数据判断)
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: data.map((item) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blue.withOpacity(0.05), // 浅蓝背景
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: Colors.blue.withOpacity(0.2),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: data.isEmpty
|
||||
? // 无数据时显示占位
|
||||
const Center(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
_buildDetailRow(
|
||||
Icons.calendar_today,
|
||||
'开始时间',
|
||||
item.startTime,
|
||||
Icon(
|
||||
Icons.description_outlined,
|
||||
size: 60,
|
||||
color: Colors.grey,
|
||||
),
|
||||
_buildDetailRow(
|
||||
Icons.calendar_today_outlined,
|
||||
'结束时间',
|
||||
item.endTime,
|
||||
),
|
||||
_buildDetailRow(
|
||||
Icons.square_foot,
|
||||
'工作面积',
|
||||
'${item.workArea} 亩',
|
||||
),
|
||||
_buildDetailRow(
|
||||
Icons.directions_car,
|
||||
'工作距离',
|
||||
'${item.distance?.toStringAsFixed(2) ?? '未计算'} km',
|
||||
),
|
||||
_buildDetailRow(
|
||||
Icons.timer,
|
||||
'花费时间',
|
||||
'${item.time} 小时',
|
||||
SizedBox(height: 16),
|
||||
Text(
|
||||
'暂无历史记录',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
// 关闭按钮
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: ElevatedButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.blue,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
child: const Text(
|
||||
'关闭',
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
)
|
||||
: // 有数据时显示列表
|
||||
SingleChildScrollView(
|
||||
child: Column(
|
||||
children: data.map((item) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blue.withOpacity(0.05), // 浅蓝背景
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: Colors.blue.withOpacity(0.2),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildDetailRow(
|
||||
Icons.calendar_today,
|
||||
'开始时间',
|
||||
item.startTime,
|
||||
),
|
||||
_buildDetailRow(
|
||||
Icons.calendar_today_outlined,
|
||||
'结束时间',
|
||||
item.endTime,
|
||||
),
|
||||
_buildDetailRow(
|
||||
Icons.square_foot,
|
||||
'工作面积',
|
||||
'${item.workArea} 亩',
|
||||
),
|
||||
_buildDetailRow(
|
||||
Icons.directions_car,
|
||||
'工作距离',
|
||||
'${item.distance?.toStringAsFixed(2) ?? '未计算'} km',
|
||||
),
|
||||
_buildDetailRow(
|
||||
Icons.timer,
|
||||
'花费时间',
|
||||
'${item.time} 小时',
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
// 移除原有底部关闭按钮
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user