Android 颤振-弹出菜单按钮可根据压力效果定制
我有一个带有自定义Android 颤振-弹出菜单按钮可根据压力效果定制,android,ios,flutter,mobile,Android,Ios,Flutter,Mobile,我有一个带有自定义形状的弹出菜单按钮。当我按下按钮内的PopupMenuButton时,按下按钮的动画效果会溢出内容的形状,如下图所示: 形状的代码为: class CustomPopupMenuShape extends RoundedRectangleBorder { @override Path getOuterPath(Rect rect, {TextDirection textDirection}) { return Path() ..addRRect(B
形状的弹出菜单按钮
。当我按下按钮内的PopupMenuButton
时,按下按钮的动画效果会溢出内容的形状,如下图所示:
形状的代码为:
class CustomPopupMenuShape extends RoundedRectangleBorder {
@override
Path getOuterPath(Rect rect, {TextDirection textDirection}) {
return Path()
..addRRect(BorderRadius.all(Radius.circular(10))
.resolve(textDirection)
.toRRect(
Rect.fromLTWH(rect.left, rect.top, rect.width / 2, rect.height)));
}
}
我正在构建一个矩形,其宽度为上下文宽度的一半,边界半径为10。但正如您所看到的,效果宽度并不是除以2
我试图为和找到“effectShaepe”属性,但什么也没有得到
调用按钮的代码为:
Container(
child: PopupMenuButton(
elevation: 1,
shape: CustomPopupMenuShape(),
icon: Icon(FontAwesomeIcons.ellipsisH),
itemBuilder: (BuildContext context) => [
PopupMenuItem(child: Icon(Icons.bookmark)),
PopupMenuItem(child: Icon(Icons.add_shopping_cart))
],
),
margin: EdgeInsets.only(right: 10),
),
我可以做些什么来定制这种效果?你能分享一下按钮调用的代码吗?当然可以。我已经用代码片段编辑了这篇文章。你能分享一下按钮调用的代码吗?当然可以。我已经用这个片段在这篇文章中加了修饰。