new questiontype star-rating #156
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was no star-rating feature. So I modified a copy of the choose image feature I tested for android (I did not test the key instead of url feature).
It is used like the choice image feature, for every choice there is an image for an active and not-active star. A function tests, which image should be displayed according to the selected item.
Because it is a derivate of choose image feature (no visual changes, but to display active or not-active picture) it should work on other devices as good as on android. You can use the starActive and starNotActive images in example to test it and for the offical example assets. These files are CC0 created by me with inkscape. What has to be done to get multilang-support: add new string to other "lang" json-files
Best regards
Tim Lutz, Tyrol
To test the new questiontype, just copy this to the LinearSurveyPage example: final imagesstars = [
RPStarChoice(
starActiveUrl: 'assets/images/starActive.png',
starNotActiveUrl:'assets/images/starNotActive.png' ,
value: -2,
description: '1 star',
),
RPStarChoice(
starActiveUrl: 'assets/images/starActive.png',
starNotActiveUrl: 'assets/images/starNotActive.png',
value: -1,
description: '2 stars',
),
RPStarChoice(
starActiveUrl: 'assets/images/starActive.png',
starNotActiveUrl: 'assets/images/starNotActive.png',
value: 0,
description: '3 stars',
),
RPStarChoice(
starActiveUrl: 'assets/images/starActive.png',
starNotActiveUrl: 'assets/images/starNotActive.png',
value: 1,
description: '4 stars',
),
RPStarChoice(
starActiveUrl: 'assets/images/starActive.png',
starNotActiveUrl: 'assets/images/starNotActive.png',
value: 2,
description: '5 stars',
),
];
final imageChoiceAnswerStars = RPStarChoiceAnswerFormat(choices: imagesstars);