我正在使用新的材料树,并希望以OptionGroup的形式传递一系列自定义对象,这些对象包含一个标签属性,我需要使用LabelFunction来增强它,但是,这个特定的ty对联不接受任何值,只是希望输出一个字符串,我想,我需要一个示例,或者可能需要一个关于我的用法的正确检查。考虑到这个简单的类:
class pulsar {
String label = '';
String id = '';
pulsar();
}我想要创造:
final SelectionOptions pulsars = new SelectionOptions([
new OptionGroup.withLabelFunction(
[pulsar1, pulsar2, pulsar3],
(T) => labeler(T)
]);
// This is the problem, since the typedef String LabelFunction()
// Does not accept parameters.
// I will want this to work...
String labeler(pulsar p) => "${p.id} : ${p.label}";我想,我想知道我是不是错过了这个LabelFunction..的要点
发布于 2017-06-23 01:21:43
不过,我选择了ItemRenderer。
https://stackoverflow.com/questions/44711127
复制相似问题