修改ui设计错误
This commit is contained in:
439
lib/pages/mh_page/device/device.dart
Normal file
439
lib/pages/mh_page/device/device.dart
Normal file
@@ -0,0 +1,439 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
|
||||
import 'package:vbvs_app/common/color/appFontsize.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/mh_controller/device_list_controller.dart';
|
||||
|
||||
class DeviceInfoWidget extends GetView {
|
||||
int index;
|
||||
DeviceListController deviceListController;
|
||||
|
||||
DeviceInfoWidget({required this.index, required this.deviceListController}) {}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var device = deviceListController.model.deviceList[index];
|
||||
GlobalController globalController = Get.find();
|
||||
return Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0, 30.rpx, 0),
|
||||
child: Container(
|
||||
// width: MediaQuery.sizeOf(context).width,
|
||||
height: 381.rpx,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 140,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF003058),
|
||||
borderRadius: BorderRadius.circular(16.rpx),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(26.rpx, 33.rpx, 26.rpx, 0),
|
||||
child: Container(
|
||||
// width: MediaQuery.sizeOf(context).width,
|
||||
height: 381.rpx,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 106,
|
||||
),
|
||||
|
||||
child: Container(
|
||||
// width: MediaQuery.sizeOf(context).width,
|
||||
height: 381.rpx,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 130,
|
||||
),
|
||||
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
deviceListController.model.deviceList[index]['name'] ??
|
||||
'SWES系列 01号智能一键入眠床',
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
fontSize: 30.rpx,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
maxLines: 1, // 限制显示一行
|
||||
overflow: TextOverflow.ellipsis, // 超出部分显示省略号
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 36.rpx),
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
// height: MediaQuery.sizeOf(context).height * 0.065,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 55,
|
||||
),
|
||||
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
// GlobalController globalController = Get.find();
|
||||
// var tmp = globalController.model.deviceMain;
|
||||
// BedController bedController = Get.find();
|
||||
// bedController.websocketSend(2);
|
||||
// globalController.model.deviceMain = device;
|
||||
// globalController.updateAll();
|
||||
// bedController.websocketSend(1);
|
||||
// var result = await Get.toNamed("/bodyChart");
|
||||
// bedController.websocketSend(2);
|
||||
// globalController.model.deviceMain = tmp;
|
||||
},
|
||||
child: Container(
|
||||
child: Column(
|
||||
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: FlutterFlowTheme.of(
|
||||
context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
color:
|
||||
Color(0xFFC8CBD2),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0,
|
||||
lineHeight: 1),
|
||||
),
|
||||
TextSpan(
|
||||
text:
|
||||
' (${deviceListController.model.deviceList[index]['status'] ?? ''})',
|
||||
style:
|
||||
FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
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
|
||||
.model.deviceList[index]
|
||||
['roomName'] ??
|
||||
''),
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFFC8CBD2),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0,
|
||||
lineHeight: 1),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: AlignmentDirectional(-1, 0),
|
||||
child: Text(
|
||||
'设备状态:' +
|
||||
(deviceListController
|
||||
.model
|
||||
.deviceList[index]["status"]
|
||||
?["status"]
|
||||
?.toString() ??
|
||||
''),
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFFC8CBD2),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0,
|
||||
lineHeight: 1),
|
||||
),
|
||||
)
|
||||
].divide(SizedBox(height: 36.rpx)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: AlignmentDirectional(0, 0),
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width * 0.21,
|
||||
height: 90.rpx,
|
||||
child: FFButtonWidget(
|
||||
onPressed: () {
|
||||
// deviceControllerChange(device);
|
||||
},
|
||||
text: '控制',
|
||||
options: FFButtonOptions(
|
||||
color: Color(0XFF85F5FF),
|
||||
textStyle: FlutterFlowTheme.of(context)
|
||||
.titleSmall
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
fontSize: 28.rpx,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
elevation: 0,
|
||||
borderSide: BorderSide(
|
||||
color: Colors.transparent,
|
||||
width: 1,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(16.rpx),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0, 36.rpx, 0, 0),
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
height: 130,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 1,
|
||||
maxHeight: 1,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFB6BBC9),
|
||||
),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(right: 26.rpx),
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
height: MediaQuery.sizeOf(context).height * 1,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 60,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
if (device['type'] == 1) {
|
||||
globalController.model.deviceMain = device;
|
||||
await Get.toNamed("/deviceShare");
|
||||
globalController.getDeviceList();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
height: MediaQuery.sizeOf(context).height * 0.1,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Align(
|
||||
alignment: AlignmentDirectional(1, 0),
|
||||
child: Container(
|
||||
width: 42.rpx,
|
||||
height: 42.rpx,
|
||||
child: SvgPicture.asset(
|
||||
'assets/images/group.svg',
|
||||
color: Color(0xFF85F5FF),
|
||||
),
|
||||
)),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
if (device['type'] == 1)
|
||||
Text(
|
||||
'已分享:',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
fontSize: AppFontsize
|
||||
.normal_text_size,
|
||||
letterSpacing: 0,
|
||||
color: Color(0xFF333333),
|
||||
),
|
||||
),
|
||||
if (device['type'] == 1)
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(
|
||||
5, 0, 5, 0),
|
||||
child: Text(
|
||||
// '0',
|
||||
deviceListController
|
||||
.model.deviceList[index]
|
||||
['shareNum'] ??
|
||||
'0',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFFE55E92),
|
||||
fontSize: AppFontsize
|
||||
.normal_text_size,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (device['type'] == 1)
|
||||
Text(
|
||||
'人',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
fontSize: AppFontsize
|
||||
.normal_text_size,
|
||||
letterSpacing: 0,
|
||||
color: Color(0xFF333333),
|
||||
),
|
||||
),
|
||||
if (device['type'] == 2)
|
||||
Text(
|
||||
'来自',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
fontSize: AppFontsize
|
||||
.normal_text_size,
|
||||
letterSpacing: 0,
|
||||
color: Color(0xFF333333),
|
||||
),
|
||||
),
|
||||
if (device['type'] == 2)
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(
|
||||
5, 0, 5, 0),
|
||||
child: Text(
|
||||
'${device['suname']?.length > 5 ? device['suname'].substring(0, 5) + '...' : device['suname']}',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFFE55E92),
|
||||
fontSize: AppFontsize
|
||||
.normal_text_size,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (device['type'] == 2)
|
||||
Text(
|
||||
'的分享',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
fontSize: 21.rpx,
|
||||
letterSpacing: 0,
|
||||
color: Color(0xFF333333),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
].divide(SizedBox(width: 6)),
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
var a = [device["bindMacA"]];
|
||||
if ("${device["bindMacB"]}".length > 6) {
|
||||
a.add(device["bindMacB"]);
|
||||
}
|
||||
Get.toNamed("/sleepWebview", arguments: a);
|
||||
},
|
||||
child: Container(
|
||||
height: MediaQuery.sizeOf(context).height * 0.1,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 25,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Align(
|
||||
alignment: AlignmentDirectional(0, 0),
|
||||
child: SvgPicture.asset(
|
||||
"assets/images/table.svg",
|
||||
width: 24.rpx,
|
||||
height: 24.rpx,
|
||||
color: Color(0xFF85F5FF),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
Text(
|
||||
'睡眠报告',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Colors.white,
|
||||
fontSize: 21.rpx,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user