我正在设计一个视频通话屏幕,我必须在孔屏幕之间管理 selfViewContainer。
在此屏幕上,我已经管理了水平对齐的大部分部分,但对于垂直对齐,它在带有凹口的设备中无法正常工作。
我想在拖动时从顶部起最小填充50
这是可拖动的橙色容器的代码
Widget _selfView() {
return Positioned(
top: _selfViewTop,
left: _selfViewLeft,
child: Draggable(
feedback: _draggableView(),
childWhenDragging: Container(),
child: _draggableView(),
onDragEnd: (dragDetail) {
var screenWidth = AspectSize.getScreenWidth(context: context);
var screenHeight = AspectSize.getScreenHeight(context: context);
_selfViewLeft = dragDetail.offset.dx;
_selfViewTop = dragDetail.offset.dy;
if (_selfViewLeft < (screenWidth / 2)) {
_selfViewLeft = 16.0;
} else if (_selfViewLeft > (screenWidth / 2)) {
_selfViewLeft = (screenWidth) - (_selfViewWidth + 16);
}
if (_selfViewLeft < 1.0) {
_selfViewLeft = 16.0;
} …Run Code Online (Sandbox Code Playgroud)