12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- import 'package:flutter/material.dart';
- import 'package:vitalapp/components/dialog_number.dart';
- import 'package:vitalapp/pages/check/widgets/exam_configurable/exam_card.dart';
- import 'package:vitalapp/pages/check/widgets/exam_configurable/exam_side_bar.dart';
- // ignore: must_be_immutable
- class ExamBloodOxygen extends StatefulWidget {
- ExamBloodOxygen({
- super.key,
- required this.currentValue,
- required this.bloodOxygenInput,
- });
- Map<String, dynamic> currentValue;
- Function(Map<String, dynamic>) bloodOxygenInput;
- @override
- State<ExamBloodOxygen> createState() => _ExamBloodOxygenState();
- }
- class _ExamBloodOxygenState extends State<ExamBloodOxygen> {
- late String pulse = widget.currentValue['Pulse_Frequency'] ?? '';
- late String spO2 = widget.currentValue['Spo2'] ?? '';
- @override
- void initState() {
- super.initState();
- }
- @override
- void dispose() {
- super.dispose();
- }
- @override
- Widget build(BuildContext context) {
- return Stack(
- children: [
- ExamCard(
- topPadding: 0,
- content: Column(
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- ExamSideBar(
- title: '血氧饱和度',
- value: widget.currentValue['Spo2'] ?? '',
- unit: '%',
- onTap: () => _inputSpo2("血氧饱和度"),
- ),
- const Divider(indent: 3),
- ExamSideBar(
- title: '脉率',
- value: widget.currentValue['Pulse_Frequency'] ?? '',
- unit: 'bpm',
- onTap: () => _inputPulseFrequency("脉率"),
- ),
- ],
- ),
- ),
- ],
- );
- }
- Future<void> _inputSpo2(String title) async {
- String? result = await VDialogNumber(
- title: title,
- initialValue: spO2,
- ).show();
- if (result?.isNotEmpty ?? false) {
- spO2 = result ?? '';
- widget.bloodOxygenInput.call({
- 'Spo2': spO2,
- 'Pulse_Frequency': pulse,
- });
- widget.currentValue = {
- 'Spo2': spO2,
- 'Pulse_Frequency': pulse,
- };
- }
- }
- Future<void> _inputPulseFrequency(String title) async {
- String? result = await VDialogNumber(
- title: title,
- initialValue: pulse,
- ).show();
- if (result?.isNotEmpty ?? false) {
- pulse = result ?? '';
- widget.bloodOxygenInput.call({
- 'Spo2': spO2,
- 'Pulse_Frequency': pulse,
- });
- widget.currentValue = {
- 'Spo2': spO2,
- 'Pulse_Frequency': pulse,
- };
- }
- }
- }
|