Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot make a question mandatory (not optional) - also no back button #107

Open
appliedrd opened this issue Mar 27, 2024 · 6 comments
Open

Comments

@appliedrd
Copy link
Contributor

example.
Next button starts grey, then goes active within 1 second.
Doesnt matter if optional: false, or commented out
For now, I have reverted back to https://github.com/appliedrd/research.package.git branch: realign

List likert7PointAgreeChoices = [
RPChoice(text: "Strongly disagree", value: 1),
RPChoice(text: "Disagree", value: 2),
RPChoice(text: "Somewhat disagree", value: 3),
RPChoice(text: "Neither agree or disagree ", value: 4),
RPChoice(text: "Somewhat agree", value: 5),
RPChoice(text: "Agree", value: 6),
RPChoice(text: "Strongly agree", value: 7),
];

RPChoiceAnswerFormat likert7PointAgreeChoicesAnswerFormat = RPChoiceAnswerFormat(
answerStyle: RPChoiceAnswerStyle.SingleChoice,
choices: likert7PointAgreeChoices,
);

RPQuestionStep s2_1 = RPQuestionStep(
identifier: "s2_1",
title: "1. Overall, the workshop was easy to understand.",
// optional: false,
answerFormat: likert7PointAgreeChoicesAnswerFormat);

@appliedrd
Copy link
Contributor Author

also no back button

@appliedrd appliedrd changed the title cannot make a question mandatory (not optional) cannot make a question mandatory (not optional) - also no back button Mar 27, 2024
@mario-bermonti
Copy link
Contributor

I can confirm this. I am on version "1.5.0" of the research_package.

Is this the intended use of the optional parameter when creating RPQuestionSteps? I was reviewing the code and am not clear anymore. Setting optional to true adds a button to skip the question (first code chunk below). This button calls the skipQuestion, which sets the result to null and continues to the next step (second code chunk below). However, none of this code disables the "next button".

// question_step.dart

widget.step.optional
    ? TextButton(
        onPressed: () => skipQuestion(),
        child: Text(locale?.translate("Skip this question") ??
            "Skip this question"),
      )
    : Container(),
// question_step.dart

  void skipQuestion() {
    timer?.cancel();

    FocusManager.instance.primaryFocus?.unfocus();
    blocTask.sendStatus(RPStepStatus.Skipped);
    currentQuestionBodyResult = null;
  }

@mario-bermonti
Copy link
Contributor

I was able to figure out the reason why the next button appears after one second and was able to fix it in my fork of the research_package (see changes).

I am happy to submit a pull request, but want to make sure this is the intended use first. Could any one confirm?

@mario-bermonti
Copy link
Contributor

Could I get your input on this, @bardram?

@bardram
Copy link
Contributor

bardram commented Jan 6, 2025

Sorry @mario-bermonti - I wasn't following this package closely, so didn't see your comments. But if the small change above fixes the problem, please make a PR on the current master branch and I can take a look.

@mario-bermonti
Copy link
Contributor

Great! It is a little busy for me right now because the semester just started, but I will submit a PR soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants