fold_kit library

Foldable and large-screen toolkit for Flutter: fold position, posture and window size classes for iPhone Duo, Galaxy Z Fold, Pixel Fold and tablets.

Classes

FoldAction
An app bar action that can live in a horizontal app bar or a vertical bar.
FoldAngleController
The hinge angle for protractor-style features: angle follows the hinge live, and hold freezes the value from lookBack ago, so the finger that taps "Hold" doesn't move the reading.
FoldAvoid
Keeps child off the fold: if it would sit on the hinge, it moves to the closer side (plus gap). Use it for buttons, FABs, banners and map controls that are positioned by hand.
FoldBarContent
What the vertical bar shows, handed to FoldScaffold.verticalBarBuilder so you can draw the bar any way you like.
FoldBarTheme
Colors of the vertical bar, to match your app's own bars.
FoldBuilder
Rebuilds with the current FoldState:
FoldDestination
A tab of a FoldScaffold.
FoldDevice
One device in the catalog: window sizes in logical pixels and where the fold is. Used by FoldPreview and tests; never used for runtime layout.
FoldDevices
The device catalog. Ships with a snapshot; refresh can pull the latest list from monsware.com so new foldables appear without a package release.
FoldInfo
Where the fold is and how the device is held, for the current window.
FoldKit
Entry points for reading and listening to the fold.
FoldKitScope
Puts the fold of iPhone Duo into MediaQuery.displayFeatures, the same place Flutter already reports Android folds, so FoldInfo, TwoPane, dialogs and sheets work the same on both platforms.
FoldLayoutBuilder
Builds with the fold mapped into this widget, for layouts that FoldTwoPane doesn't cover: keep a canvas above a tabletop fold, put a toolbar right after the hinge, size a list to the left half.
FoldListener
Calls onChanged when the posture, the hinge angle, the device or the fold changes, and onAngleChanged when only the hinge angle matters (not on the first build unless fireImmediately).
FoldPreview
Shows child as it would look on device in posture, on any screen: the window size, the fold, the hinge status and the safe area are faked, so FoldInfo, FoldScaffold and FoldTwoPane behave like on the device.
FoldScaffold
A scaffold whose app bar and tabs move into one vertical bar on the right edge where the system does that for native apps (iPhone Duo outer display, inner display in landscape) — and stay your normal app bar + bottom bar everywhere else. The body keeps its state when the bars move.
FoldState
Everything about the fold in one value: posture, hinge angle, which device it is, and where the fold is. Read it with FoldKit.of, rebuild with FoldBuilder, react with FoldListener or FoldKit.changes.
FoldTwoPane
Two panes that split exactly at the fold, on any device.
LocalFold
Where the fold is inside one widget, in that widget's own coordinates.

Enums

FoldAxis
Direction of the fold line.
FoldBarCompression
What leaves the vertical bar first when it is too short.
FoldBarPlacement
Where the app bar and the tabs go.
FoldForm
Physical form of a device.
FoldPosture
How a foldable is folded.
HingeStatus
Hinge status reported by the platform (iPhone Duo; Android reports only the angle).
WindowSizeClass
Material 3 window size classes by width.