|
@@ -104,8 +104,7 @@ class CupertinoPopover extends StatefulWidget {
|
|
|
@required BuildContext context,
|
|
|
this.doubleAnimation,
|
|
|
this.radius=8.0}):super(){
|
|
|
- ScreenUtil.getInstance().init(context);
|
|
|
- BoxConstraints temp = null;
|
|
|
+ BoxConstraints temp;
|
|
|
if(constraints != null){
|
|
|
temp = BoxConstraints(maxHeight:123.0,maxWidth:150.0).copyWith(
|
|
|
minWidth: constraints.minWidth.isFinite?constraints.minWidth:null,
|
|
@@ -238,15 +237,15 @@ class _CupertionPopoverPositionRenderObject extends RenderShiftedBox{
|
|
|
Offset calcOffset(Size size){
|
|
|
double bodyLeft = 0.0;
|
|
|
|
|
|
- var isArrowUp = ScreenUtil.screenHeight > attachRect.bottom + size.height + CupertinoPopoverState._arrowHeight;
|
|
|
+ var isArrowUp = ScreenUtil.singleton.screenHeight > attachRect.bottom + size.height + CupertinoPopoverState._arrowHeight;
|
|
|
|
|
|
if(attachRect.left > size.width / 2 &&
|
|
|
- ScreenUtil.screenWidth - attachRect.right > size.width / 2){ //判断是否可以在中间
|
|
|
+ ScreenUtil.singleton.screenWidth - attachRect.right > size.width / 2){ //判断是否可以在中间
|
|
|
bodyLeft = attachRect.left + attachRect.width / 2 - size.width / 2;
|
|
|
}else if(attachRect.left < size.width / 2){ //靠左
|
|
|
bodyLeft = 10.0;
|
|
|
}else{ //靠右
|
|
|
- bodyLeft = ScreenUtil.screenWidth - 10.0 - size.width;
|
|
|
+ bodyLeft = ScreenUtil.singleton.screenWidth - 10.0 - size.width;
|
|
|
}
|
|
|
|
|
|
if(isArrowUp){
|
|
@@ -348,7 +347,7 @@ class _CupertionPopoverContextRenderObject extends RenderShiftedBox{
|
|
|
child.layout(childConstraints, parentUsesSize: true);
|
|
|
size = Size(child.size.width,child.size.height + CupertinoPopoverState._arrowHeight);
|
|
|
final BoxParentData childParentData = child.parentData;
|
|
|
- var isArrowUp = ScreenUtil.screenHeight > attachRect.bottom + size.height + CupertinoPopoverState._arrowHeight;
|
|
|
+ var isArrowUp = ScreenUtil.singleton.screenHeight > attachRect.bottom + size.height + CupertinoPopoverState._arrowHeight;
|
|
|
if(isArrowUp)
|
|
|
{
|
|
|
childParentData.offset = Offset(0.0, CupertinoPopoverState._arrowHeight);
|
|
@@ -360,7 +359,7 @@ class _CupertionPopoverContextRenderObject extends RenderShiftedBox{
|
|
|
// TODO: implement paint
|
|
|
Matrix4 transform = Matrix4.identity();
|
|
|
//
|
|
|
- var isArrowUp = ScreenUtil.screenHeight > attachRect.bottom + size.height + CupertinoPopoverState._arrowHeight;
|
|
|
+ var isArrowUp = ScreenUtil.singleton.screenHeight > attachRect.bottom + size.height + CupertinoPopoverState._arrowHeight;
|
|
|
|
|
|
var arrowLeft =attachRect.left + attachRect.width / 2 - CupertinoPopoverState._arrowWidth / 2 - offset.dx;
|
|
|
var translation = Offset(arrowLeft + CupertinoPopoverState._arrowWidth / 2,isArrowUp?0.0:size.height);
|