【发布时间】:2021-07-12 18:16:11
【问题描述】:
我想在flutter中改变我的PopupMenuButton的形状,想在顶部添加一个三角形,如下图所示,我在google上花了很多时间但没有成就请帮助我我是flutter的新手所以我不知道如何更改这个默认容器,现在它只有白色圆形容器,没有在它上面添加白色箭头/三角形。请帮忙,提前谢谢
popUpMenu= PopupMenuButton<String>(
key: _menuKey,
offset: Offset(50,100),
padding: EdgeInsets.all(0.0),
onSelected: (value) {
if (value == "Tax & Additional Charges") {
endDrawerController.drawerKey.value =
EndDrawerKeys.TaxAndAdditionalChargesEndDrawer;
endDrawerController.scaffoldKey.currentState.openEndDrawer();
print("Entering in tax");
} else if (value == "Hold this Invoice") {
endDrawerController.drawerKey.value =
EndDrawerKeys.HoldInvoiceEndDrawer;
endDrawerController.scaffoldKey.currentState.openEndDrawer();
}
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(10.h))),
itemBuilder: (context) => [
PopupMenuItem(
value: "Tax & Additional Charges",
child: popUpMenuSingleItem(
icon: AppAssets.DeliveryIcon,
text: "Tax & Additional Charges",
topMargin: 15.h),
),
PopupMenuItem(
value: "Hold this Invoice",
child: popUpMenuSingleItem(
icon: AppAssets.DeliveryIcon,
text: "Hold this Invoice",
topMargin: 25.h),
),
],
);
这就是我希望我的 PopupMenuButton 出现的方式
【问题讨论】:
-
你看过CustomPaint吗?
-
是的,我有,我通过 CustomPaint 创建了三角形,但不知道如何包裹在 PopupMenuButton 容器周围,我将它包裹在 PopupMenuButton 周围一次,但是在 appbar 中的 PopupMenu 选项按钮上添加了三角形我不想要,我想在 PopupMenuButton 容器周围添加三角形,如上图所示
标签: flutter customization shapes triangle popupmenubutton