FoldInfo class

A complete description of the device's fold state at one moment.

Obtain the current value with Bifold.of(context), which rebuilds the calling widget whenever the state changes.

Never cache a region across layout passes. Regions arrive after the first layout pass and change as the device folds, so read them from the current FoldInfo every build.

Annotations

Constructors

FoldInfo({required bool isFoldable, required FoldDisplay display, required FoldPose pose, required List<FoldRegion> regions, double? hingeAngle, FoldSizeClass horizontalSizeClass = FoldSizeClass.unspecified, FoldSizeClass verticalSizeClass = FoldSizeClass.unspecified, VerticalBarEdge verticalBarEdge = VerticalBarEdge.unspecified, bool isResolved = false})
Creates a fold state description.
const
FoldInfo.fromMap(Map<Object?, Object?> map)
Decodes fold state from a platform channel map.
factory

Properties

activeRegions → Iterable<FoldRegion>
The regions where FoldRegion.isActive is true.
no setter
display → FoldDisplay
Which display the app is currently presented on.
final
division → FoldRegion?
The active fold, if the display is currently creased.
no setter
hashCode → int
The hash code for this object.
no setteroverride
hingeAngle → double?
The hinge angle in radians, or null when the platform reports none.
final
hingeAngleDegrees → double?
hingeAngle converted to degrees, or null when there is no angle.
no setter
horizontalSizeClass → FoldSizeClass
The horizontal size class of the Flutter view.
final
isFoldable → bool
Whether the device has a fold this package can report on.
final
isRegular → bool
Whether both size classes are regular, which the inner display reports.
no setter
isResolved → bool
Whether the platform has actually answered yet.
final
pose → FoldPose
How far the device is folded.
final
regions → List<FoldRegion>
Every reserved region currently reported for the Flutter view, active or not.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
verticalBarEdge → VerticalBarEdge
Which edge the system prefers for its vertical bar.
final
verticalSizeClass → FoldSizeClass
The vertical size class of the Flutter view.
final

Methods

copyWith({bool? isFoldable, FoldDisplay? display, FoldPose? pose, List<FoldRegion>? regions, double? hingeAngle, FoldSizeClass? horizontalSizeClass, FoldSizeClass? verticalSizeClass, VerticalBarEdge? verticalBarEdge, bool? isResolved, bool clearHingeAngle = false}) → FoldInfo
Creates a copy with the given fields replaced.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override

Constants

none → const FoldInfo
Established: this device reports no fold.
unsupported → const FoldInfo
The state reported on every device and platform without fold support.