/// 领导展示(后面要删,莫名其妙的一堆演示) import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:vitalapp/architecture/utils/advance_debounce.dart'; import 'package:vitalapp/components/appbar.dart'; import 'package:vitalapp/components/button.dart'; import 'package:vitalapp/pages/medical/widgets/health_check/view.dart'; import 'package:vitalapp/pages/medical/widgets/urinalysis.dart'; import 'package:vnote_device_plugin/consts/types.dart'; import 'package:vitalapp/pages/medical/controller.dart'; import 'package:vitalapp/store/store.dart'; class UrineAnalysisCheck extends GetView { const UrineAnalysisCheck({super.key}); @override Widget build(BuildContext context) { controller.state.currentTab = DeviceTypes.URINE; return Scaffold( resizeToAvoidBottomInset: false, body: Container( height: double.maxFinite, color: Colors.white, child: HealthCheck( checkDialog: UrineAnalysisCheckDialog(), checkKey: "HEIUrinalysis", ), ), ); } } class UrineAnalysisCheckDialog extends GetView { @override Widget build(BuildContext context) { String name = ""; if (Get.arguments != null) { name = Get.arguments["name"] ?? ''; } return Scaffold( appBar: VAppBar( titleText: "体检尿常规", actions: [ if (name.isNotEmpty) Container( margin: EdgeInsets.only(right: 16), child: Text( name, style: TextStyle(fontSize: 25, color: Colors.white), ), ), ], ), body: Container( color: Colors.white, child: Stack( children: [ Row( children: [ _buildDeviceImage(DeviceTypes.URINE), _buildMedicalInput(DeviceTypes.URINE), ], ), Positioned( right: 16, bottom: 16, child: _buildSaveButton(), ), ], ), ), ); } Widget _buildDeviceImage(String? currentTab) { if (currentTab == DeviceTypes.TWELVEHEART) { return const SizedBox(); } return Expanded( flex: 7, child: Container( alignment: Alignment.topCenter, margin: const EdgeInsets.all(16).copyWith(top: 10), child: Obx( () => ClipRect( child: Align( alignment: Alignment.bottomCenter, heightFactor: 0.8, child: controller.state.currentTab != null ? Image.asset( _deviceImageUrl(controller.state.currentTab), height: double.infinity, fit: BoxFit.contain, // 设置图像的适应方式 ) : Container(), ), ), ), ), ); } Widget _buildSaveButton() { return Obx(() { if (Store.user.currentSelectRegisterPersonInfo == null) { return const SizedBox(); } return VButton( // backgroundColor: Theme.of(context).primaryColor, onTap: () { Debouncer.run( () => controller.createCheckup( Store.user.currentSelectRegisterPersonInfo?.physicalExamNumber ?? '', 'HEIUrinalysis', ), ); }, child: const SizedBox( width: 240, height: 60, child: Center( child: Text( '提交', style: TextStyle( fontSize: 26, color: Colors.white, ), ), ), ), ); }); } Widget _buildMedicalInput(String? currentTab) { String? examData; if (Get.arguments != null) { examData = Get.arguments["examData"] ?? ''; } return Expanded( flex: currentTab == DeviceTypes.TWELVEHEART ? 18 : 11, child: Stack( children: [ Container( padding: const EdgeInsets.all(16), child: Column( children: [ Urinalysis( examData: examData, ), ], ), ), ], ), ); } String _deviceImageUrl(String? currentTab) { switch (currentTab) { case DeviceTypes.TEMP: return 'assets/images/healthCheck/temp.png'; case DeviceTypes.SUGAR: return 'assets/images/healthCheck/sugar.png'; case DeviceTypes.NIBP: return 'assets/images/healthCheck/nibp.png'; case DeviceTypes.SPO2: return 'assets/images/healthCheck/spo2.png'; case DeviceTypes.WEIGHT: return 'assets/images/healthCheck/bmi.png'; case DeviceTypes.URINE: return 'assets/images/healthCheck/urine.png'; case DeviceTypes.WAIST: return 'assets/images/healthCheck/whb.png'; default: return 'assets/images/exam/normalMeasurementChart.png'; } } }