Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Add Rect.fromCenter() constructor#8716

Merged
tvolkert merged 6 commits intoflutter:masterfrom
tvolkert:fromCenter
Apr 25, 2019
Merged

Add Rect.fromCenter() constructor#8716
tvolkert merged 6 commits intoflutter:masterfrom
tvolkert:fromCenter

Conversation

@tvolkert
Copy link
Contributor

No description provided.

Copy link
Contributor

@jamesderlin jamesderlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why it can't be const? (Rect.fromCircle and from Rect.fromPoints are also not const.) Maybe also consider if Rect.fromCircle should now delegate to Rect.fromCenter?

@tvolkert
Copy link
Contributor Author

Is there a reason why it can't be const?

Because they refer to dx and dy of the offset, which excludes them from being const since those fields are getters.

I updated Rect.fromCircle to delegate to Rect.fromCenter.

PTAL

@jamesderlin
Copy link
Contributor

Is there a reason why it can't be const?

Because they refer to dx and dy of the offset, which excludes them from being const since those fields are getters.

Ah. It is unintuitive that getters on an immutable object that has a const constructor can't propagate const-ness. =( (Do you know why are Offset.dx/dy are getters instead of just being final members?)

LGTM.

@jonahwilliams
Copy link
Contributor

Both fields and getters are virtual in Dart, it would make no difference anyway

Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests?

@tvolkert
Copy link
Contributor Author

Tests?

Done

Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now we'll need to add an implementation of this constructor to stub_ui or framework code which uses it will fail to compile with dart2js

Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM stamp from a Japanese personal seal

@cbracken
Copy link
Member

Please wait until internal embedders have been updated before making use of this in framework code.

@tvolkert tvolkert merged commit 0c9c293 into flutter:master Apr 25, 2019
@tvolkert tvolkert deleted the fromCenter branch April 25, 2019 21:40
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 25, 2019
engine-flutter-autoroll added a commit to flutter/flutter that referenced this pull request Apr 25, 2019
flutter/engine@7471dde...0c9c293

git log 7471dde..0c9c293 --no-merges --oneline
0c9c293 Add Rect.fromCenter() constructor (flutter/engine#8716)
74abe29 Roll src/third_party/skia 8413ff13fefa..b14574924ab3 (4 commits) (flutter/engine#8745)
95fd36c Roll src/third_party/dart 1f1592edce..e70273c306 (78 commits)

The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

If the roll is causing failures, please contact the current sheriff ([email protected]), and stop
the roller if necessary.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants