DisplayFeatureSubScreen class Null safety

Positions child such that it avoids overlapping any DisplayFeature that splits the screen into sub-screens.

A DisplayFeature splits the screen into sub-screens when both these conditions are met:

  • it obstructs the screen, meaning the area it occupies is not 0 or the state is DisplayFeatureState.postureHalfOpened.
  • it is at least as tall as the screen, producing a left and right sub-screen or it is at least as wide as the screen, producing a top and bottom sub-screen

After determining the sub-screens, the closest one to anchorPoint is used to render the content.

If no anchorPoint is provided, then Directionality is used:

If no anchorPoint is provided, and there is no Directionality ancestor widget in the tree, then the widget asserts during build in debug mode.

Similarly to SafeArea, this widget assumes there is no added padding between it and the first MediaQuery ancestor. The child is wrapped in a new MediaQuery instance containing the DisplayFeatures that exist in the selected sub-screen, with coordinates relative to the sub-screen. Padding is also adjusted to zero out any sides that were avoided by this widget.

See also:

Inheritance

Constructors

DisplayFeatureSubScreen({Key? key, Offset? anchorPoint, required Widget child})
Creates a widget that positions its child so that it avoids display features.
const

Properties

anchorPoint Offset?
The anchor point used to pick the closest sub-screen.
final
child Widget
The widget below this widget in the tree.
final
hashCode int
The hash code for this object.
nonVirtual">@nonVirtualread-onlyinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
protected">@protectedinherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
nonVirtual">@nonVirtualinherited

Static Methods

avoidBounds(MediaQueryData mediaQuery) Iterable<Rect>
Returns the areas of the screen that are obstructed by display features.
subScreensInBounds(Rect wantedBounds, Iterable<Rect> avoidBounds) Iterable<Rect>
Returns sub-screens resulted by dividing wantedBounds along items of avoidBounds that are at least as tall or as wide.