更新
This commit is contained in:
@@ -5,7 +5,6 @@ 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';
|
||||
@@ -27,11 +26,21 @@ class _SleepReportPageState extends State<SleepReportPage> {
|
||||
ThemeController themeController = Get.find();
|
||||
DeviceTypeController deviceTypeController = Get.find();
|
||||
|
||||
// 使用 ValueNotifier 来管理加载状态
|
||||
ValueNotifier<bool> isPageLoading = ValueNotifier<bool>(true);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
// 清理 ValueNotifier
|
||||
isPageLoading.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
@@ -45,14 +54,12 @@ class _SleepReportPageState extends State<SleepReportPage> {
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent, // 加上这一行
|
||||
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,
|
||||
@@ -78,50 +85,35 @@ class _SleepReportPageState extends State<SleepReportPage> {
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
actions: [],
|
||||
centerTitle: false,
|
||||
),
|
||||
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: InAppWebView(
|
||||
key: UniqueKey(),
|
||||
initialUrlRequest: URLRequest(url: WebUri(widget.sleepUri)),
|
||||
child: Stack(
|
||||
children: [
|
||||
InAppWebView(
|
||||
key: UniqueKey(),
|
||||
initialUrlRequest: URLRequest(url: WebUri(widget.sleepUri)),
|
||||
onLoadStart: (controller, url) {
|
||||
// 页面开始加载时显示加载指示器
|
||||
isPageLoading.value = true;
|
||||
},
|
||||
onLoadStop: (controller, url) {
|
||||
// 页面加载完成后隐藏加载指示器
|
||||
isPageLoading.value = false;
|
||||
},
|
||||
),
|
||||
ValueListenableBuilder<bool>(
|
||||
valueListenable: isPageLoading,
|
||||
builder: (context, isLoading, child) {
|
||||
return isLoading
|
||||
? Center(
|
||||
child: CircularProgressIndicator(), // 加载指示器
|
||||
)
|
||||
: SizedBox.shrink();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
// 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), // 结束的间隔
|
||||
// ],
|
||||
// );
|
||||
// }),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -170,14 +162,8 @@ class _SleepReportPageState extends State<SleepReportPage> {
|
||||
),
|
||||
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,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user