Help Needed: Setting Values and Calculating Results for Quiz App in FlutterFlow

Actions & Logic

Hi everyone,

I’m working on a quiz app in FlutterFlow and need some guidance on setting up values for options and calculating results based on user selections. Here’s what I’ve done so far and what I’m trying to achieve:

  1. Quiz Structure:

    • The quiz has 10 questions.

    • Each question has 5 options: Rarely (Up to 20%), Sometimes (21 – 40%), Frequently (41 – 60%), Mostly (61– 80%), Always (81 - 100%).

  2. Objective:

    • Assign numerical values to each option:

      • Rarely: 1

      • Sometimes: 2

      • Frequently: 3

      • Mostly: 4

      • Always: 5

    • Store the selected values for each question.

    • Calculate the total score based on the selected values.

    • Determine user behavior based on the total score.

  3. Current Setup:

    • Using containers for options instead of dropdowns or radio buttons.

    • Created an App State variable selectedValues of type List<int> to store selected values.

  4. Challenges:

    • How to dynamically assign and store values for each option using containers.

    • How to calculate the total score and determine user behavior based on the score.

Questions:

  1. How can I dynamically assign and store values for each option using containers?

  2. Is there a better way to calculate the total score and determine user behavior in FlutterFlow?

Any help or suggestions would be greatly appreciated!

What have you tried so far?

Steps Taken:

  1. Created App State variable selectedValues to store selected values.

  2. Set up containers for each option and assigned values (1 to 5).

  3. Added On Tap actions to each container to update the selectedValues list with the selected value.

  4. Created a function to calculate the total score and determine user behavior.

***Please let me know if I am doing something wrong here*** or is there any other why of doing this.

Did you check FlutterFlow's Documentation for this topic?
No