DisplayFeatureSubScreen class
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:
- for TextDirection.ltr, anchorPoint is
Offset.zero
, which will cause the content to appear in the top-left sub-screen. - for TextDirection.rtl, anchorPoint is
Offset(double.maxFinite, 0)
, which will cause the content to appear in the top-right sub-screen.
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:
- showDialog, which is a way to display a DialogRoute.
- showCupertinoDialog, which displays an iOS-style dialog.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- DisplayFeatureSubScreen
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.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
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.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent 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, int wrapWidth = 65}) → 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.
inherited
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 ofavoidBounds
that are at least as tall or as wide.