gpt4 book ai didi

flutter - 如何在Flutter中对列表具有多个参数

转载 作者:行者123 更新时间:2023-12-03 03:22:48 25 4
gpt4 key购买 nike

我有一个返回ListTiles列表的函数。


List<ListTile> tinyImage = [];


List<ListTile> croppedImages() {
ListTile newImage =
ListTile(title: crop1 == null ? Text('No Image') : ListPart());
tinyImage.add(newImage);
return tinyImage;
}

但我希望此列表具有其他参数,例如Text,DrawerHeader和其他内容。喜欢,
List<ListTile, DrawerHeader> tinyImage = [];

我正在尝试创建一个抽屉。现在,我能够使用上述功能返回图像列表。我想添加一个目前无法实现的标题。请帮帮我。

最佳答案

您必须将列表类型设置为更通用的名称,例如Widget

List<Widget> items = [];
items.add(DrawerHeader());
items.add(ListTile());

关于flutter - 如何在Flutter中对列表具有多个参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61403059/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com