Iphone Duo Flutter 标志

Iphone Duo Flutter

社区
mirzaaghazadeh
iphone-duo-flutter

让 Flutter 应用适配 Apple 首款可折叠 iPhone iPhone Duo:了解 MediaQuery 目前能提供哪些信息、displayFeatures 为何在此处不起作用,以及如何通过平台通道接入 iOS 27.1 的保留区域、铰链和布局 API。当 Flutter 或 Dart 应用需要支持可折叠 iPhone 时使用。

Add to TypingMind

概览

发布者mirzaaghazadeh
代码仓库iphone-duo-skills
技能名称iphone-duo-flutter
星标数
188
复刻数
9
附带文件
仅含指令
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 指令自成一体

    模型所需的一切都包含在指令中,无需同步额外文件。

  • 开源

    由 mirzaaghazadeh 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Iphone Duo Flutter AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/mirzaaghazadeh/iphone-duo-skills/tree/main/skills/iphone-duo-flutter
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/mirzaaghazadeh/iphone-duo-skills.git /tmp/iphone-duo-skills
mkdir -p .claude/skills
cp -r /tmp/iphone-duo-skills/skills/iphone-duo-flutter .claude/skills/iphone-duo-flutter
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Iphone Duo Flutter,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Iphone Duo Flutter。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Iphone Duo Flutter 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Flutter on iPhone Duo

Start here, because it is the thing that will waste your afternoon otherwise:

MediaQuery.displayFeatures is 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 LayoutBuilder and its BoxConstraints for layout decisions.
  • Use MediaQuery.sizeOf(context) when you need the window, not MediaQuery.of(context) — the sizeOf/paddingOf accessors rebuild only on the property you read, which matters when the size changes this often.
  • Never cache a size in initState or 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, or MediaQuery.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 UIViewKeep controls out of the fold and out of the under-display camera
UIHingeInteractionContinuous hinge angle for effects
Size class from traitCollectionThe 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

  1. Make the app resize cleanly under LayoutBuilder. Most bugs die here.
  2. Audit every use of MediaQuery.padding for symmetric-inset math.
  3. Replace orientation and platform checks with constraint-based branching.
  4. Add a rail/bar split so the inner display isn't just a stretched phone layout.
  5. 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.

常见问题

Iphone Duo Flutter AI 技能有什么作用?

让 Flutter 应用适配 Apple 首款可折叠 iPhone iPhone Duo:了解 MediaQuery 目前能提供哪些信息、displayFeatures 为何在此处不起作用,以及如何通过平台通道接入 iOS 27.1 的保留区域、铰链和布局 API。当 Flutter 或 Dart 应用需要支持可折叠 iPhone 时使用。

为什么在 TypingMind 中使用 Iphone Duo Flutter?

因为您只需安装一次,就能搭配任何模型使用。Iphone Duo Flutter 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Iphone Duo Flutter?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/mirzaaghazadeh/iphone-duo-skills/tree/main/skills/iphone-duo-flutter。TypingMind 会读取其中的 SKILL.md,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Iphone Duo Flutter?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Iphone Duo Flutter 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Iphone Duo Flutter 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Iphone Duo Flutter AI 技能免费吗?

mirzaaghazadeh 已在 GitHub 上发布了该技能。请查看代码仓库了解许可条款。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇