|
@@ -9,6 +9,7 @@ import 'package:vitalapp/components/alert_dialog.dart';
|
|
|
import 'package:vitalapp/components/appbar.dart';
|
|
|
import 'package:vitalapp/components/button.dart';
|
|
|
import 'package:vitalapp/components/dialog_input.dart';
|
|
|
+import 'package:vitalapp/components/dialog_select.dart';
|
|
|
import 'package:vitalapp/components/dynamic_drawer.dart';
|
|
|
import 'package:vitalapp/consts/styles.dart';
|
|
|
import 'package:vitalapp/global.dart';
|
|
@@ -91,6 +92,18 @@ class _ConfigurableFormState extends State<TCMConstitutionModule> {
|
|
|
"Ping_Score": '平和质',
|
|
|
};
|
|
|
|
|
|
+ Map<String, dynamic> storeTypeMapDefaultTitle = {
|
|
|
+ "Qi_Score": [2, 3, 4, 14],
|
|
|
+ "Yang_Score": [11, 12, 13, 29],
|
|
|
+ "Yin_Score": [10, 21, 26, 31],
|
|
|
+ "Tan_Score": [9, 16, 28, 32],
|
|
|
+ "Shi_Score": [23, 25, 27, 30],
|
|
|
+ "Xue_Score": [19, 22, 24, 33],
|
|
|
+ "Qiyu_Score": [5, 6, 7, 8],
|
|
|
+ "Te_Score": [15, 17, 18, 20],
|
|
|
+ "Ping_Score": [1, 2, 4, 5, 13],
|
|
|
+ };
|
|
|
+
|
|
|
Map<String, String> typeMap = {
|
|
|
'Peaceful_Quality': "Ping_Score",
|
|
|
"Yang_Deficiency_Substance": "Yang_Score",
|
|
@@ -174,6 +187,53 @@ class _ConfigurableFormState extends State<TCMConstitutionModule> {
|
|
|
key: scaffoldKey,
|
|
|
appBar: VAppBar(
|
|
|
titleText: "中医体质",
|
|
|
+ actions: (currentTitleIndex == 0 && !isFirstEnter)
|
|
|
+ ? [
|
|
|
+ TextButton(
|
|
|
+ onPressed: () async {
|
|
|
+ final result = await VDialogSelect<String, String>(
|
|
|
+ title: "体质类型",
|
|
|
+ source: storeTypeList,
|
|
|
+ valueGetter: (data) => data,
|
|
|
+ labelGetter: (data) => storeTypeMap[data],
|
|
|
+ initialValue: formValue["PhysicalConclusion"],
|
|
|
+ ).show();
|
|
|
+ if (result != null) {
|
|
|
+ formValue["PhysicalConclusion"] = result;
|
|
|
+ if (result == "Ping_Score") {
|
|
|
+ for (var i = 1; i < 34; i++) {
|
|
|
+ if (i == 1) {
|
|
|
+ formValue["qusition$i"] = "5";
|
|
|
+ } else {
|
|
|
+ formValue["qusition$i"] = "1";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ for (var i = 1; i < 34; i++) {
|
|
|
+ var questions =
|
|
|
+ storeTypeMapDefaultTitle[result] as List<int>;
|
|
|
+ if (questions.contains(i)) {
|
|
|
+ formValue["qusition$i"] = "5";
|
|
|
+ } else {
|
|
|
+ formValue["qusition$i"] = "1";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (var currentFormObject
|
|
|
+ in currentTemplate[currentTitleIndex].children!) {
|
|
|
+ optionUpdate(currentFormObject,
|
|
|
+ formValue[currentFormObject.key]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ setState(() {});
|
|
|
+ },
|
|
|
+ child: Text(
|
|
|
+ "选择体质",
|
|
|
+ style: TextStyle(color: Colors.white),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ]
|
|
|
+ : null,
|
|
|
),
|
|
|
resizeToAvoidBottomInset: false,
|
|
|
body: (!widget.isEdit!) && isFirstEnter
|
|
@@ -856,7 +916,7 @@ class _ConfigurableFormState extends State<TCMConstitutionModule> {
|
|
|
bool is10 = true;
|
|
|
for (var e in storeTypeList) {
|
|
|
if (formValue[e] != null && e != 'Ping_Score') {
|
|
|
- var otherScore = formValue[e];
|
|
|
+ var otherScore = jsonDecode(formValue[e])["Value"];
|
|
|
if (otherScore > 8) {
|
|
|
if (is8) {
|
|
|
is8 = false;
|