203 lines
5.6 KiB
Dart
203 lines
5.6 KiB
Dart
|
import 'package:flutter/material.dart';
|
||
|
import 'package:intl/intl.dart';
|
||
|
import 'package:qhd_prevention/pages/my_appbar.dart';
|
||
|
|
||
|
|
||
|
|
||
|
class MineDutyDetailPage extends StatefulWidget {
|
||
|
const MineDutyDetailPage({super.key});
|
||
|
|
||
|
@override
|
||
|
State<MineDutyDetailPage> createState() => _MineDutyDetailPage();
|
||
|
}
|
||
|
|
||
|
class _MineDutyDetailPage extends State<MineDutyDetailPage> {
|
||
|
DateTime? _startDate;
|
||
|
DateTime? _endDate;
|
||
|
final TextEditingController _reasonController = TextEditingController();
|
||
|
final String _applicant = "王轩";
|
||
|
|
||
|
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Scaffold(
|
||
|
backgroundColor: const Color(0xFFF5F7FA),
|
||
|
appBar:MyAppbar(title: "离岗详情"),
|
||
|
body: SingleChildScrollView(
|
||
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 20),
|
||
|
child: Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
|
||
|
|
||
|
// 申请人信息
|
||
|
_buildInfoRow("申请人", _applicant),
|
||
|
const SizedBox(height: 24),
|
||
|
|
||
|
// 离岗开始时间
|
||
|
_buildDateField(
|
||
|
label: "离岗开始时间",
|
||
|
date: _startDate,
|
||
|
onTap: () {
|
||
|
|
||
|
}
|
||
|
// () => _selectDate(context, true),
|
||
|
),
|
||
|
|
||
|
const SizedBox(height: 16),
|
||
|
|
||
|
// 离岗结束时间
|
||
|
_buildDateField(
|
||
|
label: "离岗结束时间",
|
||
|
date: _endDate,
|
||
|
onTap: () {
|
||
|
|
||
|
},
|
||
|
// () => _selectDate(context, false),
|
||
|
),
|
||
|
|
||
|
const SizedBox(height: 24),
|
||
|
|
||
|
// 离岗原因标题
|
||
|
const Text(
|
||
|
"离岗原因",
|
||
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
|
||
|
),
|
||
|
const SizedBox(height: 8),
|
||
|
|
||
|
// 原因输入框
|
||
|
Container(
|
||
|
width: double.infinity,
|
||
|
padding: const EdgeInsets.all(16),
|
||
|
decoration: BoxDecoration(
|
||
|
color: Colors.white,
|
||
|
borderRadius: BorderRadius.circular(12),
|
||
|
boxShadow: [
|
||
|
BoxShadow(
|
||
|
color: Colors.grey.withOpacity(0.1),
|
||
|
spreadRadius: 1,
|
||
|
blurRadius: 6,
|
||
|
offset: const Offset(0, 2),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
child: Text(
|
||
|
"原因",style: TextStyle(color: Colors.black),
|
||
|
// controller: _reasonController,
|
||
|
// maxLines: 5,
|
||
|
// decoration: const InputDecoration(
|
||
|
// hintText: "请输入离岗原因",
|
||
|
// hintStyle: TextStyle(color: Color(0xFF9E9E9E)),
|
||
|
// border: InputBorder.none,
|
||
|
// ),
|
||
|
),
|
||
|
),
|
||
|
|
||
|
|
||
|
const SizedBox(height: 24),
|
||
|
// 申请人信息
|
||
|
_buildInfoRow("审批状态", "无需审批"),
|
||
|
|
||
|
|
||
|
const SizedBox(height: 40),
|
||
|
|
||
|
// 提交按钮
|
||
|
SizedBox(
|
||
|
width: double.infinity,
|
||
|
child: TextButton(
|
||
|
onPressed: () {
|
||
|
Navigator.pop(context);
|
||
|
},
|
||
|
style: ElevatedButton.styleFrom(
|
||
|
backgroundColor: const Color(0xFF1976D2),
|
||
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
||
|
shape: RoundedRectangleBorder(
|
||
|
borderRadius: BorderRadius.circular(12),
|
||
|
),
|
||
|
),
|
||
|
child: Text(
|
||
|
"返回",
|
||
|
style: TextStyle(fontSize: 16, color: Colors.white),
|
||
|
),
|
||
|
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
|
||
|
Widget _buildDateField({
|
||
|
required String label,
|
||
|
required DateTime? date,
|
||
|
required VoidCallback onTap,
|
||
|
}) {
|
||
|
return GestureDetector(
|
||
|
onTap: onTap,
|
||
|
child: Container(
|
||
|
padding: const EdgeInsets.all(16),
|
||
|
decoration: BoxDecoration(
|
||
|
color: Colors.white,
|
||
|
borderRadius: BorderRadius.circular(12),
|
||
|
boxShadow: [
|
||
|
BoxShadow(
|
||
|
color: Colors.grey.withOpacity(0.1),
|
||
|
spreadRadius: 1,
|
||
|
blurRadius: 6,
|
||
|
offset: const Offset(0, 2),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
child: Row(
|
||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
|
children: [
|
||
|
Text(
|
||
|
label,
|
||
|
style: const TextStyle(fontSize: 16),
|
||
|
),
|
||
|
Text(
|
||
|
date != null ? DateFormat('yyyy-MM-dd').format(date) : "请选择日期",
|
||
|
style: TextStyle(
|
||
|
fontSize: 16,
|
||
|
color: date != null ? Colors.black : const Color(0xFF9E9E9E),
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
|
||
|
Widget _buildInfoRow(String title, String value) {
|
||
|
return Container(
|
||
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||
|
decoration: BoxDecoration(
|
||
|
color: Colors.white,
|
||
|
borderRadius: BorderRadius.circular(12),
|
||
|
boxShadow: [
|
||
|
BoxShadow(
|
||
|
color: Colors.grey.withOpacity(0.1),
|
||
|
spreadRadius: 1,
|
||
|
blurRadius: 6,
|
||
|
offset: const Offset(0, 2),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
child: Row(
|
||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
|
children: [
|
||
|
Text(
|
||
|
title,
|
||
|
style: const TextStyle(fontSize: 16),
|
||
|
),
|
||
|
Text(
|
||
|
value,
|
||
|
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|