mirror of
https://github.com/gskinnerTeam/flutter-wonderous-app.git
synced 2025-06-14 23:08:49 +08:00
Initial public commit
This commit is contained in:
19
lib/ui/common/utils/context_utils.dart
Normal file
19
lib/ui/common/utils/context_utils.dart
Normal file
@ -0,0 +1,19 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ContextUtils {
|
||||
static Offset? getGlobalPos(BuildContext context, [Offset offset = Offset.zero]) {
|
||||
final rb = context.findRenderObject() as RenderBox?;
|
||||
if (rb?.hasSize == true) {
|
||||
return rb?.localToGlobal(offset);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static Size? getSize(BuildContext context) {
|
||||
final rb = context.findRenderObject() as RenderBox?;
|
||||
if (rb?.hasSize == true) {
|
||||
return rb?.size;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user