Skip to content

Commit

Permalink
Merge pull request #380 from hkaikai/fix/popup
Browse files Browse the repository at this point in the history
Fix/popup 修复点击蒙层关闭延迟问题
  • Loading branch information
Luozf12345 authored Dec 10, 2024
2 parents 5eb9045 + e801830 commit 7ed1942
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions tdesign-component/lib/src/components/popup/td_popup_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@ class TDSlidePopupRoute<T> extends PopupRoute<T> {

/// 键盘焦点对象的Y坐标
var _focusY = 0.0;

/// 键盘焦点对象的高度
var _focusHeight = 0.0;

/// 键盘出现后bottom的偏移量
var _lastBottom = 0.0;

Expand All @@ -109,21 +111,24 @@ class TDSlidePopupRoute<T> extends PopupRoute<T> {
if (!modalBarrierFull)
_getPositionWidget(
context,
Container(
color: _barrierColor.withAlpha((animValue * _barrierColor.alpha).toInt()),
child: GestureDetector(
onTap: () {
barrierClick?.call();
if (isDismissible) {
Navigator.pop(context);
}
},
onDoubleTap: () {
barrierClick?.call();
if (isDismissible) {
Navigator.pop(context);
}
},
IgnorePointer(
ignoring: true,
child: Container(
color: _barrierColor.withAlpha((animValue * _barrierColor.alpha).toInt()),
child: GestureDetector(
onTap: () {
barrierClick?.call();
if (isDismissible) {
Navigator.pop(context);
}
},
onDoubleTap: () {
barrierClick?.call();
if (isDismissible) {
Navigator.pop(context);
}
},
),
),
),
),
Expand Down Expand Up @@ -174,7 +179,6 @@ class TDSlidePopupRoute<T> extends PopupRoute<T> {
super.dispose();
}


/// 监听焦点变化
void startFocusListener(BuildContext context) {
FocusManager.instance.addListener(_handleFocusChange);
Expand All @@ -191,9 +195,7 @@ class TDSlidePopupRoute<T> extends PopupRoute<T> {
if (focusNode != null && focusNode.context != null) {
var renderObject = focusNode.context!.findRenderObject();
if (renderObject is RenderPointerListener) {
_focusY = renderObject
.localToGlobal(Offset.zero)
.dy;
_focusY = renderObject.localToGlobal(Offset.zero).dy;
_focusHeight = renderObject.size.height;
}
}
Expand Down

0 comments on commit 7ed1942

Please sign in to comment.