goxiaoy / flutter_survey_js

Flutter client library for parsing and display surveyjs.io survey
https://goxiaoy.github.io/flutter_survey_js/
MIT License
15 stars 15 forks source link

Checkbox's "other" `CheckboxListTile` is initially unchecked when "other" value is selected and `SurveyWidget` is built with a `builder` #120

Closed ChopinDavid closed 8 months ago

ChopinDavid commented 8 months ago

Describe the bug Whenever you are creating your survey using SurveyWidget with a builder specified, the "other" Checkbox's CheckboxListTile is not initially "checked".

To Reproduce SurveyJs json

{
  "title": "",
  "elements": [
    {
      "type": "checkbox",
      "name": "Dietary Restrictions",
      "title": "Do you have any dietary restrictions?",
      "choices": [
        {
          "value": "gluten-free",
          "text": "Gluten-free"
        },
        {
          "value": "halal",
          "text": "Halal"
        },
        {
          "value": "vegan",
          "text": "Vegan"
        },
        {
          "value": "vegetarian",
          "text": "Vegetarian"
        }
      ],
      "showOtherItem": true,
      "otherText": "Food Allergy"
    }
  ]
}

SurveyJs answer

{
    "Dietary Restrictions-Comment":  "tree nuts",
    "Dietary Restrictions":  [
        "other"
    ]
}

Expected behavior The "other" CheckboxListTile is initially "checked".

Screenshots

https://github.com/goxiaoy/flutter_survey_js/assets/27712906/3ee527d3-6fe6-4bff-9f21-6f1217614a08