增加 加氢站可用标记
This commit is contained in:
@@ -4,6 +4,7 @@ class StationModel {
|
|||||||
final String address;
|
final String address;
|
||||||
final String price;
|
final String price;
|
||||||
final String siteStatusName; // 例如 "维修中"
|
final String siteStatusName; // 例如 "维修中"
|
||||||
|
final int isSelect; // 新增字段 1是可用 0是不可用
|
||||||
|
|
||||||
StationModel({
|
StationModel({
|
||||||
required this.hydrogenId,
|
required this.hydrogenId,
|
||||||
@@ -11,6 +12,7 @@ class StationModel {
|
|||||||
required this.address,
|
required this.address,
|
||||||
required this.price,
|
required this.price,
|
||||||
required this.siteStatusName,
|
required this.siteStatusName,
|
||||||
|
required this.isSelect,
|
||||||
});
|
});
|
||||||
|
|
||||||
// 从 JSON map 创建对象的工厂构造函数
|
// 从 JSON map 创建对象的工厂构造函数
|
||||||
@@ -21,6 +23,7 @@ class StationModel {
|
|||||||
address: json['address'] ?? '地址未知',
|
address: json['address'] ?? '地址未知',
|
||||||
price: json['price']?.toString() ?? '0.00',
|
price: json['price']?.toString() ?? '0.00',
|
||||||
siteStatusName: json['siteStatusName'] ?? '',
|
siteStatusName: json['siteStatusName'] ?? '',
|
||||||
|
isSelect: json['isSelect'] as int? ?? 0, // 新增字段的解析,默认为 0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -533,7 +533,7 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
), // Blue border
|
), // Blue border
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
reservation.stateName,
|
reservation.stateName+"-"+reservation.addStatusName,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Color(0xFF1890FF),
|
color: Color(0xFF1890FF),
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
@@ -552,11 +552,11 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
reservation.addStatusName,
|
"修改",
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Color(0xFFFA8C16),
|
color: Color(0xFFFA8C16),
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 12,
|
fontSize: 14,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -432,6 +432,7 @@ class ReservationPage extends GetView<C_ReservationController> {
|
|||||||
.map(
|
.map(
|
||||||
(station) => DropdownMenuItem<String>(
|
(station) => DropdownMenuItem<String>(
|
||||||
value: station.hydrogenId, // value 是站点的唯一ID
|
value: station.hydrogenId, // value 是站点的唯一ID
|
||||||
|
enabled: station.isSelect == 1,
|
||||||
child: _buildDropdownItem(station), // child 是自定义的 Widget
|
child: _buildDropdownItem(station), // child 是自定义的 Widget
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@@ -478,7 +479,10 @@ class ReservationPage extends GetView<C_ReservationController> {
|
|||||||
|
|
||||||
/// 构建下拉菜单中的每一项
|
/// 构建下拉菜单中的每一项
|
||||||
Widget _buildDropdownItem(StationModel station) {
|
Widget _buildDropdownItem(StationModel station) {
|
||||||
bool isMaintenance = (station.siteStatusName != '营运中');
|
bool isSelectable = (station.isSelect == 1);
|
||||||
|
//营运并且可用
|
||||||
|
bool isMaintenance = ((station.siteStatusName != '营运中') && isSelectable);
|
||||||
|
final textColor = isSelectable ? Colors.black : Colors.grey;
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -495,14 +499,22 @@ class ReservationPage extends GetView<C_ReservationController> {
|
|||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(
|
||||||
station.name,
|
station.name,
|
||||||
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
|
style: TextStyle(
|
||||||
|
color: textColor,
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
' | ¥${station.price}/kg',
|
' | ¥${station.price}/kg',
|
||||||
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
|
style: TextStyle(
|
||||||
|
color: textColor,
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
if (isMaintenance) const SizedBox(width: 8),
|
if (isMaintenance) const SizedBox(width: 8),
|
||||||
if (isMaintenance)
|
if (isMaintenance)
|
||||||
|
|||||||
Reference in New Issue
Block a user