pile_nav_new/lib/pages/dataAndDevice/real_data.dart

164 lines
5.6 KiB
Dart
Raw Permalink Normal View History

2024-11-20 19:42:10 +08:00
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import '../../service/pile/device_type.dart';
import '../../service/pile/input.dart';
import '../../service/pile/public_widget.dart';
import '../aim_point/aimpoint_page.dart';
import 'controller.dart';
class RealDataContainer extends StatelessWidget {
2024-11-21 10:10:51 +08:00
final RealDataController controller = Get.find<RealDataController>();
2024-11-21 10:01:14 +08:00
2024-11-20 19:42:10 +08:00
@override
Widget build(BuildContext context) {
2024-11-21 10:01:14 +08:00
final size = MediaQuery.of(context).size;
double rectWidth = size.width;
2024-11-20 19:42:10 +08:00
return Container(
child: Stack(
children: [
RealDataVIew(),
Positioned(
2024-11-21 10:01:14 +08:00
bottom: 120, // 根据需要调整位置
2024-11-20 19:42:10 +08:00
left: 5, // 根据需要调整位置
child: Container(
decoration: const BoxDecoration(color: Colors.transparent),
child: Stack(children: [
Card(
color: Colors.transparent,
elevation: 0,
2024-11-21 10:01:14 +08:00
child: AimPointer(size: Size(250, 250)),
2024-11-20 19:42:10 +08:00
),
]))),
2024-11-21 10:01:14 +08:00
Positioned(
bottom: 30,
left: 35,
2024-11-21 10:10:51 +08:00
child: Obx(() => ElevatedButton(
style: ButtonStyle(
fixedSize: MaterialStateProperty.all(Size(200, 70)),
backgroundColor: MaterialStateProperty.all(
const Color.fromARGB(255, 226, 220, 220),
),
),
child: Text(
controller.isClicked.value ? ' 暂停 ' : ' 开始 ',
style: TextStyle(
fontSize: 28,
color: controller.isClicked.value
? Colors.red
: Colors.green,
),
),
onPressed: () {
controller.isClicked.value = !controller.isClicked.value;
},
)),
),
2024-11-20 19:42:10 +08:00
],
),
);
}
}
class RealDataVIew extends GetView<RealDataController> {
RealDataVIew({super.key});
final PlumRealDataController plumDataController =
Get.find<PlumRealDataController>();
@override
Widget build(BuildContext context) {
double fontSize = 16;
DeviceType deviceType = getDeviceType(context);
if (deviceType == DeviceType.mobile) {
fontSize = 16;
} else {
fontSize = 20;
}
return Container(
clipBehavior: Clip.hardEdge,
alignment: Alignment.centerLeft,
// height: 130,
padding: const EdgeInsets.symmetric(horizontal: 5),
decoration:
BoxDecoration(border: Border.all(color: Colors.black, width: 1)),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
// Stack(children: [
// Positioned(
// width: 20,
// height: 20,
// child: Card(
// color: Colors.transparent,
// elevation: 5.0,
// child:
// ),
// )
// ]),
const SizedBox(
height: 20,
),
Wrap(
children: [
Obx(() => Text(
DateFormat('yy-MM-dd HH:mm:ss').format(controller.time.value),
style: const TextStyle(fontSize: 20, height: 2),
)),
],
),
SingleChildScrollView(
child: Theme(
data: ThemeData(
textTheme: TextTheme(
titleLarge: TextStyle(
fontSize: fontSize,
fontWeight: FontWeight.normal,
),
)),
child: Obx(() => Wrap(
children: [
// Text(
// '工作区域:$txt ',
// style: textStyle,
// ),
// Text(
// '工作层级:$txt ',
// style: textStyle,
// ),
Text(
'设备编号:${controller.tid.value} ',
style: Theme.of(context).textTheme.titleLarge,
),
Text(
2024-11-21 10:01:14 +08:00
// '桩点名称:${controller.name.value} ',
2024-11-20 19:42:10 +08:00
'桩点名称:${controller.name.value} ',
style: Theme.of(context).textTheme.titleLarge,
),
Text(
2024-11-21 10:01:14 +08:00
// '夯沉量:${controller.sid.value} ',
'桩深:${controller.sid.value} ',
style: Theme.of(context).textTheme.titleLarge,
),
Text(
// '次:${controller.times.value} ',
'垂直度:${controller.times.value} ',
style: Theme.of(context).textTheme.titleLarge,
),
Text(
// '次:${controller.times.value} ',
'电流:${controller.times.value} ',
2024-11-20 19:42:10 +08:00
style: Theme.of(context).textTheme.titleLarge,
),
Text(
2024-11-21 10:01:14 +08:00
// '次:${controller.times.value} ',
'灌注量:${controller.times.value} ',
2024-11-20 19:42:10 +08:00
style: Theme.of(context).textTheme.titleLarge,
),
],
))),
),
]),
);
}
}