Files
ux/lib/src/core/widget.dart
agra d68a2978eb ux: bulk WIP — UxPlugin→XPlugin rename + new anim/core/navi/reactive packages
Catch-all commit for outstanding pre-existing local changes. Mixes
several themes that would normally be split:

- Rename: UxPlugin → XPlugin across iOS, macOS, Android registrants.
- New top-level packages under lib/src/: anim/ (animated values,
  panes, sheets, dock, measured), core/ (Emitter, ReactiveBuilder
  scaffolding, presenter/widget/value/dispose primitives), navi/
  (Screen/ScreenStack/Router/hero/transitions), reactive/.
- Edits across existing plugins (clipboard, crash, file, gallery,
  keyboard, scanner, sensor, url) to align with the new core.
- Test updates and CHANGELOG/README touches accompanying the above.
2026-05-21 08:58:07 +03:00

30 lines
832 B
Dart

import 'package:flutter/widgets.dart';
extension GlobalKeyExtension on GlobalKey {
Offset? get position {
final context = currentContext;
if (context == null) return null;
final box = context.findRenderObject() as RenderBox;
final pos = box.localToGlobal(Offset.zero);
return pos;
}
Size? get size {
final context = currentContext;
if (context == null) return null;
final box = context.findRenderObject() as RenderBox;
return box.size;
}
Rect? rect({Offset offset = Offset.zero}) {
final context = currentContext;
if (context == null) return null;
final box = context.findRenderObject() as RenderBox;
return box.localToGlobal(offset) & box.size;
}
}
extension SliverExtension on Widget {
Widget sliver({Key? key}) => SliverToBoxAdapter(key: key, child: this);
}