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

Improve window documentation #9669

Merged
merged 3 commits into from
Jul 8, 2019
Merged

Improve window documentation #9669

merged 3 commits into from
Jul 8, 2019

Conversation

liyuqian
Copy link
Contributor

@liyuqian liyuqian commented Jul 3, 2019

To reflect Matt Carroll's recent (02/06/2019) email about promoting
WidgetsBinding.instance.window and demoting ui.window.

I have to manually search for Matt's email several times when I need
to access the Window object. Having it in the documentation would
help me do that much faster.

To reflect Matt Carroll's recent (02/06/2019) email about promoting
`WidgetsBinding.instance.window` and demoting `ui.window`.

I have to manually search for Matt's email several times when I need
to access the Window object. Having it in the documentation would
help me do that much faster.
/// There is a single Window instance in the system, which you can
/// obtain from the [window] property.
/// obtain from `WidgetsBinding.instance.window`, or `window` in `dart:ui` if
/// `WidgetsBinding` is unavailable.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we really want to incentivize the use of the singleton though, right? If window is imported directly from dart:ui then that usage cannot be dependency injected, can it? If I'm remembering that right then we should probably use some very strong language to push people towards the binding, if at all possible. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I see below that you elaborated on this. I would suggest including a little bit of the seriousness of the issue in this reference, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've tried to make it more serious and strong. Please let me know if it looks good, or if you have some sample text that I can follow (or copy/paste) :D

/// obtain from `WidgetsBinding.instance.window`.
///
/// There is also a [window] singleton object in `dart:ui` if `WidgetsBinding`
/// is unavailable. But we strongly advice to avoid statically referencing it.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this update looks better. Thanks. One last detail, "advice" -> "advise".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you! Done.

@liyuqian liyuqian merged commit 92c4469 into flutter:master Jul 8, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 8, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 8, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 9, 2019
@liyuqian liyuqian deleted the window_doc branch July 9, 2019 17:07
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 9, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 9, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 9, 2019
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.

3 participants