Flutter-如何在弹出菜单中添加关闭图标?
PopupMenuButton<String>(
child: SizedBox(
child: ....
),
onSelected: (value) {},
itemBuilder: (BuildContext context) {
///Add a close icon here (to the right) before rendering the list
return list!.map((notification) {
return custom_popup_menu.PopupMenuItem<String>(
value: someValue,
child: SizedBox(
child: Column(
children: [
const Divider(
thickness: 1,
color: CustomColor.blue_color,
),
Text(
'some text',
style: TextStyle(
fontWeight: (notification.readOn == null)
? FontWeight.w900
: FontWeight.normal,
),
),
],
),
),
);
}).toList();
},
),
PopupMenuButton<String>(
child: SizedBox(
child: ....
),
onSelected: (value) {},
itemBuilder: (BuildContext context) {
///Add a close icon here (to the right) before rendering the list
return list!.map((notification) {
return custom_popup_menu.PopupMenuItem<String>(
value: someValue,
child: SizedBox(
child: Column(
children: [
const Divider(
thickness: 1,
color: CustomColor.blue_color,
),
Text(
'some text',
style: TextStyle(
fontWeight: (notification.readOn == null)
? FontWeight.w900
: FontWeight.normal,
),
),
],
),
),
);
}).toList();
},
),
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在地图上使用Spreed操作员来列出并创建另一个内部列表,包括Close PopupMenuitem。
You can include use spreed operator on map to list and create another inner list including close PopupMenuItem.