更新睡眠报告
This commit is contained in:
69
lib/pages/sleep_report/component/BreatheCard.dart
Normal file
69
lib/pages/sleep_report/component/BreatheCard.dart
Normal file
@@ -0,0 +1,69 @@
|
||||
import 'package:flutter/material.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/home_page/SleepDataModuleWidget.dart';
|
||||
|
||||
class BreatheCard extends StatefulWidget {
|
||||
var sleepReport;
|
||||
BreatheCard({super.key, required this.sleepReport});
|
||||
|
||||
@override
|
||||
State<BreatheCard> createState() => _BreatheCardState();
|
||||
}
|
||||
|
||||
class _BreatheCardState extends State<BreatheCard> {
|
||||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (widget.sleepReport == null ||
|
||||
widget.sleepReport is! Map ||
|
||||
widget.sleepReport.isEmpty) {
|
||||
return Container();
|
||||
}
|
||||
|
||||
List data = widget.sleepReport['brs'] ?? [];
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: themeController.currentColor.sc5,
|
||||
borderRadius:
|
||||
BorderRadius.circular(AppConstants().normal_container_radius),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(26.rpx, 29.rpx, 26.rpx, 45.rpx),
|
||||
child: Wrap(
|
||||
spacing: 23.rpx, // 横向间距(左右间距如需加可设置)
|
||||
runSpacing: 25.rpx, // 每行之间的垂直间距
|
||||
children: List.generate(data.length, (index) {
|
||||
final item = data[index];
|
||||
return SizedBox(
|
||||
width: (MediaQuery.of(context).size.width - 160.rpx) / 3,
|
||||
child: SleepDataModuleWidget(data: item),
|
||||
// child: Container(
|
||||
// width: 20,
|
||||
// height: 20,
|
||||
// color: Colors.red,
|
||||
// ),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user