public void _updateTweenRects() { Rect childRect = _scale == null ? CupertinoContextMenuUtils._getRect(_childGlobalKey) : _getScaledRect(_childGlobalKey, _scale.Value); _rectTween.begin = _previousChildRect; _rectTween.end = childRect; Rect childRectOriginal = CupertinoContextMenuUtils.fromCenter( center: _previousChildRect.center, width: _previousChildRect.width / CupertinoContextMenuUtils._kOpenScale, height: _previousChildRect.height / CupertinoContextMenuUtils._kOpenScale ); Rect sheetRect = CupertinoContextMenuUtils._getRect(_sheetGlobalKey); Rect sheetRectBegin = _getSheetRectBegin( _lastOrientation, _contextMenuLocation, childRectOriginal, sheetRect ); _sheetRectTween.begin = sheetRectBegin; _sheetRectTween.end = sheetRect; _sheetScaleTween.begin = 0.0f; _sheetScaleTween.end = _scale; _rectTweenReverse.begin = childRectOriginal; _rectTweenReverse.end = childRect; }
public void _onTapDown(TapDownDetails details) { setState(() => { _childHidden = true; }); Rect childRect = CupertinoContextMenuUtils._getRect(_childGlobalKey); _decoyChildEndRect = CupertinoContextMenuUtils.fromCenter( center: childRect.center, width: childRect.width * CupertinoContextMenuUtils._kOpenScale, height: childRect.height * CupertinoContextMenuUtils._kOpenScale ); _lastOverlayEntry = new OverlayEntry( opaque: false, builder: (BuildContext context) => { return(new _DecoyChild( beginRect: childRect, child: widget.child, controller: _openController, endRect: _decoyChildEndRect )); } ); Overlay.of(context).insert(_lastOverlayEntry); _openController.forward(); }
public static Rect _getScaledRect(GlobalKey globalKey, float scale) { Rect childRect = CupertinoContextMenuUtils._getRect(globalKey); Size sizeScaled = childRect.size * scale; Offset offsetScaled = new Offset( childRect.left + (childRect.size.width - sizeScaled.width) / 2, childRect.top + (childRect.size.height - sizeScaled.height) / 2 ); return(offsetScaled & sizeScaled); }