Skip to main content

twin_screen 0.4.5 copy "twin_screen: ^0.4.5" to clipboard
twin_screen: ^0.4.5 copied to clipboard

Fold-aware and dual-screen layouts for Flutter: iPhone Duo, Android foldables and flip phones, and web, plus window size classes and a fold simulator.

0.4.5 #

  • iOS: when the system reports no division region (the iOS 27.1 simulator never does), the fold is now estimated as a line through the middle of the whole screen, across its long side. This is a heuristic, not a measurement. A real division region, when there is one, is used instead. The estimate is not made while the device is closed.

0.4.4 #

  • TwinPane.hiddenPane with TwinHiddenPane.dispose (default), keep and the new keepOnceShown: a pane is built only once it has been shown, then kept with its state while hidden. TwinListDetail uses it, so an unopened detail is no longer built on a phone.
  • TwinPane.maintainHiddenPane is deprecated; it means TwinHiddenPane.keep.

0.4.3 #

  • TwinPane.isSplitOf(context): whether the nearest TwinPane above shows both panes, using the layout's own rules. TwinListDetail.isSplitOf now delegates to it. The example app uses it instead of repeating the rules.

0.4.2 #

  • The iOS podspec version was stuck at 0.1.0; it now matches pubspec.yaml, and a test keeps them in sync.

0.4.1 #

  • The iPhone Duo simulator preset now matches the real window: 871 × 669 pt on the unfolded screen (the right 80 pt hold the status column), with the fold at 475.5 pt, the middle of the 951 pt screen.
  • New TwinDevicePreset.innerEndInset and defaultOrientation. Picking a preset, or creating a TwinSimulatorController without orientation:, now uses the preset's default orientation. iPhone Duo opens in landscape (book) instead of portrait (tabletop).

0.4.0 #

  • TwinNavigation and TwinDestination: navigation that adapts to the window and the fold. A bottom bar on compact windows, a rail on medium ones, an extended rail on expanded ones, and always a rail beside a separating vertical hinge. Override with TwinNavigationLayout.

0.3.0 #

  • TwinListDetail: a list and its detail view. Side by side when the window splits (fold, hinge, or a medium or larger window), one at a time otherwise, with the back gesture calling onDetailClosed. Both views keep their state. TwinListDetail.isSplitOf(context) tells a view which layout it is in.
  • TwinPane.maintainHiddenPane: keeps a hidden pane in the tree, off screen, so it keeps its state. Off by default.

0.2.0 #

  • showFoldAwareBottomSheet and FoldAwareBottomSheetRoute: a modal bottom sheet that rises on one side of the fold. Same placement rules as showFoldAwareDialog (anchorPoint, preferredSide, allowSpanning) and the same options as showModalBottomSheet.

0.1.0 #

First release.

  • TwinScreenScope and TwinScreen.of: device type, posture, hinge angle, hinge bounds, segments, window class, data source and a combined mode (standard, cover, singlePane, dualPane, book, tabletop). Widgets can depend on one aspect only.
  • TwinScreen.hingeAngleStreamOf for hinge angle updates without rebuilds.
  • Fills MediaQuery.displayFeatures on iOS and web, so Flutter's own fold-aware widgets work there too. Folds Flutter already reports are kept.
  • TwinPane: two panes split at the fold, with window-class fallbacks and RTL support.
  • showFoldAwareDialog and FoldAwareDialog: dialogs on the side of the anchor point or preferredSide, optionally spanning both sides.
  • WindowClass, WindowClassBreakpoints and WindowClassBuilder: Material 3 window size classes with custom breakpoints.
  • TwinDebugOverlay: draws segments, the hinge and cutouts, shows a draggable info panel, and simulates iPhone Duo, Galaxy Z Fold, Galaxy Z Flip, Pixel Fold, Surface Duo and Xiaomi Mix Flip. Off in release builds by default.
  • Android: hinge sensor, posture and angle stream, cover-screen detection, book versus flip detection, and a remembered device type.
  • iOS 27.1+ (preview): UIHingeInteraction and reserved regions, reached at run time so the plugin builds with any Xcode. The cover screen and the hardware check are verified in the simulator; the open and half-open states are not yet confirmed on an unfolded device. Requires iOS 15.0 or later.
  • Web: Viewport Segments and Device Posture APIs.
  • macOS, Windows and Linux: an ordinary device; window classes and the simulator still work.
  • The app below the scope, and each TwinPane pane, keep their state when the device folds or unfolds.
  • Guides in doc/, screenshots, and an example app covering every feature.
  • A guide for AI coding agents (doc/ai-agents.md): a rules block to paste into CLAUDE.md, AGENTS.md, Cursor or Copilot instructions, prompts that work well, and the mistakes agents make most often.
  • Requires Flutter 3.32 or later. Android: API 21+, with Android Gradle Plugin 8 or 9 (built-in Kotlin or the Kotlin plugin).
2
likes
160
points
767
downloads
screenshot

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

Fold-aware and dual-screen layouts for Flutter: iPhone Duo, Android foldables and flip phones, and web, plus window size classes and a fold simulator.

Repository (GitHub)
View/report issues
Contributing

Topics

#foldable #dual-screen #adaptive #responsive #layout

License

MIT (license)

Dependencies

flutter, flutter_web_plugins, web

More

Packages that depend on twin_screen

Packages that implement twin_screen