设备分享

This commit is contained in:
czz
2025-06-30 20:35:02 +08:00
parent ee88290dfe
commit 8a69c90572
18 changed files with 908 additions and 207 deletions

View File

@@ -25,9 +25,9 @@ class DeviceInfoWidget extends GetView {
child: Container(
// width: MediaQuery.sizeOf(context).width,
height: 381.rpx,
constraints: BoxConstraints(
minHeight: 140,
),
// constraints: BoxConstraints(
// minHeight: 140,
// ),
decoration: BoxDecoration(
color: Color(0xFF003058),
borderRadius: BorderRadius.circular(16.rpx),
@@ -37,9 +37,9 @@ class DeviceInfoWidget extends GetView {
child: Container(
// width: MediaQuery.sizeOf(context).width,
height: 381.rpx,
constraints: BoxConstraints(
minHeight: 106,
),
// constraints: BoxConstraints(
// minHeight: 106,
// ),
child: Container(
// width: MediaQuery.sizeOf(context).width,
@@ -96,82 +96,99 @@ class DeviceInfoWidget extends GetView {
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisSize: MainAxisSize.max,
children: [
Expanded(
child: RichText(
text: TextSpan(
children: [
TextSpan(
text: '设备ID' +
(deviceListController.model
.deviceList[
index]['_id'] ??
''),
style: TextStyle(
fontFamily: 'Readex Pro',
color: Color(0xFFC8CBD2),
fontSize: 26.rpx,
letterSpacing: 0,
height: 1),
),
// TextSpan(
// text:
// ' (${deviceListController.model.deviceList[index]['status'] ?? ''})',
// style: TextStyle(
// fontFamily: 'Readex Pro',
// color: deviceListController
// .model
// .deviceList[
// index]
// ['status'] ==
// '在线'
// ? Color(
// 0xFF07C160) // 在线的颜色
// : Color(
// 0xFFEA7CA7), // 离线的颜色
// fontSize: 26.rpx,
// letterSpacing: 0,
// ),
// ),
],
),
maxLines: 1, // 限制显示一行
overflow: TextOverflow
.ellipsis, // 超出部分显示省略号
),
),
],
),
Align(
alignment: AlignmentDirectional(-1, 0),
child: Text(
'房间:' +
(deviceListController
_buildInfoRow(
'设备ID',
deviceListController
.model.deviceList[index]["_id"] ??
'',
valueColor: (deviceListController
.model.deviceList[index]
['roomName'] ??
''),
style: TextStyle(
fontFamily: 'Readex Pro',
color: Color(0xFFC8CBD2),
fontSize: 26.rpx,
letterSpacing: 0,
height: 1),
),
),
Align(
alignment: AlignmentDirectional(-1, 0),
child: Text(
'设备状态:${(deviceListController.model.deviceList[index]["status"]?["status"]) == 1 ? '在线' : '离线'}',
style: TextStyle(
fontFamily: 'Readex Pro',
color: Color(0xFFC8CBD2),
fontSize: 26.rpx,
letterSpacing: 0,
height: 1),
),
)
["status"]?["status"]) ==
1
? Color(0xFF929699)
: null),
_buildInfoRow(
'房间',
deviceListController.model
.deviceList[index]["roomName"] ??
'',
valueColor: (deviceListController
.model.deviceList[index]
["status"]?["status"]) ==
1
? Color(0xFF929699)
: null),
_buildInfoRow(
'设备状态',
(deviceListController
.model.deviceList[index]
["status"]?["status"]) ==
1
? '在线'
: '离线',
valueColor: (deviceListController
.model.deviceList[index]
["status"]?["status"]) ==
1
? Color(0xFF6BFDAC)
: Color(0xFFFF7159)),
// Row(
// mainAxisSize: MainAxisSize.max,
// children: [
// Expanded(
// child: RichText(
// text: TextSpan(
// children: [
// TextSpan(
// text: '设备ID' +
// (deviceListController.model
// .deviceList[
// index]['_id'] ??
// ''),
// style: TextStyle(
// fontFamily: 'Readex Pro',
// color: Color(0xFFC8CBD2),
// fontSize: 26.rpx,
// letterSpacing: 0,
// height: 1),
// ),
// ],
// ),
// maxLines: 1, // 限制显示一行
// overflow: TextOverflow
// .ellipsis, // 超出部分显示省略号
// ),
// ),
// ],
// ),
// Align(
// alignment: AlignmentDirectional(-1, 0),
// child: Text(
// '房间:' +
// (deviceListController
// .model.deviceList[index]
// ['roomName'] ??
// ''),
// style: TextStyle(
// fontFamily: 'Readex Pro',
// color: Color(0xFFC8CBD2),
// fontSize: 26.rpx,
// letterSpacing: 0,
// height: 1),
// ),
// ),
// Align(
// alignment: AlignmentDirectional(-1, 0),
// child: Text(
// '设备状态:${(deviceListController.model.deviceList[index]["status"]?["status"]) == 1 ? '在线' : '离线'}',
// style: TextStyle(
// fontFamily: 'Readex Pro',
// color: Color(0xFFC8CBD2),
// fontSize: 26.rpx,
// letterSpacing: 0,
// height: 1),
// ),
// )
].divide(SizedBox(height: 36.rpx)),
),
),
@@ -180,7 +197,7 @@ class DeviceInfoWidget extends GetView {
Align(
alignment: AlignmentDirectional(0, 0),
child: Container(
width: MediaQuery.sizeOf(context).width * 0.21,
width: 150.rpx,
height: 90.rpx,
child: FFButtonWidget(
onPressed: () {
@@ -405,4 +422,25 @@ class DeviceInfoWidget extends GetView {
),
);
}
Widget _buildInfoRow(String label, String value, {Color? valueColor}) {
return Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'$label ',
style:
TextStyle(color: Color(0XFF929699), fontSize: 26.rpx, height: 1),
),
Flexible(
child: Text(
value,
style: TextStyle(
color: valueColor ?? Colors.white, fontSize: 26.rpx, height: 1),
overflow: TextOverflow.ellipsis,
),
),
],
);
}
}