twin_screen library
Fold-aware and dual-screen layouts for Flutter.
Wrap the app in TwinScreenScope, then read TwinScreen.of or use TwinPane, WindowClassBuilder and showFoldAwareDialog. Add TwinDebugOverlay to see the fold and simulate foldable devices.
Classes
-
FoldAwareBottomSheetRoute<
T> - A Material ModalBottomSheetRoute that places its sheet with FoldAwareDialog.
- FoldAwareDialog
- Keeps a dialog on one side of the fold.
-
FoldAwareDialogRoute<
T> - A Material DialogRoute that places its dialog with FoldAwareDialog.
- TwinDebugOverlay
- Shows the fold, the segments and the screen state on top of the app, and simulates foldable devices.
- TwinDestination
- One destination of a TwinNavigation.
- TwinDevicePreset
-
A device shape for the fold simulator in
TwinDebugOverlay. - TwinHinge
- A fold or hinge that crosses the app window.
- TwinListDetail
- A list and its detail view, laid out for the fold.
- Navigation that adapts to the window and the fold.
- TwinPane
- Shows two widgets on the two sides of a fold or hinge.
- TwinPaneRects
- Where TwinPane puts its two panes, in the scope's coordinate space.
- TwinPlatformState
-
What the platform reports about the device, before it is combined with
the window size into
TwinScreenData. - TwinResolver
- Pure functions that turn raw platform input into TwinScreenData.
- TwinScreen
- Reads the TwinScreenData provided by the nearest TwinScreenScope.
- TwinScreenData
- Everything this package knows about the device and how the app is shown.
- TwinScreenScope
-
Provides TwinScreenData to the app and fills
MediaQuery.displayFeatureson platforms where Flutter does not. - TwinSimulatedScreen
- The screen the simulator presents to the app: its size, safe area, display features and platform report.
- TwinSimulatorController
-
Drives the fold simulator of
TwinDebugOverlay. - WindowClass
- The Material 3 size class of the app window: a width class and a height class.
- WindowClassBreakpoints
- The breakpoints that turn a window size into a WindowClass.
- WindowClassBuilder
- Builds a different widget for each window width class.
Enums
- TwinAspect
- The parts of TwinScreenData a widget can depend on.
- TwinDataSource
- Where the fold information came from.
- TwinDeviceType
- The kind of hardware the app is running on.
- TwinHiddenPane
- What TwinPane does with a pane that is not showing.
- TwinHingeAxis
- The direction in which a fold or hinge runs.
- How TwinNavigation shows its destinations.
- TwinPaneFallback
- How TwinPane lays out its panes when no hinge separates the window.
- TwinPaneSide
- One of the two halves of a split layout.
- TwinPosture
- The physical state of the hinge.
- TwinScreenMode
- One combined answer to "how is the app being shown right now?".
- TwinSimulatedSpan
- Which part of the unfolded screen the app occupies in the simulator.
- WindowHeightClass
- Material 3 window height classes.
- WindowWidthClass
- Material 3 window width classes.
Functions
-
showFoldAwareBottomSheet<
T> ({required BuildContext context, required WidgetBuilder builder, Offset? anchorPoint, TwinPaneSide preferredSide = TwinPaneSide.start, bool allowSpanning = false, Color? backgroundColor, String? barrierLabel, double? elevation, ShapeBorder? shape, Clip? clipBehavior, BoxConstraints? constraints, Color? barrierColor, bool isScrollControlled = false, double scrollControlDisabledMaxHeightRatio = 9.0 / 16.0, bool isDismissible = true, bool enableDrag = true, bool? showDragHandle, bool useSafeArea = false, RouteSettings? routeSettings, AnimationController? transitionAnimationController, AnimationStyle? sheetAnimationStyle}) → Future< T?> - Shows a modal bottom sheet that stays on one side of the fold.
-
showFoldAwareDialog<
T> ({required BuildContext context, required WidgetBuilder builder, Offset? anchorPoint, TwinPaneSide preferredSide = TwinPaneSide.start, bool allowSpanning = false, bool barrierDismissible = true, Color? barrierColor, String? barrierLabel, bool useSafeArea = true, RouteSettings? routeSettings, TraversalEdgeBehavior? traversalEdgeBehavior}) → Future< T?> - Shows a Material dialog that stays on one side of the fold.