Skip to content

Conversation

@tim-lutz
Copy link

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);

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);
@tim-lutz
Copy link
Author

To view the example in LinearSurveyPage add "imageChoiceQuestionStepStars" to the steps section

@tim-lutz
Copy link
Author

To view the example add to LinearSurveyPage
final imageChoiceQuestionStepStars = RPQuestionStep(
identifier: "imageStepIDStars",
title: "Rate your experience.",
answerFormat: imageChoiceAnswerStars,
);

@tim-lutz
Copy link
Author

if that helps: the image files can also be shared with MIT license, if you used to do that.

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

Successfully merging this pull request may close these issues.

1 participant