
iphone-duo-flutter
Adapt a Flutter app to iPhone Duo, Apple's first foldable iPhone — what MediaQuery gives you today, why displayFeatures does not work here, and how to bridge the iOS 27.1 reserved-region, hinge and arrangement APIs through platform channels. Use when a Flutter or Dart app needs foldable iPhone support.
- Installs
- 443
- Last 24h
- +19
- Trending rank
- #6103
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/mirzaaghazadeh/iphone-duo-skills --skill iphone-duo-flutter- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads iphone-duo-flutter automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Flutter on iPhone Duo
Start here, because it is the thing that will waste your afternoon otherwise:
MediaQuery.displayFeaturesis documented as "populated only on Android."
Flutter's foldable abstraction was built for Android hinges. On iPhone Duo it
returns an empty list, no matter how folded the device is. The same goes for
the dual_screen package (TwoPane, hingeAngleEvents) — Android-only in
practice, and last published around three years ago.
So Flutter gives you no fold awareness on this device out of the box. What it does give you is most of what actually matters. Work in two tiers.
Tier 1 — works today, no native code
This is the bulk of a good port, and it is all pure Dart.
Resize correctly
iPhone Duo changes your app's size constantly: opening, closing, folding, rotating, and entering Split View. Flutter handles the mechanics, but only if your layout is driven by constraints rather than constants.
- Use
LayoutBuilderand itsBoxConstraintsfor layout decisions. - Use
MediaQuery.sizeOf(context)when you need the window, notMediaQuery.of(context)— thesizeOf/paddingOfaccessors rebuild only on the property you read, which matters when the size changes this often. - Never cache a size in
initStateor a field. It will be stale within seconds.
Handle asymmetric safe areas
This is the one that produces real bugs. On iPhone Duo the system puts its controls on one side, so insets are routinely asymmetric — and which side depends on the pose and on which half of a Split View you occupy.
MediaQuery.paddingOf(context) returns EdgeInsets with independent left,
top, right, bottom. Use each one. Any expression of the form
width - padding.left * 2 is a defect on this device.
The SafeArea widget handles all four edges independently already, so prefer it
over hand-rolled padding. Where you need artwork to bleed underneath, put the
background outside the SafeArea and only the interactive foreground inside it.
Replace breakpoints with size-class thinking
iOS reasons about this device in size classes: the outer display is compact
width, the inner display is regular width. Flutter has no size classes, so
map to width breakpoints — the Material 3 window size classes are a reasonable
proxy (compact < 600, medium 600–840, expanded ≥ 840 logical pixels).
Two rules:
- Branch on the constraints you were handed, not on
Platform.isIOS, a device model string, orMediaQuery.orientationOf. The inner display does not honor supported orientations, so orientation is not a reliable signal. - Pick breakpoints from where your content stops working, then sanity-check that a compact/regular split falls out of it.
Prefer adaptive containers
NavigationRail for wide layouts and NavigationBar for narrow ones is the
Flutter analogue of what iOS does natively when it moves controls to the side.
A rail on the inner display and a bar on the outer display will feel close to
right, and costs one breakpoint.
Tier 2 — needs a platform channel
Everything genuinely iPhone Duo-specific is unavailable to Dart until you bridge it. As of this writing no Flutter release has shipped iPhone Duo support, so plan on writing this yourself, and check whether it has landed before you do.
What is worth bridging, in priority order:
| Native API (iOS 27.1) | Why you'd want it in Dart |
|---|---|
reservedRegions(kind:) on UIView | Keep controls out of the fold and out of the under-display camera |
UIHingeInteraction | Continuous hinge angle for effects |
Size class from traitCollection | The real signal iOS uses, rather than your breakpoint guess |
How to shape the bridge
Use a MethodChannel for one-shot queries (current reserved regions, current
size class) and an EventChannel for anything continuous — the hinge angle
is a live stream and will spam a MethodChannel.
On the iOS side, in the Runner target, register a FlutterMethodChannel and a
FlutterEventChannel on the FlutterViewController, then read the native APIs
from that view. The reserved-region APIs hang off UIView, and the
FlutterViewController's view is the right one to query — that is the view your
Dart layout actually occupies.
Serialize regions as plain maps ({left, top, width, height, kind, active}) so
Dart gets something it can rebuild Rects from. Send the region list on change
rather than polling.
Guard everything: the hinge is nil on every non-folding device, and these APIs
do not exist below iOS 27.1. Your bridge must degrade to "no regions, no hinge"
rather than throw, because the same Flutter binary runs on every iPhone.
Then use it like Tier 1
Once regions arrive in Dart, feed them into the same constraint-driven layout you
already built. A division region (the fold) tells you where to not put
interactive widgets; an occlusion region (the camera) tells you what to avoid
covering. Stack with Positioned, or a custom MultiChildLayoutDelegate, is
usually the cleanest way to displace a specific control around a region.
What to do, in order
- Make the app resize cleanly under
LayoutBuilder. Most bugs die here. - Audit every use of
MediaQuery.paddingfor symmetric-inset math. - Replace orientation and platform checks with constraint-based branching.
- Add a rail/bar split so the inner display isn't just a stretched phone layout.
- Only then, if the app genuinely needs fold awareness, write the channel.
Steps 1–4 get a Flutter app most of the way to feeling right on iPhone Duo, and they improve it on tablets and desktop at the same time. Step 5 is the only part that is iPhone Duo-specific, and it is the only part that can't be tested without the Xcode 27.1 simulator.
For what the native APIs actually do and why, read
../iphone-duo-adaptive-layout/SKILL.md and
../iphone-duo-readiness/SKILL.md — the design reasoning transfers directly even
though the code doesn't.
FAQ
What does the iphone-duo-flutter skill do?
Adapt a Flutter app to iPhone Duo, Apple's first foldable iPhone — what MediaQuery gives you today, why displayFeatures does not work here, and how to bridge the iOS 27.1 reserved-region, hinge and arrangement APIs through platform channels. Use when a Flutter or Dart app needs foldable iPhone support.
How do I install iphone-duo-flutter?
Run npx skills add https://github.com/mirzaaghazadeh/iphone-duo-skills --skill iphone-duo-flutter in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/iphone-duo-flutter/ (personal) or .claude/skills/iphone-duo-flutter/ (project).
Which AI agents can use iphone-duo-flutter?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is iphone-duo-flutter safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains iphone-duo-flutter?
It is published by mirzaaghazadeh in mirzaaghazadeh/iphone-duo-skills. It has 443 recorded installs.
More from mirzaaghazadeh/iphone-duo-skills
iphone-duo-readiness
mirzaaghazadeh/iphone-duo-skills
Audit and port an iOS app to iPhone Duo, Apple's first foldable iPhone. Use when asked to support, adapt, prepare, test, or review an app for iPhone Duo, foldable iPhone, the inner/outer display, device poses, or the fold. Entry point that routes to the layout, bars, hinge/scenes, camera, and design skills.
iphone-duo-adaptive-layout
mirzaaghazadeh/iphone-duo-skills
Build layouts that adapt to the iPhone Duo fold using reserved regions, division and occlusion regions, displacement patterns, and the split and overlay ArrangementView containers. Use when content or controls land in the fold, when building a split-like or overlay layout, or when custom manually-positioned UI must avoid the hinge or the under-display camera.
iphone-duo-design-review
mirzaaghazadeh/iphone-duo-skills
Review or design an iOS interface for iPhone Duo's poses — closed, open, book-folded, tabletop and tent — covering side-mounted controls, asymmetric layouts, fold avoidance, sheets, and how to use the inner display well. Use for design critique, mockup review, or deciding what a screen should look like on a foldable iPhone rather than how to code it.
iphone-duo-vertical-bars
mirzaaghazadeh/iphone-duo-skills
Adapt toolbars, navigation bars and tab bars for the vertical axis on iPhone Duo — item ordering, symbol vs text representations, axis behavior, overflow menus, visibility priority, and when to opt out. Use when toolbar items look wrong, overflow too early, or need to move to the side on the outer display.
iphone-duo-hinge-and-scenes
mirzaaghazadeh/iphone-duo-skills
Use the iPhone Duo hinge angle for interactions and effects, support Split View multitasking and multiple app scenes, and pair UI across both displays with scene accessories including CameraCaptureAccessory. Use when building fold-driven effects, multi-window support, or dual-display experiences.
iphone-duo-camera
mirzaaghazadeh/iphone-duo-skills
Build camera capture for iPhone Duo's two front cameras — the virtual front camera, the inner under-display and outer ultra-wide devices, AVCaptureDeviceDirectionCoordinator, preview mirroring and video gravity, and dual-display capture. Use when an app captures photo or video and must handle the device opening, closing or flipping.
Popular mobile skills
design-mobile-apps
designed-by-ai/skills
Design mobile app screens with Sleek, edit Sleek projects, and implement their designs in React Native or HTML.
ios-design
uizze.sh
Design and review iOS UI/UX for iPhone apps in SwiftUI, UIKit, or React Native. Use for mobile app design, screen redesigns, navigation flows, typography, forms, keyboard and safe-area layout, and accessibility checks. Apply Apple Human Interface Guidelines and consult real product references through the optional Uizze connection.
vercel-react-native-skills
vercel-labs/agent-skills
React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.
animate-expo
emilkowalski/skills
Build animations in React Native and Expo, making the decisions in the order that determines whether they feel right — should it animate, which thread it runs on, which properties, spring or timing, how the gesture hands off, how it degrades. Writes the implementation with Reanimated, Gesture Handler, Expo Router and expo-haptics. Use when animating anything in an Expo app, adding gestures, sheets, screen transitions, press feedback or haptics, or fixing motion that stutters on device. For web animation use animate.
xcode-project-setup
firebase/agent-skills
Safely modifies Xcode projects (.pbxproj) to add Swift Packages and link files. Use this skill whenever an iOS project needs dependencies installed (e.g. Firebase, Alamofire).
firebase-remote-config-basics
firebase/agent-skills
Manages Firebase Remote Config templates, feature flags, loading strategies, and SDKs (Android, iOS). Use when downloading/deploying remoteconfig JSON templates, managing version history/feature flags, setting in-app defaults, fetchAndActivate(), real-time listeners, or SDK setup. Don't use for Firebase Hosting, Auth, Firestore, Data Connect, Crashlytics, or App Hosting.