更新
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:fl_chart/fl_chart.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
@@ -6,7 +9,7 @@ import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
|
||||
import 'package:vbvs_app/pages/sleep_report/chart/StatusBarWithIndicator.dart';
|
||||
import 'package:vbvs_app/pages/sleep_report/chart/ScatterPlotChart.dart';
|
||||
|
||||
class HeartPointWidget extends StatefulWidget {
|
||||
HeartPointWidget({super.key});
|
||||
@@ -33,6 +36,18 @@ class _HeartPointWidgetState extends State<HeartPointWidget> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<ScatterSpot> data = List.generate(200, (index) {
|
||||
// 随机生成 x 和 y 值,范围都在 0-1400 之间
|
||||
double x = Random().nextDouble() * 1400; // x 值在 0-1400 范围
|
||||
double y = Random().nextDouble() * 1400; // y 值也在 0-1400 范围
|
||||
|
||||
// 返回 ScatterSpot,使用圆点绘制器自定义大小和颜色
|
||||
return ScatterSpot(
|
||||
x,
|
||||
y,
|
||||
);
|
||||
});
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
@@ -91,24 +106,30 @@ class _HeartPointWidgetState extends State<HeartPointWidget> {
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 83.rpx,
|
||||
height: 31.rpx,
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(30.rpx, 0.rpx, 30.rpx, 0.rpx),
|
||||
child: StatusBarWithIndicator(
|
||||
selectKey: 2,
|
||||
showLabel: [
|
||||
{"key": 1, "name": "正常", "color": Color(0xFF4CAF50)},
|
||||
{"key": 2, "name": "一般", "color": Color(0xFF8BC34A)},
|
||||
{"key": 3, "name": "注意", "color": Color(0xFFFFC107)},
|
||||
{"key": 4, "name": "警告", "color": Color(0xFFF44336)},
|
||||
],
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width * 0.7,
|
||||
height: MediaQuery.of(context).size.width * 0.7,
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 430.rpx,
|
||||
minHeight: 430.rpx,
|
||||
),
|
||||
child: ScatterPlotChart(
|
||||
points: data,
|
||||
xMax: 1400, // x轴最大值
|
||||
yMax: 1400, // y轴最大值
|
||||
pointColor: stringToColor("#00C1AA"), // 点的颜色
|
||||
divisions: 7, // 刻度分割数量
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 56.rpx,
|
||||
),
|
||||
// SizedBox(
|
||||
// height: 31.rpx,
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user