123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- import 'dart:math';
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- import 'package:vitalapp/pages/medical/controller.dart';
- import 'package:vitalapp/pages/medical/views/table_input_dialog/index.dart';
- import 'table_input_dialog/mock_data.dart';
- class BiochemistryTest extends GetView<MedicalController> {
- const BiochemistryTest({super.key});
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- resizeToAvoidBottomInset: false,
- body: Container(
- height: double.maxFinite,
- color: Colors.white,
- child: Center(
- // FIXME 示例代码
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- ElevatedButton(
- onPressed: () async {
- TableInputResult? result = await Get.dialog<TableInputResult>(
- TableInputDialog(
- tableDataConfig: MockData.mockBiochemistryTestData,
- title: '检验科-生化数据',
- ),
- );
- // 如果不为空,print出来
- if (result != null) {
- result.data.forEach((key, value) {
- print('$key: $value');
- });
- } else {
- print('已取消,无返回值');
- }
- },
- child: const Text('填写生化数据'),
- ),
- SizedBox(height: 20),
- ElevatedButton(
- onPressed: () async {
- List<TableElementConfig> tableDataConfig = [];
- MockData.mockBiochemistryTestData.forEach((element) {
- tableDataConfig.add(
- TableElementConfig(
- id: element.id,
- unit: element.unit,
- name: element.name,
- initValue: Random().nextDouble().toStringAsFixed(2),
- ),
- );
- });
- TableInputResult? result = await Get.dialog<TableInputResult>(
- TableInputDialog(
- tableDataConfig: tableDataConfig,
- title: '检验科-生化数据',
- ),
- );
- // 如果不为空,print出来
- if (result != null) {
- result.data.forEach((key, value) {
- print('$key: $value');
- });
- } else {
- print('已取消,无返回值');
- }
- },
- child: const Text('修改已有生化数据'),
- ),
- ],
- ),
- ),
- ),
- );
- }
- }
|