Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

offset is wrong when arrow down #6

Closed
nicorobine opened this issue Oct 14, 2019 · 3 comments
Closed

offset is wrong when arrow down #6

nicorobine opened this issue Oct 14, 2019 · 3 comments

Comments

@nicorobine
Copy link
Contributor

fixed:

Offset _calculateOffset(BuildContext context) {
double dx = _showRect.left + _showRect.width / 2.0 - menuWidth() / 2.0;
if (dx < 10.0) {
dx = 10.0;
}

double dy = _showRect.top - menuHeight();
if (dy <= MediaQuery.of(context).padding.top + 10) {
  // The have not enough space above, show menu under the widget.
  dy = arrowHeight + _showRect.height + _showRect.top;
  _isDown = false;
} else {
  /// #######需要加上这行代码,修复三角形的高度
  dy -= arrowHeight; 
  _isDown = true;
}

return Offset(dx, dy);

}

@chinabrant
Copy link
Owner

可以给个图片吗?我没有复现你说的offset错误。

@nicorobine
Copy link
Contributor Author

可以给个图片吗?我没有复现你说的offset错误。

现在不方便截图了,我现在用的是fork后修改的版本,如果三角形箭头朝下的话,三角形会插入到context对应的上下文里面,菜单的下边会与对应的widget的上边重叠,你看一下高度计算的方法,箭头向上的时候加上了三角形的高度,向下的时候就没有加上三角形的高度

其实还发现了两个bug,一个是,如果想要弹出的widget在屏幕右侧,这时候弹出的菜单会超出屏幕边界,我在自己fork里面修改了。另一个是dismiss的时候会触发assert错误

@chinabrant
Copy link
Owner

已经合了你的pr了。我自己测试菜单显示在widget的下方的时候,箭头是正常的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants