Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/119.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 颤振-弹出菜单按钮可根据压力效果定制_Android_Ios_Flutter_Mobile - Fatal编程技术网

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),
                  ),

我可以做些什么来定制这种效果?

你能分享一下按钮调用的代码吗?当然可以。我已经用代码片段编辑了这篇文章。你能分享一下按钮调用的代码吗?当然可以。我已经用这个片段在这篇文章中加了修饰。