Flutter 复选框列表平铺将选定值添加到其他列表

Flutter 复选框列表平铺将选定值添加到其他列表,flutter,Flutter,我有多项选择题,其中我必须选择多个答案,为此,我使用CheckBoxListTile,我可以在单个列表中添加选定值,但我想在不同列表中添加选定值,作为问题1在不同列表中的选定值和问题2在不同列表中的选定值,我认为您需要为不同的问题创建列表 例如: //Create your lists to store the answers in for your questions List<bool> question1Value = []; List<bool> question

我有多项选择题,其中我必须选择多个答案,为此,我使用CheckBoxListTile,我可以在单个列表中添加选定值,但我想在不同列表中添加选定值,作为问题1在不同列表中的选定值和问题2在不同列表中的选定值,我认为您需要为不同的问题创建列表

例如:

//Create your lists to store the answers in for your questions
List<bool> question1Value = [];
List<bool> question2Value = [];


CheckBoxListTile(
    title: Text("hello");
    onChanged(bool value) {
    // You can manipulate the data here in OnChanged
      question1Value.add(value);
      question2Value.add(value);
    }
  );
//创建列表以存储问题的答案
列出问题1value=[];
列出问题2value=[];
CheckBoxListTile(
标题:文本(“你好”);
一旦更改(布尔值){
//您可以在OnChanged中操作此处的数据
问题1价值。增加(价值);
问题2价值。增加(价值);
}
);

我希望这有助于为此,我认为您需要为不同的问题创建列表

例如:

//Create your lists to store the answers in for your questions
List<bool> question1Value = [];
List<bool> question2Value = [];


CheckBoxListTile(
    title: Text("hello");
    onChanged(bool value) {
    // You can manipulate the data here in OnChanged
      question1Value.add(value);
      question2Value.add(value);
    }
  );
//创建列表以存储问题的答案
列出问题1value=[];
列出问题2value=[];
CheckBoxListTile(
标题:文本(“你好”);
一旦更改(布尔值){
//您可以在OnChanged中操作此处的数据
问题1价值。增加(价值);
问题2价值。增加(价值);
}
);

我希望这有帮助请看一看问题指南以改进您的问题:请看一看问题指南以改进您的问题:我采用了这种方法,他正在为所选类别创建一个列表。我想要的是为所有问题创建不同的列表?你能帮我吗?我一直在遵循这个方法,这里他正在为所选类别创建一个列表。我想要的是为所有问题创建不同的列表?你能帮我吗?