本文最后更新于 79 天前,其中的信息可能已经有所发展或是发生改变。
Wrap是flutter里面的流排列组件,例如各大APP的搜索历史排列。
Wrap(
children: [
const Chip(label: Text("Chip")),
const SizedBox(width: 10),
const Chip(
label: Text("Chip"),
avatar: Icon(Icons.add),
),
const SizedBox(width: 10),
const Chip(
label: Text("Chip"),
avatar: CircleAvatar(
child: Text("A"),
),
),
const SizedBox(width: 10),
const Chip(
label: Text("Chip"),
avatar: CircleAvatar(
backgroundImage: NetworkImage(
"https://www.w3schools.com/w3images/avatar2.png"),
),
),
const SizedBox(width: 10),
Chip(
label: const Text("Chip"),
avatar: const CircleAvatar(
backgroundImage: NetworkImage(
"https://www.w3schools.com/w3images/avatar2.png"),
),
deleteIcon: const Icon(Icons.close),
onDeleted: () {
if (kDebugMode) {
print("Delete");
}
},
),
],
)
效果: