Files
tuiche/lib/pages/device_control/device_people_info.dart
2025-06-03 09:34:31 +08:00

267 lines
14 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/base/THFlutterFlowDropDown.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
class DevicePeopleInfo extends StatelessWidget {
DevicePeopleInfo({super.key});
get glController => Get.find<GlobalController>();
get bodyData => glController.model.mainDevicePeople;
getInfoRow(context, String str) {
return Container(
width: double.infinity,
height: 60.rpx,
decoration: BoxDecoration(),
alignment: Alignment.centerLeft,
child: Text(
'$str',
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro',
color: Colors.white,
fontSize: 26.rpx,
letterSpacing: 0,
),
),
);
}
@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, boxConstraints) => GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/new_background.png'), // 本地图片
fit: BoxFit.fill, // 填满整个 Container
),
),
child: Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(
backgroundColor: Colors.transparent,
automaticallyImplyLeading: false,
iconTheme: IconThemeData(color: Colors.white),
titleSpacing: 0,
title: AppBar(
backgroundColor: Colors.transparent,
iconTheme: const IconThemeData(color: Colors.white),
automaticallyImplyLeading: false,
titleSpacing: 0,
title: SizedBox(
width: double.infinity,
height: 180.rpx,
child: Stack(
alignment: Alignment.center,
children: [
// 中间居中的标题
Text(
'详情',
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 30.rpx,
),
),
// 左侧图标
Positioned(
left: 20.rpx,
child: returnIconButtomNew,
),
],
),
),
centerTitle: false,
),
actions: [],
centerTitle: false,
),
body: SafeArea(
top: true,
child: Obx(
() => Container(
padding: EdgeInsets.only(
left: 30.rpx, right: 30.rpx, top: 30.rpx),
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 1.123,
// decoration: BoxDecoration(
// // color: AppColors.bg_color,
// image: DecorationImage(
// image: AssetImage("assets/images/background.png"),
// fit: BoxFit.cover,
// ),
// ),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
ClickableContainer(
backgroundColor: Color(0xFF003058),
highlightColor: Color(0xFF036060),
borderRadius: 16.rpx,
padding: EdgeInsets.fromLTRB(
30.rpx, 20.rpx, 0, 20.rpx),
onTap: () {},
child: Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(16.rpx)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
alignment: Alignment.centerLeft,
child: Text(
'设备信息',
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color: Colors.white,
fontSize: 30.rpx,
),
),
),
getInfoRow(context,
"名称:${glController.getDeviceGroupName2(glController.model.deviceMain)}"),
getInfoRow(context,
"房间:${glController.model.deviceMain["roomName"] ?? "-"}"),
getInfoRow(context,
"网络:${glController.model.deviceMain["status"] ?? "-"}"),
getInfoRow(context,
"MAC${glController.model.deviceMain["mac"] ?? "-"}"),
],
),
)),
...List.generate(
"${glController.model.deviceMain["bindMacB"]}"
.length >
6
? 2
: 1, (index) {
String location_ = "";
if ("${glController.model.deviceMain["bindMacB"]}"
.length >
6 &&
(glController.model.mainDevicePeople[0]
?["direction"] ==
1 ||
glController.model.mainDevicePeople[1]
?["direction"] ==
1)) {
location_ =
"${glController.model.mainDevicePeople[index]?["direction"] == 1 ? '左侧' : '右侧'}";
}
// return Container(
// decoration: BoxDecoration(
// color: Color(0xFF003058),
// borderRadius: BorderRadius.circular(16.rpx),
// ),
// child: Padding(
// padding: EdgeInsets.symmetric(
// horizontal: 30.rpx),
// child: Column(
// children: [
// Container(
// width: double.infinity,
// margin: EdgeInsets.only(
// bottom: 30.rpx, top: 50.rpx),
// decoration: BoxDecoration(),
// child: Text(
// '人员资料${index == 0 ? "A" : "B"}',
// style: FlutterFlowTheme.of(context)
// .bodyMedium
// .override(
// fontFamily: 'Readex Pro',
// color: Colors.white,
// fontSize: 32.rpx,
// letterSpacing: 0,
// ),
// ),
// ),
// if (location_.isNotEmpty)
// getInfoRow(
// context, "校准位置:$location_"),
// getInfoRow(context,
// "姓名:${bodyData[index]["name"] ?? "-"}"),
// getInfoRow(context,
// "性别:${bodyData[index]["gender"] == null ? "-" : (bodyData[index]["gender"] == 1 ? "男" : "女")}"),
// getInfoRow(context,
// "身高:${bodyData[index]["height"] == null ? "-" : "${bodyData[index]["height"]}cm"}"),
// getInfoRow(context,
// "体重:${bodyData[index]["weight"] == null ? "-" : "${bodyData[index]["weight"]}kg"}"),
// getInfoRow(context,
// "生日:${bodyData[index]["birthday"] == null ? "-" : (time_08_Formatter_pattern(bodyData[index]["birthday"], "yyyy年MM月dd日"))}"),
// getInfoRow(context,
// "电话:${bodyData[index]["tel"] ?? "-"}"),
// getInfoRow(context,
// "紧急联系人:${bodyData[index]["contact"] ?? "-"}"),
// ],
// )));
return ClickableContainer(
backgroundColor: Color(0xFF003058),
highlightColor: Color(0xFF036060),
borderRadius: 16.rpx,
padding: EdgeInsets.fromLTRB(
30.rpx, 20.rpx, 30.rpx, 20.rpx),
onTap: () {},
child: Column(
children: [
Container(
width: double.infinity,
alignment: Alignment.centerLeft,
child: Text(
'人员资料${index == 0 ? "A" : "B"}',
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color: Colors.white,
fontSize: 32.rpx,
letterSpacing: 0,
),
),
),
if (location_.isNotEmpty)
getInfoRow(context, "校准位置:$location_"),
getInfoRow(context,
"姓名:${bodyData[index]["name"] ?? "-"}"),
getInfoRow(context,
"性别:${bodyData[index]["gender"] == null ? "-" : (bodyData[index]["gender"] == 1 ? "" : "")}"),
getInfoRow(context,
"身高:${bodyData[index]["height"] == null ? "-" : "${bodyData[index]["height"]}cm"}"),
getInfoRow(context,
"体重:${bodyData[index]["weight"] == null ? "-" : "${bodyData[index]["weight"]}kg"}"),
getInfoRow(context,
"生日:${bodyData[index]["birthday"] == null ? "-" : (time_08_Formatter_pattern(bodyData[index]["birthday"], "yyyy年MM月dd日"))}"),
getInfoRow(context,
"电话:${bodyData[index]["tel"] ?? "-"}"),
getInfoRow(context,
"紧急联系人:${bodyData[index]["contact"] ?? "-"}"),
],
),
);
})
].divide(SizedBox(
height: 25.rpx,
)),
),
),
),
),
),
),
)),
);
}
}