123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- import 'package:vitalapp/architecture/utils/advance_debounce.dart';
- import 'index.dart';
- class TwelveEcgView extends GetView<TwelveEcgViewController> {
- const TwelveEcgView({
- Key? key,
- required this.width,
- required this.height,
- required this.initData,
- required this.currentIndex,
- required this.isConclusion,
- }) : super(key: key);
- final double width;
- final double height;
- final List<int> initData;
- final int currentIndex;
- final bool isConclusion;
- // 主视图
- Widget _buildView() {
- return Center(
- child: ClipRect(
- child: RepaintBoundary(
- child: CustomPaint(
- foregroundPainter: EcgPainter(
- newPoints: controller.newPointsToDraw,
- oldPoints: controller.oldPointsToDraw,
- xDataCount: controller.xDataCount,
- yMaxList: controller.yMaxList,
- isInitPoints: controller.isInitPoints,
- ),
- painter: GridBackgroundPainter(10 * 25),
- size: Size(width, height),
- ),
- ),
- ),
- );
- }
- @override
- Widget build(BuildContext context) {
- return GetBuilder<TwelveEcgViewController>(
- init: TwelveEcgViewController(
- initPoints: initData,
- ),
- id: "twelve_ecg_view",
- builder: (_) {
- return GestureDetector(
- onTap: () {
- if (isConclusion) {
- Debouncer.run(
- controller.openFullScreenDialog,
- );
- }
- },
- child: Center(
- child: _buildView(),
- ),
- );
- },
- );
- }
- }
|