Watch
1
0
Fork
You've already forked nexus
0
forked from Nexus/nexus

make user sheets popovers on desktop

This commit is contained in:
Henry Hiles 2026-10-15 10:25:20 -04:00
commit ce5c7b972b
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
6 changed files with 122 additions and 44 deletions

View file

@ -0,0 +1,15 @@
import "package:material_ui/material_ui.dart";
extension GlobalRect on BuildContext {
/// Where the widget this context belongs to is on screen, e.g. to open a
/// menu or popover next to it.
Rect get globalRect {
final overlay = Overlay.of(this).context.findRenderObject() as RenderBox;
return switch (findRenderObject()) {
final RenderBox box =>
box.localToGlobal(.zero, ancestor: overlay) & box.size,
_ => Rect.zero,
};
}
}