Skip to content
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

Expose Window.viewInsets in dart:ui #4403

Merged
merged 1 commit into from
Nov 30, 2017

Conversation

cbracken
Copy link
Member

Window.viewInsets is the set of window-relative insets that describe the
area of the window that an application may want to treat as effectively
reducing the size of the content. Typically this is due to system UI
that fully obscures underlying content, such as the keyboard.

This area differs from padding in that padding is the set of insets that
describe the area of the window that may be partially (or fully)
obscured by system UI or physical intrusions into the view area (e.g.
iPhone X sensor housing, status bar, or the iPhone X home indicator
widget).

This patch does not yet enable the iOS bottom edge safe area. Once the
framework has been updated to use viewInsets for bottom-edge occlusions
(today, the keyboard), the bottom safe area will be enabled and
framework patches that depend on it, landed.

Copy link
Member

@jason-simmons jason-simmons left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -560,10 +569,15 @@ public final WindowInsets onApplyWindowInsets(WindowInsets insets) {
@SuppressWarnings("deprecation")
protected boolean fitSystemWindows(Rect insets) {
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
// On Android, we do no differentiate between 'safe areas' and view insets.
Copy link
Member

Choose a reason for hiding this comment

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

typo: "do no" -> "do not"

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. Thanks for spotting!

@@ -72,6 +72,40 @@ enum AppLifecycleState {
suspending,
}

/// A representation of the insets relative to each side of the window into
/// which the application can render, but over white the operating system will
Copy link
Member

Choose a reason for hiding this comment

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

s/white/which

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Copy link
Member

@xster xster left a comment

Choose a reason for hiding this comment

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

LG

///
/// * [WidgetsBindingObserver], for a widgets layer mechanism to receive
/// notifications when the margin changes.
/// * [MediaQuery.of], a simpler mechanism for the same.
Copy link
Member

Choose a reason for hiding this comment

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

I feel this is not super clear. Is it referring to 'the same' representation of the insets or of the mechanism to receive notifications or something else?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated both here and for padding for consistency.

Window.viewInsets is the set of window-relative insets that describe the
area of the window that an application may want to treat as effectively
reducing the size of the content. Typically this is due to system UI
that fully obscures underlying content, such as the keyboard.

This area differs from padding in that padding is the set of insets that
describe the area of the window that may be partially (or fully)
obscured by system UI or physical intrusions into the view area (e.g.
iPhone X sensor housing, status bar, or the iPhone X home indicator
widget).

This patch does not yet enable the iOS bottom edge safe area. Once the
framework has been updated to use viewInsets for bottom-edge occlusions
(today, the keyboard), the bottom safe area will be enabled and
framework patches that depend on it, landed.
@xster
Copy link
Member

xster commented Nov 30, 2017

LG

@cbracken
Copy link
Member Author

cbracken commented Nov 30, 2017

Adds underlying support for fixing flutter/flutter#12895.

@cbracken cbracken merged commit 93648ef into flutter:master Nov 30, 2017
@cbracken cbracken deleted the iphone_x_margin branch November 30, 2017 00:27
/// * [MediaQuery.of], for the preferred mechanism for accessing this value.
/// * [Scaffold], which automatically applies the view insets in material
/// design applications.
class ViewInsets {
Copy link
Contributor

Choose a reason for hiding this comment

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

How does this class differ from WindowPadding?

cbracken added a commit to cbracken/flutter that referenced this pull request Nov 30, 2017
Also updates EdgeInsets documentation to reflect WindowPadding's use for
both padding and view insets.

See engine commits:
  flutter/engine#4403
  flutter/engine#4406
cbracken added a commit to flutter/flutter that referenced this pull request Nov 30, 2017
* Add MediaQuery support for view insets

Also updates EdgeInsets documentation to reflect WindowPadding's use for
both padding and view insets.

See engine commits:
  flutter/engine#4403
  flutter/engine#4406
bsalomon pushed a commit to bsalomon/engine that referenced this pull request Dec 8, 2017
Window.viewInsets is the set of window-relative insets that describe the
area of the window that an application may want to treat as effectively
reducing the size of the content. Typically this is due to system UI
that fully obscures underlying content, such as the keyboard.

This area differs from padding in that padding is the set of insets that
describe the area of the window that may be partially (or fully)
obscured by system UI or physical intrusions into the view area (e.g.
iPhone X sensor housing, status bar, or the iPhone X home indicator
widget).

This patch does not yet enable the iOS bottom edge safe area. Once the
framework has been updated to use viewInsets for bottom-edge occlusions
(today, the keyboard), the bottom safe area will be enabled and
framework patches that depend on it, landed.
DaveShuckerow pushed a commit to DaveShuckerow/flutter that referenced this pull request May 14, 2018
* Add MediaQuery support for view insets

Also updates EdgeInsets documentation to reflect WindowPadding's use for
both padding and view insets.

See engine commits:
  flutter/engine#4403
  flutter/engine#4406
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants