使用 flutter survey_kit 时,我怎样才能完成 2 个不同的 CompletionSteps

When using flutter survey_kit, how can i finish with 2 different CompletionSteps

提问人:Felpower 提问时间:11/18/2023 更新时间:11/18/2023 访问量:12

问:

我使用 survey_kit 进行了调查,如果用户在某个问题上输入他已<18 岁,我会将他转发到 CompletionStep id:11,如果不是,他会正常继续提问,当他在第二个 CompletionStep id:10 时,我希望他完成问卷,我怎样才能为他添加一个导航步骤来跳过 CompletionStep id:11 在这里,你可以看到我的第一个竞争步骤,我想跳到它来完成调查

CompletionStep(
          stepIdentifier: StepIdentifier(id: '10'),
          text: 'Danke für die Teilnahme an der Umfrage, und viel Spaß beim Spielen',
          title: 'Fertig!',
          buttonText: 'Umfrage beenden',
        );
task.addNavigationRule(
      forTriggerStepIdentifier: getStepIdentifier(task, "1"),
      navigationRule: ConditionalNavigationRule(
        resultToStepIdentifierMapper: (input) {
          int age = int.parse(input!);
          if (age < 18) {
            return getStepIdentifier(task, "11");
          } else {
            return getStepIdentifier(task, "2");
          }
        },
      ),
    );

我想要这样的东西:

task.addNavigationRule(
        forTriggerStepIdentifier: getStepIdentifier(task, "10"),
        navigationRule: DirectNavigationRule("Finish Survey"));
颤振 飞镖 调查

评论


答: 暂无答案