gpt4 book ai didi

flutter - 如何在Flutter中为PopupMenu添加圆形边框?

转载 作者:行者123 更新时间:2023-12-03 02:47:13 44 4
gpt4 key购买 nike

有什么办法可以创建带有圆形边框的自定义弹出窗口?
这是我当前的代码和设计:

                child: Container(
child: PopupMenuButton(
onSelected: _savedLocationOptionSelected,
itemBuilder: (context) {
return SavedLocationOptions.choises.map((value) {
return PopupMenuItem<String>(
value: value,
child: Text(value),
);
}).toList();
},
icon: Icon(
Icons.more_vert,
color: Colors.grey[300],
),
),
),

enter image description here

最佳答案

您只需在PopupMenuButton上添加这样的内容shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(20.0))),例子

   PopupMenuButton(
child: Text("Show Popup Menu"),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(15.0))
),
itemBuilder: (context) => [
PopupMenuItem(
child: Text("pub.dev"),
),
PopupMenuItem(
child: Text("Flutter"),
),
PopupMenuItem(
child: Text("Google.com"),
),
PopupMenuItem(
child: Text("https://blogdeveloperspot.blogspot.com"),
),
],
),

关于flutter - 如何在Flutter中为PopupMenu添加圆形边框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56639595/

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