日报周报月报
This commit is contained in:
@@ -33,6 +33,7 @@ class _BluetoothPageState extends State<BluetoothPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(builder: (context, cc) {
|
||||
bodysize = cc;
|
||||
final isBind = obsData['bind_type'] == 1;
|
||||
return GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: Container(
|
||||
@@ -158,7 +159,6 @@ class _BluetoothPageState extends State<BluetoothPage> {
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// 按钮列表
|
||||
Expanded(
|
||||
child: ListView(
|
||||
padding: EdgeInsets.symmetric(horizontal: 30.rpx),
|
||||
@@ -166,23 +166,25 @@ class _BluetoothPageState extends State<BluetoothPage> {
|
||||
_buildMenuButton(
|
||||
context, '详情', "/devicePeopleInfo",
|
||||
arguments: obsData),
|
||||
_buildMenuButton(
|
||||
context,
|
||||
'人员资料',
|
||||
"/peopleInfoPage",
|
||||
arguments: obsData,
|
||||
),
|
||||
_buildMenuButton(
|
||||
context, '房间选择', "/roomPickerPage",
|
||||
arguments: obsData),
|
||||
_buildMenuButton(context, '设备校准', ""),
|
||||
_buildMenuButton(context, '体征传感器', ""),
|
||||
_buildMenuButton(context, 'WIFI配置', ""),
|
||||
_buildMenuButton(
|
||||
context, '睡眠习惯', "/sleepHabitPage"),
|
||||
_buildMenuButton(
|
||||
context, '分享设备', "/deviceSharePage",
|
||||
arguments: obsData),
|
||||
if (isBind) ...[
|
||||
_buildMenuButton(
|
||||
context,
|
||||
'人员资料',
|
||||
"/peopleInfoPage",
|
||||
arguments: obsData,
|
||||
),
|
||||
_buildMenuButton(
|
||||
context, '房间选择', "/roomPickerPage",
|
||||
arguments: obsData),
|
||||
_buildMenuButton(context, '设备校准', ""),
|
||||
_buildMenuButton(context, '体征传感器', ""),
|
||||
_buildMenuButton(context, 'WIFI配置', ""),
|
||||
_buildMenuButton(
|
||||
context, '睡眠习惯', "/sleepHabitPage"),
|
||||
_buildMenuButton(
|
||||
context, '分享设备', "/deviceSharePage",
|
||||
arguments: obsData),
|
||||
],
|
||||
_buildMenuButton(
|
||||
context,
|
||||
obsData['bind_type'] == 1 ? '解绑' : '删除',
|
||||
@@ -243,6 +245,104 @@ class _BluetoothPageState extends State<BluetoothPage> {
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// Expanded(
|
||||
// child: Align(
|
||||
// alignment: Alignment.bottomCenter,
|
||||
// child: SingleChildScrollView(
|
||||
// reverse: true, // 👈 optional,如果你想要滚动时内容从底部弹出
|
||||
// child: Column(
|
||||
// crossAxisAlignment:
|
||||
// CrossAxisAlignment.stretch,
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
|
||||
// children: [
|
||||
// _buildMenuButton(
|
||||
// context, '详情', "/devicePeopleInfo",
|
||||
// arguments: obsData),
|
||||
// if (isBind) ...[
|
||||
// _buildMenuButton(
|
||||
// context,
|
||||
// '人员资料',
|
||||
// "/peopleInfoPage",
|
||||
// arguments: obsData,
|
||||
// ),
|
||||
// _buildMenuButton(
|
||||
// context, '房间选择', "/roomPickerPage",
|
||||
// arguments: obsData),
|
||||
// _buildMenuButton(context, '设备校准', ""),
|
||||
// _buildMenuButton(context, '体征传感器', ""),
|
||||
// _buildMenuButton(context, 'WIFI配置', ""),
|
||||
// _buildMenuButton(
|
||||
// context, '睡眠习惯', "/sleepHabitPage"),
|
||||
// _buildMenuButton(
|
||||
// context, '分享设备', "/deviceSharePage",
|
||||
// arguments: obsData),
|
||||
// ],
|
||||
// _buildMenuButton(
|
||||
// context,
|
||||
// obsData['bind_type'] == 1 ? '解绑' : '删除',
|
||||
// "",
|
||||
// onTap: () {
|
||||
// if (obsData['bind_type'] == 1) {
|
||||
// // 解绑弹窗
|
||||
// showUnbindConfirmDialog(
|
||||
// context: context,
|
||||
// title: "是否进行解绑?",
|
||||
// onConfirm: () async {
|
||||
// await deviceListController
|
||||
// .unbindDevice(obsData);
|
||||
// await deviceListController
|
||||
// .getDeviceList();
|
||||
// MHTHomeController homeController =
|
||||
// Get.find();
|
||||
// homeController
|
||||
// .selectDevcie.value = "";
|
||||
// try {
|
||||
// WebviewTestController
|
||||
// webviewTestController =
|
||||
// Get.find();
|
||||
// webviewTestController
|
||||
// .web.jsbridge?.dart
|
||||
// .unBindDevice();
|
||||
// } catch (e) {
|
||||
// ef.log("[h5]通知列表更新报错:$e");
|
||||
// }
|
||||
// Get.toNamed(
|
||||
// "/mianPageBottomChange");
|
||||
// // 执行解绑逻辑
|
||||
// },
|
||||
// onCancel: () {
|
||||
// // 点击取消后的逻辑
|
||||
// },
|
||||
// );
|
||||
// } else if (obsData['bind_type'] == 2) {
|
||||
// // 删除弹窗
|
||||
// showDeleteDeviceConfirmDialog(
|
||||
// context: context,
|
||||
// title: "是否进行删除?",
|
||||
// onConfirm: () async {
|
||||
// await deviceListController
|
||||
// .unbindDevice(
|
||||
// obsData,
|
||||
// );
|
||||
// await deviceListController
|
||||
// .getDeviceList();
|
||||
// Get.toNamed(
|
||||
// "/mianPageBottomChange");
|
||||
// },
|
||||
// onCancel: () {
|
||||
// // 点击取消后的逻辑
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
)),
|
||||
|
||||
191
lib/pages/mh_page/component/easychart.dart
Normal file
191
lib/pages/mh_page/component/easychart.dart
Normal file
@@ -0,0 +1,191 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:ef/base/chart/drawer.dart';
|
||||
import 'package:ef/base/chart/easychart.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
|
||||
enum ChartDisplayMode { line, bar, both, dualBar }
|
||||
|
||||
class LineView extends StatelessWidget {
|
||||
final List<ChartLables> xLabels;
|
||||
final List<ChartLables> yLabels;
|
||||
final double barWidth;
|
||||
final int xCount;
|
||||
final int yCount;
|
||||
final List<Offset> points;
|
||||
final ChartDisplayMode displayMode;
|
||||
final List<String>? barColors;
|
||||
final List<List<Offset>>? dualBarPoints;
|
||||
final String? xUnit;
|
||||
final List<String> tips;
|
||||
final double bottomPadding;
|
||||
const LineView({
|
||||
super.key,
|
||||
required this.xLabels,
|
||||
required this.yLabels,
|
||||
required this.xCount,
|
||||
required this.yCount,
|
||||
required this.points,
|
||||
required this.barWidth,
|
||||
required this.tips,
|
||||
this.xUnit = '',
|
||||
this.bottomPadding = 100,
|
||||
this.displayMode = ChartDisplayMode.bar,
|
||||
this.barColors, // 添加进构造函数
|
||||
this.dualBarPoints,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(builder: (a, b) {
|
||||
return Container(
|
||||
alignment: Alignment.topCenter,
|
||||
margin: EdgeInsets.only(
|
||||
left: 43.rpx,
|
||||
bottom: bottomPadding.rpx,
|
||||
),
|
||||
child: EasyChartView(
|
||||
size: Size(b.maxWidth, 220.rpx),
|
||||
drawer: ChartDrawer(
|
||||
xAxis: ChartAxis(
|
||||
intent: 44,
|
||||
entintent: 15,
|
||||
labels: xLabels,
|
||||
count: xCount,
|
||||
),
|
||||
yAxis: ChartAxis(
|
||||
color: Colors.transparent,
|
||||
isX: false,
|
||||
intent: 0,
|
||||
entintent: 45.rpx.toInt(),
|
||||
labels: yLabels,
|
||||
count: yCount,
|
||||
),
|
||||
ondrawer: (canvas, size, drawer) {
|
||||
canvas.scale(1, -1);
|
||||
ChartLables.drawText(
|
||||
canvas,
|
||||
xUnit!,
|
||||
Offset(drawer.yAxis.labels.first.offset.dx,
|
||||
-drawer.drawsize.height + 0),
|
||||
style: TextStyle(
|
||||
color: Color(0xFFFFFFFF).withOpacity(0.6),
|
||||
fontSize: 18.rpx,
|
||||
),
|
||||
);
|
||||
canvas.scale(1, -1);
|
||||
// 虚线
|
||||
for (var i = 1;
|
||||
i < drawer.yAxis.labels.first.labels.length;
|
||||
i++) {
|
||||
drawer.drawHorizontalDashedLine(
|
||||
canvas,
|
||||
drawer.yAxis.labels.first.steps[i].dy,
|
||||
drawer.drawsize.width,
|
||||
dashWidth: 3,
|
||||
dashSpace: 3,
|
||||
paint: Paint()..color = Colors.grey,
|
||||
);
|
||||
}
|
||||
|
||||
if (displayMode == ChartDisplayMode.line ||
|
||||
displayMode == ChartDisplayMode.both) {
|
||||
drawer.drawcurveline(
|
||||
canvas,
|
||||
points,
|
||||
Paint()
|
||||
..color = Color(0xFF00C1AA)
|
||||
..strokeWidth = 1.5,
|
||||
);
|
||||
drawer.drawpoints(
|
||||
canvas,
|
||||
points,
|
||||
5,
|
||||
Paint()..color = Color(0Xff00C1AA),
|
||||
values: tips,
|
||||
);
|
||||
}
|
||||
|
||||
if (displayMode == ChartDisplayMode.bar ||
|
||||
displayMode == ChartDisplayMode.both) {
|
||||
for (var i = 0; i < points.length; i++) {
|
||||
final offset = points[i];
|
||||
// final color = (barColors != null && barColors!.length > i)
|
||||
// ? barColors![i]
|
||||
// : Colors.yellow.withAlpha(100 + i * 10); // 默认回退
|
||||
drawer.drawBar(
|
||||
canvas,
|
||||
Offset(offset.dx, 0),
|
||||
barWidth,
|
||||
offset.dy,
|
||||
|
||||
Paint()
|
||||
..color = barColors!.length == 0
|
||||
? Colors.white
|
||||
: stringToColor(barColors![i]),
|
||||
value: tips[i],
|
||||
);
|
||||
}
|
||||
}
|
||||
if ((displayMode == ChartDisplayMode.dualBar ||
|
||||
displayMode == ChartDisplayMode.both) &&
|
||||
dualBarPoints != null) {
|
||||
for (int i = 0; i < dualBarPoints!.length; i++) {
|
||||
final List<Offset> bar = dualBarPoints![i];
|
||||
if (bar.length < 3) continue;
|
||||
|
||||
final Offset deep = bar[0]; // 深睡:起点 -> deep.dy
|
||||
final Offset light = bar[1]; // 浅睡:起点 -> light.dy
|
||||
final Offset total = bar[2]; // 总睡眠:起点 -> total.dy
|
||||
|
||||
const String deepColor = "#21AD5D"; // 深睡
|
||||
const String lightColor = "#45D989"; // 浅睡
|
||||
const String remainColor = "#D3D3D3"; // 剩余
|
||||
|
||||
// 画深睡
|
||||
if (deep.dy > 0) {
|
||||
drawer.drawBar(
|
||||
canvas,
|
||||
Offset(deep.dx, 0),
|
||||
barWidth,
|
||||
deep.dy,
|
||||
value: tips[i],
|
||||
Paint()..color = stringToColor(deepColor),
|
||||
);
|
||||
}
|
||||
|
||||
// 画浅睡(从 deep.dy 开始)
|
||||
final double lightHeight = light.dy - deep.dy;
|
||||
if (lightHeight > 0) {
|
||||
drawer.drawBar(
|
||||
canvas,
|
||||
Offset(light.dx, deep.dy),
|
||||
barWidth,
|
||||
lightHeight,
|
||||
Paint()..color = stringToColor(lightColor),
|
||||
);
|
||||
}
|
||||
|
||||
// 判断是否需要画灰色剩余段和文字
|
||||
final double remainHeight = total.dy - light.dy;
|
||||
if (remainHeight > 0.01) {
|
||||
// 灰色部分
|
||||
drawer.drawBar(
|
||||
canvas,
|
||||
Offset(total.dx, light.dy),
|
||||
barWidth,
|
||||
remainHeight,
|
||||
Paint()
|
||||
..color = stringToColor(remainColor).withOpacity(0.8),
|
||||
);
|
||||
}
|
||||
// 若已满,不绘制灰色段、也不显示文字(不做任何处理)
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ class _EditBedPageState extends State<EditBedPage> {
|
||||
children: [
|
||||
// 中间居中的标题
|
||||
Text(
|
||||
'智能床名称',
|
||||
'智能设备名称',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
@@ -123,7 +123,7 @@ class _EditBedPageState extends State<EditBedPage> {
|
||||
textAlign: TextAlign.center,
|
||||
|
||||
decoration: InputDecoration(
|
||||
hintText: "请输入床的名称",
|
||||
hintText: "请输入设备的名称",
|
||||
contentPadding:
|
||||
const EdgeInsetsDirectional
|
||||
.fromSTEB(10, 0, 10, 0),
|
||||
|
||||
@@ -32,8 +32,8 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
|
||||
WebviewTestController() : super(WebviewTestModel()) {
|
||||
web = WebviewHelper(
|
||||
jsbridge: buildsdk(
|
||||
father: this,
|
||||
clientId: '494641114',
|
||||
// father: this,
|
||||
// clientId: '494641114',
|
||||
// dbgserverUrl: 'ws://192.168.1.2:9001',
|
||||
),
|
||||
settings: buildsettings(),
|
||||
|
||||
Reference in New Issue
Block a user