You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The idea behind the "form" is to be able to configure what questions the person using the app will be asked when scouting. It's easier to receive this data from a central point (the server), interpret it, and then display it than it is to have to re-program the app every year.
Currently, when syncing, the server sends over a ScoutForm object, which can be imported from package:scoutingapp/components/common/form.dart, which contains objects that look like this:
InputType (enum)
- boolean: A yes or no, true or false input
- multiselect: A multiselect input, like a dropdown. Each option is a SelectOption
- text: A regular text input
- number: A number input box
SelectOption
- value: Value of the option, what is actually read and stored in the scout data
- label: Display value, what can be show in the app. Can be different or the same
Question
- id: ID for the question, which will be used to store the data. Should be unique.
- title: Title of the question, for example: "How many balls did they make in the upper hub?" (or something shorter, like "Upper hub")
- type: One of InputType. enums are used by doing InputType.<value>, for example: InputType.boolean
- options (optional): A list of SelectOptions. This only needs to be used if using InputType.multiselect
ScoutForm
- id: ID of the form, used to fetch it. Should be unique.
- name: Name of the form, can be used as a title
- questions: List of Question objects
The form will be recieved by the app as a ScoutForm object, meaning that to display the form, you need to loop over the questions attribute, and create an input on the app based off the values in each Question. Something similar to this.
You can use the below code to create a ScoutForm to test from, or you can feel free to write your own test.
ScoutForm form =ScoutForm(id:'testform', name:'Test Form', questions: [
Question(id:"yn", title:"Yes or no question", type:InputType.boolean),
Question(id:"multi", title:"Multi-select question", type:InputType.multiselect, options: [
SelectOption(value:"1", label:"Option 1"),
SelectOption(value:"2", label:"Option 2"),
SelectOption(value:"3", label:"Option 3"),
]),
Question(id:"text", title:"Text question", type:InputType.text),
Question(id:"num", title:"Number question", type:InputType.number),
]);
// Can do something like this to loop over the questions
form.questions.map((e) => {...})
The idea behind the "form" is to be able to configure what questions the person using the app will be asked when scouting. It's easier to receive this data from a central point (the server), interpret it, and then display it than it is to have to re-program the app every year.
Currently, when syncing, the server sends over a
ScoutForm
object, which can be imported frompackage:scoutingapp/components/common/form.dart
, which contains objects that look like this:The form will be recieved by the app as a
ScoutForm
object, meaning that to display the form, you need to loop over thequestions
attribute, and create an input on the app based off the values in eachQuestion
. Something similar to this.You can use the below code to create a
ScoutForm
to test from, or you can feel free to write your own test.ScoutForm and other objects: form.dart
The text was updated successfully, but these errors were encountered: