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 { 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( 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 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( TableInputDialog( tableDataConfig: tableDataConfig, title: '检验科-生化数据', ), ); // 如果不为空,print出来 if (result != null) { result.data.forEach((key, value) { print('$key: $value'); }); } else { print('已取消,无返回值'); } }, child: const Text('修改已有生化数据'), ), ], ), ), ), ); } }