-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Conversation
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.
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. |
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.
typo: "do no" -> "do not"
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.
Done. Thanks for spotting!
8dafd78
to
9639092
Compare
lib/ui/window.dart
Outdated
@@ -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 |
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.
s/white/which
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.
Done.
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.
LG
lib/ui/window.dart
Outdated
/// | ||
/// * [WidgetsBindingObserver], for a widgets layer mechanism to receive | ||
/// notifications when the margin changes. | ||
/// * [MediaQuery.of], a simpler mechanism for the same. |
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 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?
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.
Updated both here and for padding
for consistency.
9639092
to
7b93428
Compare
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.
7b93428
to
91fe2f8
Compare
LG |
Adds underlying support for fixing flutter/flutter#12895. |
/// * [MediaQuery.of], for the preferred mechanism for accessing this value. | ||
/// * [Scaffold], which automatically applies the view insets in material | ||
/// design applications. | ||
class ViewInsets { |
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.
How does this class differ from WindowPadding?
Also updates EdgeInsets documentation to reflect WindowPadding's use for both padding and view insets. See engine commits: flutter/engine#4403 flutter/engine#4406
* 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
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.
* 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
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.