-
Notifications
You must be signed in to change notification settings - Fork 445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: ⚡ Optimize GetPosition
class
#370
Conversation
lib/src/get_position.dart
Outdated
|
||
void getRenderBox() { | ||
var renderBox = key.currentContext?.findRenderObject() as RenderBox?; | ||
if (renderBox != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please invert the condition and return.
lib/src/get_position.dart
Outdated
Rect getRect() { | ||
if (_box == null || | ||
_boxOffset == null || | ||
(_boxOffset?.dx.isNaN ?? true) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please create an extension for this.
lib/src/get_position.dart
Outdated
if (boxOffset.dy.isNaN) return 0 - padding.top; | ||
final topLeft = box.size.topLeft(boxOffset); | ||
if (_box == null || _boxOffset == null || (_boxOffset?.dy.isNaN ?? true)) { | ||
return 0 - padding.top; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you can skip subtracting from 0 and directly assign negative sign here.
36ea121
to
2f9ab68
Compare
2f9ab68
to
1edfcf9
Compare
When will this be released? I need the fix and therefore have to use master right now, it would be nice to be able to switch back to the pub version. |
Hey @guenth39, We would like to inform that we have released this commit with 2.1.0 version of this package. |
Description
Reduced call for render object. Improved conditions.
Checklist
fix:
,feat:
,docs:
etc).docs
and added dartdoc comments with///
.examples
ordocs
.Breaking Change?
Related Issues
None.