191 lines
6.9 KiB
Dart
191 lines
6.9 KiB
Dart
import 'package:ef/ef.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
|
import 'package:vbvs_app/common/util/FitTool.dart';
|
|
import 'package:vbvs_app/common/util/MyUtils.dart';
|
|
import 'package:vbvs_app/component/tool/CustomCard.dart';
|
|
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
|
import 'package:vbvs_app/component/tool/WebViewWidget.dart';
|
|
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
|
|
import 'package:vbvs_app/controller/device/device_type_controller.dart';
|
|
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
|
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
|
import 'package:vbvs_app/controller/user_info_controller.dart';
|
|
|
|
class SleepReportPage extends StatefulWidget {
|
|
var sleepUri;
|
|
SleepReportPage({super.key, required this.sleepUri});
|
|
|
|
@override
|
|
State<SleepReportPage> createState() => _SleepReportPageState();
|
|
}
|
|
|
|
class _SleepReportPageState extends State<SleepReportPage> {
|
|
GlobalController globalController = Get.find();
|
|
UserInfoController userInfoController = Get.find();
|
|
BlueteethBindController blueteethBindController = Get.find();
|
|
ThemeController themeController = Get.find();
|
|
DeviceTypeController deviceTypeController = Get.find();
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return LayoutBuilder(
|
|
builder: (context, bodySize) => GestureDetector(
|
|
onTap: () => FocusScope.of(context).unfocus(),
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage('assets/img/bgNoImg.png'), // 本地图片
|
|
fit: BoxFit.fill, // 填满整个 Container
|
|
),
|
|
),
|
|
child: Scaffold(
|
|
backgroundColor: Colors.transparent, // 加上这一行
|
|
appBar: AppBar(
|
|
backgroundColor: themeController.currentColor.sc17,
|
|
// backgroundColor: Colors.transparent,
|
|
automaticallyImplyLeading: false,
|
|
iconTheme: IconThemeData(color: themeController.currentColor.sc3),
|
|
titleSpacing: 0,
|
|
// leading: returnIconButtom,
|
|
title: Container(
|
|
width: double.infinity,
|
|
height: 180.rpx,
|
|
child: Stack(
|
|
alignment: Alignment.center,
|
|
children: [
|
|
/// 居中标题
|
|
Text(
|
|
'健康报告'.tr,
|
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
fontFamily: 'Readex Pro',
|
|
color: themeController.currentColor.sc3,
|
|
letterSpacing: 0,
|
|
fontSize: 30.rpx,
|
|
),
|
|
),
|
|
|
|
/// 左边返回按钮
|
|
Positioned(
|
|
left: 0,
|
|
child: returnIconButtom,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
|
|
actions: [],
|
|
centerTitle: false,
|
|
),
|
|
|
|
body: SafeArea(
|
|
top: true,
|
|
child: InAppWebView(
|
|
key: UniqueKey(),
|
|
initialUrlRequest: URLRequest(url: WebUri(widget.sleepUri)),
|
|
),
|
|
// child: WebViewWidget(url: "${widget.sleepUri}"),
|
|
// child: Padding(
|
|
// padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0, 30.rpx, 0),
|
|
// child: SingleChildScrollView(
|
|
// child: Column(
|
|
// mainAxisSize: MainAxisSize.max,
|
|
// children: [
|
|
// // 使用 Obx 来监听 deviceTypeList 的变化
|
|
// Obx(() {
|
|
// return Column(
|
|
// children: [
|
|
// SizedBox(height: 26.rpx), // 开始的间隔
|
|
// ...deviceTypeController.deviceTypeList.value
|
|
// .map((device) {
|
|
// return Padding(
|
|
// padding: EdgeInsets.only(
|
|
// bottom: 26.rpx), // 添加每个设备之间的间隔
|
|
// child: _buildDeviceCard(
|
|
// context,
|
|
// title: device['name'], // 这里假设 device 是一个 Map
|
|
// imageUrl: device['image'],
|
|
// type: device['type'],
|
|
// ),
|
|
// );
|
|
// }).toList(),
|
|
// SizedBox(height: 26.rpx), // 结束的间隔
|
|
// ],
|
|
// );
|
|
// }),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
// ),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildDeviceCard(BuildContext context,
|
|
{required String title, required String imageUrl, required double type}) {
|
|
return CustomCard(
|
|
borderRadius: 20.rpx, // 圆角大小
|
|
onTap: () {
|
|
if (type != null) {
|
|
if (type == 1) {
|
|
Get.toNamed("/bodyDevice");
|
|
}
|
|
if (type == 2) {
|
|
TopSlideNotification.show(
|
|
context,
|
|
text: "待开发.提示".tr,
|
|
textColor: themeController.currentColor.sc2,
|
|
);
|
|
}
|
|
}
|
|
},
|
|
colors: [themeController.currentColor.sc17], // 背景色
|
|
child: Container(
|
|
width: double.infinity,
|
|
height: MediaQuery.sizeOf(context).height * 0.135,
|
|
constraints: BoxConstraints(
|
|
minHeight: 220.rpx,
|
|
),
|
|
padding: EdgeInsetsDirectional.fromSTEB(77.rpx, 0, 21.rpx, 0),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
title,
|
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
fontFamily: 'Inter',
|
|
color: const Color(0xFFC2CED7),
|
|
fontSize: 30.rpx,
|
|
letterSpacing: 0.0,
|
|
),
|
|
),
|
|
ClipRRect(
|
|
borderRadius: BorderRadius.circular(8.rpx),
|
|
// child: Image.asset(
|
|
// imageUrl,
|
|
// width: 212.rpx,
|
|
// height: 168.rpx,
|
|
// ),
|
|
child: Image.network(
|
|
imageUrl,
|
|
// fit: BoxFit.cover,
|
|
width: 212.rpx,
|
|
height: 168.rpx,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|