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.
This commit is contained in:
29
lib/src/core/widget.dart
Normal file
29
lib/src/core/widget.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user