Files
tuiche/lib/pages/device/health_experience_history.dart
2026-04-07 14:49:31 +08:00

161 lines
5.5 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/color/appConstants.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/NullDataComponentWidget.dart';
import 'package:vbvs_app/controller/device/device_type_controller.dart';
import 'package:vbvs_app/controller/message/message_review_controller.dart';
import 'package:vbvs_app/pages/device/component/HealthReportCard.dart';
import 'package:flutter/services.dart';
class HealthExperienceHistory extends StatefulWidget {
var data;
HealthExperienceHistory({super.key, required this.data});
@override
State<HealthExperienceHistory> createState() =>
_HealthExperienceHistoryState();
}
class _HealthExperienceHistoryState extends State<HealthExperienceHistory> {
MessageReviewController messageReviewController = Get.find();
DeviceTypeController deviceTypeController = Get.find();
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
loadData(widget.data).then((aa) {
deviceTypeController.updateAll();
});
});
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
try {
return LayoutBuilder(
builder: (context, bodysize) => GestureDetector(
// onTap: () => FocusScope.of(context).unfocus(),,
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(getBackgroundImageNoImage()), // 本地图片
fit: BoxFit.fill, // 填满整个 Container
),
),
child: Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(
systemOverlayStyle: SystemUiOverlayStyle(
statusBarColor: Colors.transparent, // 状态栏背景色
statusBarIconBrightness: Brightness.light, // 图标颜色Android
statusBarBrightness: Brightness.light, // 图标颜色iOS
),
backgroundColor: themeController.currentColor.sc17,
automaticallyImplyLeading: false,
iconTheme: IconThemeData(
color: themeController.currentColor.sc3,
),
titleSpacing: 0,
title: Container(
width: double.infinity,
height: 180.rpx,
child: Stack(
alignment: Alignment.center,
children: [
/// 居中标题
Text(
'快检历史'.tr,
style: TextStyle(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx,
),
),
Positioned(
left: 0,
// child: returnIconButtom,
child: returnIconButtomAddCallback(() {}),
),
],
),
),
actions: [],
centerTitle: false,
),
body: SafeArea(
top: true,
child: Padding(
padding:
EdgeInsetsDirectional.fromSTEB(30.rpx, 0.rpx, 30.rpx, 0),
child: Obx(() {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (deviceTypeController.qcListLoading.value)
Center(
child: CircularProgressIndicator(
strokeWidth: 2,
valueColor: AlwaysStoppedAnimation<Color>(
themeController.currentColor.sc1,
),
),
),
if (!deviceTypeController.qcListLoading.value)
Expanded(
child: Obx(() {
final list =
deviceTypeController.cqHistoryList.value;
return list.isEmpty
? const NullDataWidget()
: _buildMessageListView(list);
}),
),
],
);
}),
),
),
),
),
),
);
} catch (e) {
return Container();
}
}
Future<void> loadData(data) async {
deviceTypeController.getCheckHistory(mac: data['mac']);
}
Widget _buildMessageListView(List dataList) {
return Container(
width: double.infinity,
padding: EdgeInsets.symmetric(horizontal: 0.rpx),
child: SingleChildScrollView(
child: Column(
children: [
SizedBox(height: 30.rpx),
...dataList
.map((item) => HealthReportCardWidget(data: item))
.toList()
.divide(SizedBox(height: 30.rpx)),
SizedBox(height: 30.rpx),
],
),
),
);
}
}