非营业状态 增加时间选择

This commit is contained in:
2026-01-12 16:41:36 +08:00
parent 285a20f070
commit 20ef495571
3 changed files with 268 additions and 110 deletions

View File

@@ -127,14 +127,12 @@ class ReservationPage extends GetView<ReservationController> {
_buildSectionTitle('运营信息'),
Text('运营状态', style: TextStyle(color: Colors.grey[600], fontSize: 14)),
const SizedBox(height: 8),
//下拉选择框
// 下拉选择框
DropdownButtonFormField<String>(
value: controller.selectedOperationStatus,
items: controller.operationStatusOptions.map((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
return DropdownMenuItem<String>(value: value, child: Text(value));
}).toList(),
onChanged: controller.onOperationStatusChanged,
decoration: InputDecoration(
@@ -142,8 +140,27 @@ class ReservationPage extends GetView<ReservationController> {
contentPadding: const EdgeInsets.symmetric(horizontal: 12.0),
),
),
const SizedBox(height: 12),
_buildDisplayField(label: '营业时间', value: controller.timeStr),
const SizedBox(height: 16),
// 根据状态动态显示 UI
if (controller.selectedOperationStatus == "营运中")
_buildDisplayField(label: '营业时间', value: controller.timeStr)
else
Column(
children: [
_buildClickField(
label: '开始时间',
value: controller.customStartTimeStr,
onTap: () => controller.pickDateTime(context, true),
),
_buildClickField(
label: '结束时间',
value: controller.customEndTimeStr,
onTap: () => controller.pickDateTime(context, false),
),
],
),
_buildDisplayField(label: '联系电话', value: controller.phone),
const SizedBox(height: 24),
@@ -162,70 +179,6 @@ class ReservationPage extends GetView<ReservationController> {
);
}
/// 构建静态提示信息卡片
Widget _buildTipsCard() {
return Card(
elevation: 2,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
_buildInfoItem(Icons.info_outline, '请确保信息准确无误'),
const SizedBox(height: 10),
_buildInfoItem(Icons.help_outline, '价格信息将实时更新到用户端'),
const SizedBox(height: 10),
_buildInfoItem(Icons.headset_mic_outlined, '如有疑问请联系技术支持: 400-021-1773'),
const SizedBox(height: 10),
Row(
children: [
Icon(Icons.verified_outlined, color: Colors.blue, size: 20),
const SizedBox(width: 10),
Expanded(
child: FutureBuilder<String>(
future: getVersion(),
builder: (context, snapshot) {
// 判断是否还在加载
if (snapshot.connectionState == ConnectionState.waiting) {
return const Text("");
}
// 如果加载完成且有数据
if (snapshot.hasData) {
return TextX.labelSmall("当前版本: ${snapshot.data}",color: Colors.black54,);
}
// 错误处理
return const Text("");
},
),
),
],
)
],
),
),
);
}
/// 构建退出登录按钮
Widget _buildLogoutButton() {
return ElevatedButton(
onPressed: controller.logout,
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red,
foregroundColor: Colors.white,
minimumSize: const Size(double.infinity, 48),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
elevation: 2,
),
child: const Text(
'退出登录',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
);
}
/// 构建带标题的表单区域
Widget _buildSectionTitle(String title) {
return Padding(
@@ -253,7 +206,7 @@ class ReservationPage extends GetView<ReservationController> {
width: double.infinity,
padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 12.0),
decoration: BoxDecoration(
color: Colors.grey[200], // 使用灰色背景以区分
color: Colors.grey[200],
borderRadius: BorderRadius.circular(8.0),
border: Border.all(color: Colors.grey[300]!),
),
@@ -267,6 +220,104 @@ class ReservationPage extends GetView<ReservationController> {
);
}
/// 构建一个“可点击”的选择行
Widget _buildClickField({required String label, required String value, required VoidCallback onTap}) {
return Padding(
padding: const EdgeInsets.only(bottom: 12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(label, style: TextStyle(color: Colors.grey[600], fontSize: 14)),
const SizedBox(height: 8),
InkWell(
onTap: onTap,
child: Container(
width: double.infinity,
padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 12.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8.0),
border: Border.all(color: Colors.blue.withOpacity(0.5)),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
value,
style: const TextStyle(fontSize: 14, color: Colors.black87),
),
const Icon(Icons.calendar_month, size: 18, color: Colors.blue),
],
),
),
),
],
),
);
}
/// 构建静态提示信息卡片
Widget _buildTipsCard() {
return Card(
elevation: 2,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
_buildInfoItem(Icons.info_outline, '请确保信息准确无误'),
const SizedBox(height: 10),
_buildInfoItem(Icons.help_outline, '价格信息将实时更新到用户端'),
const SizedBox(height: 10),
_buildInfoItem(Icons.headset_mic_outlined, '如有疑问请联系技术支持: 400-021-1773'),
const SizedBox(height: 10),
Row(
children: [
Icon(Icons.verified_outlined, color: Colors.blue, size: 20),
const SizedBox(width: 10),
Expanded(
child: FutureBuilder<String>(
future: getVersion(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Text("");
}
if (snapshot.hasData) {
return TextX.labelSmall(
"当前版本: ${snapshot.data}",
color: Colors.black54,
);
}
return const Text("");
},
),
),
],
),
],
),
),
);
}
/// 构建退出登录按钮
Widget _buildLogoutButton() {
return ElevatedButton(
onPressed: controller.logout,
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red,
foregroundColor: Colors.white,
minimumSize: const Size(double.infinity, 48),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
elevation: 2,
),
child: const Text(
'退出登录',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
);
}
/// 构建带图标的提示信息行
Widget _buildInfoItem(IconData icon, String text) {
return Row(