Merge branch 'dev_feature' into dev
ui调整 # Conflicts: # ln_jq_app/lib/pages/b_page/reservation/controller.dart # ln_jq_app/lib/pages/b_page/site/controller.dart # ln_jq_app/lib/pages/b_page/site/view.dart # ln_jq_app/lib/pages/c_page/mine/view.dart # ln_jq_app/lib/pages/c_page/reservation/controller.dart # ln_jq_app/lib/pages/c_page/reservation/view.dart # ln_jq_app/lib/pages/login/view.dart
This commit is contained in:
@@ -45,6 +45,7 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
||||
customStartTime = DateTime.now();
|
||||
customEndTime = customStartTime!.add(const Duration(days: 1));
|
||||
renderData();
|
||||
_msgNotice(); // 红点消息
|
||||
startAutoRefresh();
|
||||
}
|
||||
|
||||
@@ -94,6 +95,7 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
||||
String jobDetailsStr = "";
|
||||
String jobId = "";
|
||||
Timer? _refreshTimer;
|
||||
bool isNotice = false;
|
||||
|
||||
Future<void> renderData() async {
|
||||
showLoading("加载中");
|
||||
@@ -168,7 +170,7 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
||||
}
|
||||
|
||||
jobDetailsStr =
|
||||
"当前站点已设置$beginTime至$endTime,共${hoursLeft.toStringAsFixed(2)}小时,为$hydStatusStr状态";
|
||||
"当前站点已设置$beginTime至$endTime,共${hoursLeft.toStringAsFixed(2)}小时,为$hydStatusStr状态";
|
||||
|
||||
// 如果是处于非营运状态,自动回填开始和结束时间
|
||||
// 假设 customStartTime 是现在,customEndTime 是接口返回的结束时间
|
||||
@@ -210,7 +212,7 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
||||
|
||||
var customerPriceTemp = result.data["customerPrice"];
|
||||
customerPrice =
|
||||
(customerPriceTemp != null && customerPriceTemp.toString().isNotEmpty)
|
||||
(customerPriceTemp != null && customerPriceTemp.toString().isNotEmpty)
|
||||
? "$customerPriceTemp"
|
||||
: "暂无价格";
|
||||
|
||||
@@ -246,6 +248,26 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _msgNotice() async {
|
||||
final Map<String, dynamic> requestData = {
|
||||
'appFlag': 1,
|
||||
'isRead': 1,
|
||||
'pageNum': 1,
|
||||
'pageSize': 5,
|
||||
};
|
||||
final response = await HttpService.to.get(
|
||||
'appointment/unread_notice/page',
|
||||
params: requestData,
|
||||
);
|
||||
if (response != null) {
|
||||
final result = BaseModel.fromJson(response.data);
|
||||
if (result.code == 0 && result.data != null) {
|
||||
String total = result.data["total"].toString();
|
||||
isNotice = int.parse(total) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void onOperationStatusChanged(String? newValue) {
|
||||
if (newValue != null) {
|
||||
selectedOperationStatus = newValue;
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:getx_scaffold/getx_scaffold.dart';
|
||||
import 'package:ln_jq_app/common/login_util.dart';
|
||||
import 'package:ln_jq_app/pages/b_page/reservation/controller.dart';
|
||||
import 'package:ln_jq_app/pages/c_page/message/view.dart';
|
||||
|
||||
class ReservationPage extends GetView<ReservationController> {
|
||||
const ReservationPage({super.key});
|
||||
|
||||
// 定义主题色
|
||||
static const kPrimaryColor = Color(0xFF006D35); // 效果图深绿色
|
||||
static const kBgColor = Color(0xFFF5F7F9); // 背景灰
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<ReservationController>(
|
||||
@@ -13,21 +19,28 @@ class ReservationPage extends GetView<ReservationController> {
|
||||
id: 'b_reservation',
|
||||
builder: (_) {
|
||||
return Scaffold(
|
||||
backgroundColor: kBgColor,
|
||||
body: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
_buildHeaderCard(),
|
||||
const SizedBox(height: 12),
|
||||
_buildInfoFormCard(context),
|
||||
const SizedBox(height: 12),
|
||||
_buildTipsCard(),
|
||||
const SizedBox(height: 12),
|
||||
_buildLogoutButton(),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
_buildTopSection(context),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20.w),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 16),
|
||||
_buildBasicInfoCard(),
|
||||
SizedBox(height: 16),
|
||||
_buildOperationContentCard(context),
|
||||
SizedBox(height: 16.h),
|
||||
_buildSystemTips(),
|
||||
SizedBox(height: 24),
|
||||
_buildLogoutButton(),
|
||||
SizedBox(height: 40),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -35,158 +48,280 @@ class ReservationPage extends GetView<ReservationController> {
|
||||
);
|
||||
}
|
||||
|
||||
/// 构建顶部的站点信息头卡片
|
||||
Widget _buildHeaderCard() {
|
||||
return Card(
|
||||
elevation: 2,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
/// 1. 顶部个人信息及统计栏
|
||||
Widget _buildTopSection(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.vertical(bottom: Radius.circular(30)),
|
||||
),
|
||||
padding: EdgeInsets.only(
|
||||
top: MediaQuery.of(context).padding.top + 10,
|
||||
left: 20,
|
||||
right: 20,
|
||||
bottom: 25,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.local_gas_station, color: Colors.blue, size: 40),
|
||||
title: Text(
|
||||
controller.name,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 18),
|
||||
),
|
||||
subtitle: Text(controller.address),
|
||||
trailing: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blue[100],
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
Row(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 25,
|
||||
backgroundColor: Colors.white,
|
||||
child: LoginUtil.getAssImg('ic_user_logo@2x'),
|
||||
),
|
||||
child: Text(
|
||||
controller.selectedOperationStatus,
|
||||
style: const TextStyle(
|
||||
color: Colors.blue,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12,
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
controller.name,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
_buildStatusTag(),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
"站点:${controller.address}",
|
||||
style: TextStyle(color: Colors.grey[500], fontSize: 13),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const Divider(height: 1, indent: 16, endIndent: 16),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
_buildHeaderStat(controller.customerPrice, '氢气价格'),
|
||||
_buildHeaderStat(controller.timeStr, '营业时间'),
|
||||
_buildHeaderStat('98%', '设备状态'),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 构建头部卡片中的单个统计项
|
||||
Widget _buildHeaderStat(String value, String label) {
|
||||
return Column(
|
||||
children: [
|
||||
Text(
|
||||
value,
|
||||
style: const TextStyle(
|
||||
color: Colors.blue,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(label, style: const TextStyle(color: Colors.grey, fontSize: 12)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// 构建包含所有信息表单的卡片(增加 Tab 切换功能)
|
||||
Widget _buildInfoFormCard(BuildContext context) {
|
||||
return Card(
|
||||
elevation: 2,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
clipBehavior: Clip.antiAlias, // 确保 Tab 背景圆角生效
|
||||
child: Column(
|
||||
children: [
|
||||
// Tab 切换栏
|
||||
Obx(
|
||||
() => Container(
|
||||
color: Colors.grey[50],
|
||||
child: Row(
|
||||
children: [
|
||||
_buildTabItem(0, Icons.business_outlined, '站点信息'),
|
||||
_buildTabItem(1, Icons.campaign_outlined, '站点广播'),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
// 内容区域
|
||||
Obx(
|
||||
() => controller.selectedTabIndex.value == 0
|
||||
? _buildStationInfo(context)
|
||||
: _buildStationBroadcast(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 构建单个 Tab 项
|
||||
Widget _buildTabItem(int index, IconData icon, String label) {
|
||||
bool isSelected = controller.selectedTabIndex.value == index;
|
||||
return Expanded(
|
||||
child: InkWell(
|
||||
onTap: () => controller.selectedTabIndex.value = index,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: isSelected ? Colors.blue : Colors.transparent,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(icon, size: 20, color: isSelected ? Colors.blue : Colors.grey[600]),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: isSelected ? FontWeight.bold : FontWeight.normal,
|
||||
color: isSelected ? Colors.blue : Colors.grey[600],
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Get.to(() => const MessagePage());
|
||||
},
|
||||
style: IconButton.styleFrom(
|
||||
backgroundColor: Colors.grey[100],
|
||||
padding: const EdgeInsets.all(8),
|
||||
),
|
||||
icon: Badge(
|
||||
smallSize: 8,
|
||||
backgroundColor: controller.isNotice
|
||||
? Colors.red
|
||||
: Colors.transparent,
|
||||
child: const Icon(
|
||||
Icons.notifications_outlined,
|
||||
color: Colors.black87,
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 25),
|
||||
Row(
|
||||
children: [
|
||||
_buildStatBox("氢气价格", "Hydrogen price", controller.customerPrice, "/kg"),
|
||||
SizedBox(width: 4.w),
|
||||
_buildStatBox("营业时间", "Opening time", controller.timeStr, ""),
|
||||
SizedBox(width: 4.w),
|
||||
_buildStatBox("设备状态", "Anlagenzustand", "98", "%"),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatusTag() {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFE1F5FE),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Text(
|
||||
controller.selectedOperationStatus,
|
||||
style: TextStyle(
|
||||
color: Color(0xFF03A9F4),
|
||||
fontSize: 12.sp,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 站点信息子视图
|
||||
Widget _buildStationInfo(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
Widget _buildStatBox(String title, String enTitle, String value, String unit) {
|
||||
return Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 12.w, top: 4.h, bottom: 4.h),
|
||||
decoration: BoxDecoration(
|
||||
color: kBgColor,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 12.sp,
|
||||
color: Color.fromRGBO(51, 51, 51, 0.8),
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
Text(enTitle, style: const TextStyle(fontSize: 9, color: Colors.grey)),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
value,
|
||||
style: TextStyle(
|
||||
fontSize: 12.sp,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Color(0xFF333333),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 2),
|
||||
Text(unit, style: const TextStyle(fontSize: 11, color: Colors.grey)),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 2. 站点基本信息
|
||||
Widget _buildBasicInfoCard() {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"站点基本信息",
|
||||
style: TextStyle(fontSize: 14.sp, fontWeight: FontWeight.bold),
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
_buildInfoRow("站点名称", controller.name),
|
||||
_buildInfoRow("运营企业", controller.operatingEnterprise),
|
||||
_buildInfoRow("站点地址", controller.address),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInfoRow(String label, String value) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(color: Colors.grey, fontSize: 11.sp),
|
||||
),
|
||||
Text(
|
||||
value,
|
||||
style: TextStyle(
|
||||
color: Color(0xFF333333),
|
||||
fontSize: 12.sp,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 3. 运营信息/站点广播 Tab 及内容
|
||||
Widget _buildOperationContentCard(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: hideKeyboard,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
// 自定义 TabBar
|
||||
Obx(
|
||||
() => Padding(
|
||||
padding: const EdgeInsets.only(left: 16, top: 16),
|
||||
child: Row(
|
||||
children: [
|
||||
_buildTabTitle(0, "运营信息"),
|
||||
const SizedBox(width: 30),
|
||||
_buildTabTitle(1, "站点广播"),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
() => controller.selectedTabIndex.value == 0
|
||||
? _buildOperatingForm(context)
|
||||
: _buildBroadcastForm(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTabTitle(int index, String title) {
|
||||
bool isSelected = controller.selectedTabIndex.value == index;
|
||||
return GestureDetector(
|
||||
onTap: () => controller.selectedTabIndex.value = index,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: isSelected ? Colors.black87 : Colors.grey,
|
||||
),
|
||||
),
|
||||
if (isSelected)
|
||||
Container(
|
||||
margin: const EdgeInsets.only(top: 4),
|
||||
width: 25,
|
||||
height: 3,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF00A870), // 效果图中的亮绿色横线
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildOperatingForm(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildSectionTitle('基本信息'),
|
||||
_buildDisplayField(label: '站点名称', value: controller.name),
|
||||
_buildDisplayField(label: '运营企业', value: controller.operatingEnterprise),
|
||||
_buildDisplayField(label: '站点地址', value: controller.address),
|
||||
const SizedBox(height: 16),
|
||||
_buildSectionTitle('价格信息'),
|
||||
_buildDisplayField(label: '官方价格 (元/kg)', value: controller.customerPrice),
|
||||
const SizedBox(height: 16),
|
||||
_buildSectionTitle('运营信息'),
|
||||
Row(
|
||||
children: [
|
||||
Text('运营状态', style: TextStyle(color: Colors.grey[600], fontSize: 14)),
|
||||
Text(
|
||||
'运营状态',
|
||||
style: TextStyle(
|
||||
color: Color.fromRGBO(51, 51, 51, 1),
|
||||
fontSize: 12.sp,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
//加氢站未执行的状态修改任务
|
||||
if (controller.jobTipStr.isNotEmpty)
|
||||
GestureDetector(
|
||||
@@ -204,157 +339,113 @@ class ReservationPage extends GetView<ReservationController> {
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
DropdownButtonFormField<String>(
|
||||
value: controller.selectedOperationStatus,
|
||||
items: controller.operationStatusOptions.map((String value) {
|
||||
return DropdownMenuItem<String>(value: value, child: Text(value));
|
||||
const SizedBox(height: 12),
|
||||
// 状态网格选择
|
||||
Wrap(
|
||||
spacing: 4,
|
||||
runSpacing: 4,
|
||||
children: controller.operationStatusOptions.map((status) {
|
||||
bool isSelected = controller.selectedOperationStatus == status;
|
||||
return GestureDetector(
|
||||
onTap: () => controller.onOperationStatusChanged(status),
|
||||
child: Container(
|
||||
width: (Get.width - 80) / 2,
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? kPrimaryColor : const Color(0xFFEBEBEB),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
status,
|
||||
style: TextStyle(
|
||||
fontSize: 11.sp,
|
||||
color: isSelected ? Colors.white : Color.fromRGBO(51, 51, 51, 1),
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: controller.onOperationStatusChanged,
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(8.0)),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 12.0),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
SizedBox(height: 12.h),
|
||||
if (controller.selectedOperationStatus == "营运中")
|
||||
_buildDisplayField(label: '营业时间', value: controller.timeStr)
|
||||
else
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildClickField(
|
||||
label: '开始时间',
|
||||
value: controller.customStartTimeStr,
|
||||
onTap: () => controller.pickDateTime(context, true),
|
||||
_buildInputLabel("开始时间"),
|
||||
_buildDateTimePicker(
|
||||
controller.customStartTimeStr,
|
||||
() => controller.pickDateTime(context, true),
|
||||
),
|
||||
_buildClickField(
|
||||
label: '结束时间',
|
||||
value: controller.customEndTimeStr,
|
||||
onTap: () => controller.pickDateTime(context, false),
|
||||
const SizedBox(height: 15),
|
||||
_buildInputLabel("结束时间"),
|
||||
_buildDateTimePicker(
|
||||
controller.customEndTimeStr,
|
||||
() => controller.pickDateTime(context, false),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
],
|
||||
),
|
||||
_buildDisplayField(label: '联系电话', value: controller.phone),
|
||||
const SizedBox(height: 24),
|
||||
ElevatedButton(
|
||||
onPressed: controller.saveInfo,
|
||||
style: ElevatedButton.styleFrom(
|
||||
minimumSize: const Size(double.infinity, 48),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
),
|
||||
child: const Text('保存信息', style: TextStyle(fontSize: 16)),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 站点广播子视图
|
||||
Widget _buildStationBroadcast(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 25),
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.campaign, color: Colors.blue, size: 28),
|
||||
const SizedBox(width: 10),
|
||||
const Text(
|
||||
'站点广播通知',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black87,
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: OutlinedButton(
|
||||
onPressed: () {
|
||||
controller.renderData();
|
||||
}, // 重置逻辑
|
||||
style: OutlinedButton.styleFrom(
|
||||
side: const BorderSide(color: kPrimaryColor),
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
child: const Text("重置", style: TextStyle(color: kPrimaryColor)),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: ElevatedButton(
|
||||
onPressed: controller.saveInfo,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: kPrimaryColor,
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
child: const Text("保存设置", style: TextStyle(color: Colors.white)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 13),
|
||||
_buildTextFieldLabel('通知标题'),
|
||||
const SizedBox(height: 8),
|
||||
SizedBox(
|
||||
height: 45.h,
|
||||
child: TextField(
|
||||
controller: controller.broadcastTitleController,
|
||||
maxLength: 30,
|
||||
decoration: InputDecoration(
|
||||
hintText: '例如:临时闭站通知',
|
||||
hintStyle: TextStyle(color: Colors.grey[400], fontSize: 14),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
||||
counterText: '', // 隐藏原生计数器,我们可以按需自定义
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
_buildTextFieldLabel('通知内容'),
|
||||
const SizedBox(height: 8),
|
||||
TextField(
|
||||
controller: controller.broadcastContentController,
|
||||
maxLength: 150,
|
||||
maxLines: 5,
|
||||
decoration: InputDecoration(
|
||||
hintText: '请输入通知内容...',
|
||||
hintStyle: TextStyle(color: Colors.grey[400], fontSize: 14),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
ElevatedButton(
|
||||
onPressed: controller.sendBroadcast,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.blue,
|
||||
foregroundColor: Colors.white,
|
||||
minimumSize: const Size(double.infinity, 50),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
elevation: 0,
|
||||
),
|
||||
child: const Text(
|
||||
'发送',
|
||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTextFieldLabel(String label) {
|
||||
return Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.black87,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 构建带标题的表单区域
|
||||
Widget _buildSectionTitle(String title) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(width: 4, height: 16, color: Colors.blue),
|
||||
const SizedBox(width: 8),
|
||||
Text(title, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 构建一个“标签+纯文本”的显示行
|
||||
Widget _buildDisplayField({required String label, required String value}) {
|
||||
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)),
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
color: Color.fromRGBO(51, 51, 51, 1),
|
||||
fontSize: 12.sp,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
@@ -374,118 +465,177 @@ class ReservationPage extends GetView<ReservationController> {
|
||||
);
|
||||
}
|
||||
|
||||
/// 构建一个“可点击”的选择行
|
||||
Widget _buildClickField({
|
||||
required String label,
|
||||
required String value,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
Widget _buildBroadcastForm() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12.0),
|
||||
padding: const EdgeInsets.all(16),
|
||||
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),
|
||||
],
|
||||
),
|
||||
),
|
||||
_buildInputLabel("通知标题"),
|
||||
TextField(
|
||||
controller: controller.broadcastTitleController,
|
||||
decoration: _inputDecoration("例如:临时闭站通知"),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
_buildInputLabel("通知内容"),
|
||||
TextField(
|
||||
controller: controller.broadcastContentController,
|
||||
maxLines: 4,
|
||||
decoration: _inputDecoration("请输入通知内容..."),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: OutlinedButton(
|
||||
onPressed: () {
|
||||
controller.broadcastTitleController.clear();
|
||||
controller.broadcastContentController.clear();
|
||||
}, // 重置逻辑
|
||||
style: OutlinedButton.styleFrom(
|
||||
side: const BorderSide(color: kPrimaryColor),
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
child: const Text("重置", style: TextStyle(color: kPrimaryColor)),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: ElevatedButton(
|
||||
onPressed: controller.sendBroadcast,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: kPrimaryColor,
|
||||
minimumSize: const Size(double.infinity, 50),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
),
|
||||
child: const Text("发送广播", style: TextStyle(color: Colors.white)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 构建静态提示信息卡片
|
||||
Widget _buildTipsCard() {
|
||||
return Card(
|
||||
elevation: 2,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
Widget _buildInputLabel(String label) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 0, bottom: 8),
|
||||
child: Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
color: Color.fromRGBO(51, 51, 51, 1),
|
||||
fontSize: 12.sp,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDateTimePicker(String value, VoidCallback onTap) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: const Color(0xFF00A870).withOpacity(0.5)),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
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: [
|
||||
const 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("");
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(value, style: const TextStyle(color: Colors.black87)),
|
||||
const Icon(Icons.calendar_today_outlined, size: 18, color: Color(0xFF00A870)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 构建退出登录按钮
|
||||
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,
|
||||
InputDecoration _inputDecoration(String hint) {
|
||||
return InputDecoration(
|
||||
hintText: hint,
|
||||
hintStyle: const TextStyle(color: Colors.grey, fontSize: 14),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(color: Color(0xFFE0E0E0)),
|
||||
),
|
||||
child: const Text(
|
||||
'退出登录',
|
||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: const BorderSide(color: Color(0xFFE0E0E0)),
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 15, vertical: 12),
|
||||
);
|
||||
}
|
||||
|
||||
/// 4. 系统提醒
|
||||
Widget _buildSystemTips() {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(15),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF1F9F6), // 极浅绿色背景
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(Icons.info_outline, color: Color.fromRGBO(1, 113, 55, 1), size: 20),
|
||||
SizedBox(width: 8.w),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"系统提醒",
|
||||
style: TextStyle(
|
||||
color: Color.fromRGBO(1, 113, 55, 1),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14.sp,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 6.h),
|
||||
Text(
|
||||
"请您确保所提供的信息准确无误,价格信息也将实时\n更新至用户端",
|
||||
style: TextStyle(color: Color.fromRGBO(1, 113, 55, 0.8), fontSize: 12.sp),
|
||||
),
|
||||
SizedBox(height: 6.h),
|
||||
Text(
|
||||
"如有疑问请联系客服:400-021-1773",
|
||||
style: TextStyle(color: Color.fromRGBO(1, 113, 55, 0.8), fontSize: 12.sp),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 构建带图标的提示信息行
|
||||
Widget _buildInfoItem(IconData icon, String text) {
|
||||
return Row(
|
||||
children: [
|
||||
Icon(icon, color: Colors.blue, size: 20),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Text(text, style: const TextStyle(fontSize: 14, color: Colors.black54)),
|
||||
/// 5. 退出登录按钮
|
||||
Widget _buildLogoutButton() {
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
height: 50,
|
||||
child: ElevatedButton(
|
||||
onPressed: controller.logout,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Color.fromRGBO(204, 52, 46, 1),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(25)),
|
||||
elevation: 0,
|
||||
),
|
||||
],
|
||||
child: const Text(
|
||||
"退出登录",
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user