如何将所选项目分配给类别,例如“饮料”或“UML”颤动中
用户可以在此应用程序中以单词形式输入,然后创建一个类别并将其分配给它。但我不知道如何分配。 我现在可以通过 ListTile 选择输入。
Container(
color: (_selectedItems.contains(index)) ? Colors.blue.withOpacity(0.5) : Colors.transparent,
//select and import to a category
child: ListTile(
onTap: (){
if(_selectedItems.contains(index)){
setState(() {
_selectedItems.removeWhere((val) => val == index);
});
}
},
onLongPress: (){
if(! _selectedItems.contains(index)){
setState(() {
_selectedItems.add(index);
});
}
},
title: _showWords(index),
),
);
User can make inputs as words in this app , and then create a category and assign it to it.But i don't know how it is possible to assign.
I can now select inputs by ListTile .
Container(
color: (_selectedItems.contains(index)) ? Colors.blue.withOpacity(0.5) : Colors.transparent,
//select and import to a category
child: ListTile(
onTap: (){
if(_selectedItems.contains(index)){
setState(() {
_selectedItems.removeWhere((val) => val == index);
});
}
},
onLongPress: (){
if(! _selectedItems.contains(index)){
setState(() {
_selectedItems.add(index);
});
}
},
title: _showWords(index),
),
);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用int id、字符串名称、列表单词等创建一个类别类别(当用户创建该类别的实例时,必须自动分配类别ID,当用户点击类别时,保存选择的类别ID,然后当用户想要时添加一个单词,只需在“words”参数中添加一个单词即可。
Create a class Category with int id, String name, List words e.t.c. (category id must be assign automatically when the user creates an instance of that category, when the user taps the category, save the choosen category id, then when the user wants to add a word, just add a word to the "words" parameter.