This commit is contained in:
2026-07-12 04:33:48 +08:00
parent f8a90ad305
commit e7ce0f7bae
151 changed files with 2765 additions and 2947 deletions

View File

@@ -10,15 +10,15 @@ class PopupAnimationWidget extends AnimatedWidget {
final Animation<double> animation;
PopupAnimationWidget({
@required this.animation,
@required this.stackKey,
@required this.startKey,
@required this.child,
required this.animation,
required this.stackKey,
required this.startKey,
required this.child,
this.color = Colors.yellow,
this.popupOffset = Offset.zero,
}) : super(listenable: animation);
Offset _startOffset;
Offset _startOffset = Offset.zero;
Offset _offset = Offset.zero;
@override
@@ -49,11 +49,11 @@ class PopupAnimationWidget extends AnimatedWidget {
void _calAnimation() {
if (_startOffset == null) {
final RenderBox stackBox = stackKey.currentContext.findRenderObject();
final RenderBox stackBox = stackKey.currentContext?.findRenderObject() as RenderBox;
final Offset stackBoxOffset = stackBox.globalToLocal(Offset.zero);
final EdgeInsets startMargin = _margin(startKey);
final RenderBox startBox = startKey.currentContext.findRenderObject();
final RenderBox startBox = startKey.currentContext?.findRenderObject() as RenderBox;
_startOffset = startBox.localToGlobal(Offset(
startMargin.left + popupOffset.dx,
@@ -62,9 +62,9 @@ class PopupAnimationWidget extends AnimatedWidget {
}
EdgeInsets _margin(GlobalKey key) {
final Widget widget = key.currentContext.widget;
final Widget widget = key.currentContext!.widget;
final EdgeInsets margin =
(widget is Container) ? widget.margin : EdgeInsets.zero;
(widget is Container) ? widget.margin as EdgeInsets : EdgeInsets.zero;
return margin ?? EdgeInsets.zero;
}
}