做什么
使用“ LayoutBuilder”、“MediaQuery” 或“扩展/灵活”来创建适应不同屏幕大小的布局
技能库 智客分类:Agent 工作流 flutter-build-responsive-layout
使用 " LayoutBuilder " 、 " MediaQuery " 或 " 扩展/灵活 " 来创建适应不同屏幕大小的布局。 在移动和平板电脑/台式电脑形式因子上需要时使用.
官方网址:skills.sh
先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。
使用“ LayoutBuilder”、“MediaQuery” 或“扩展/灵活”来创建适应不同屏幕大小的布局
您需要在移动和平板电脑/台式电脑形式因素上显示良好的UI
按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:Implementing Adaptive Layouts、Contents、Space Measurement Guidelines、Widget Sizing and Constraints、Device and Orientation Behaviors、Workflow: Constructing an Adaptive Layout。 其中含规范建议的小节:分步指令、输入输出示例。
文件分析:这是一份仅含 SKILL.md 的指令型技能,代理激活后整份正文进入上下文。
Use `LayoutBuilder`, `MediaQuery`, or `Expanded/Flexible` to create a layout that adapts to different screen sizes. Use when you need the UI to look good on both mobile and tablet/desktop form factors.
Implementing Adaptive LayoutsContentsSpace Measurement GuidelinesWidget Sizing and ConstraintsDevice and Orientation BehaviorsWorkflow: Constructing an Adaptive LayoutWorkflow: Optimizing for Large ScreensExamplesAdaptive Layout using LayoutBuilderConstraining Width on Large Screens
来源分类:skills.sh agent-skill
nameflutter-build-responsive-layoutdescription具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗
先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。
复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。
把 Agent Skill「flutter-build-responsive-layout」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-9422ce6f8e1bd126-%E5%B0%8F%E8%9D%B6%E6%9E%84%E5%BB%BA%E5%93%8D%E5%BA%94%E5%B8%83%E5%B1%80.html 请存为 .cursor/skills/flutter-build-responsive-layout/SKILL.md 或 .claude/skills/flutter-build-responsive-layout/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。
需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。
npx skills add 'https://github.com/flutter/agent-plugins' --list
npx skills add 'https://github.com/flutter/agent-plugins' --skill 'flutter-build-responsive-layout'
CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。
LayoutBuilder, MediaQuery, or Expanded/Flexible to create a layout that adapts to different screen sizes. Use when you need the UI to look good on both mobile and tablet/desktop form factors.
metadata:
model: models/gemini-3.1-pro-preview
last_modified: Tue, 21 Apr 2026 20:17:40 GMTDetermine the available space accurately to ensure layouts adapt to the app window, not just the physical device.
MediaQuery.sizeOf(context) to get the size of the entire app window.LayoutBuilder to make layout decisions based on the parent widget's allocated space. Evaluate constraints.maxWidth to determine the appropriate widget tree to return.MediaQuery.orientationOf or OrientationBuilder near the top of the widget tree to switch layouts. Device orientation does not accurately reflect the available app window space.Understand and apply Flutter's core layout rule: Constraints go down. Sizes go up. Parent sets position.
Expanded and Flexible within Row, Column, or Flex widgets.
Expanded to force a child to fill all remaining available space (equivalent to Flexible with fit: FlexFit.tight and a flex factor of 1.0).Flexible to allow a child to size itself up to a specific limit while still expanding/contracting. Use the flex factor to define the ratio of space consumption among siblings.GridView or ListView in a ConstrainedBox or Container and define a maxWidth in the BoxConstraints.ListView.builder or GridView.builder when rendering lists with an unknown or large number of items.Ensure the app behaves correctly across all device form factors and input methods.
Display API to retrieve physical screen dimensions instead of MediaQuery. MediaQuery fails to receive the larger window size in compatibility modes.Follow this workflow to implement a layout that adapts to the available BoxConstraints.
Task Progress:
LayoutBuilder.constraints.maxWidth from the builder callback.largeScreenMinWidth = 600).maxWidth > largeScreenMinWidth: Return a large-screen layout (e.g., a Row placing a navigation sidebar and content area side-by-side).maxWidth <= largeScreenMinWidth: Return a small-screen layout (e.g., a Column or standard navigation-style approach).Follow this workflow to prevent UI elements from stretching unnaturally on large displays.
Task Progress:
ListView, text blocks, forms).ListView.builder to GridView.builder using SliverGridDelegateWithMaxCrossAxisExtent to automatically adjust column counts based on window size.ConstrainedBox.BoxConstraints(maxWidth: [optimal_width]) to the ConstrainedBox.ConstrainedBox in a Center widget to keep the constrained content centered on large screens.maxWidth or grid extents.Demonstrates switching between a mobile and desktop layout based on available width.
import 'package:flutter/material.dart';
const double largeScreenMinWidth = 600.0;
class AdaptiveLayout extends StatelessWidget {
const AdaptiveLayout({super.key});
@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, constraints) {
if (constraints.maxWidth > largeScreenMinWidth) {
return _buildLargeScreenLayout();
} else {
return _buildSmallScreenLayout();
}
},
);
}
Widget _buildLargeScreenLayout() {
return Row(
children: [
const SizedBox(width: 250, child: Placeholder(color: Colors.blue)),
const VerticalDivider(width: 1),
Expanded(child: const Placeholder(color: Colors.green)),
],
);
}
Widget _buildSmallScreenLayout() {
return const Placeholder(color: Colors.green);
}
}
Demonstrates preventing a widget from consuming all horizontal space.
import 'package:flutter/material.dart';
class ConstrainedContent extends StatelessWidget {
const ConstrainedContent({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: ConstrainedBox(
constraints: const BoxConstraints(
maxWidth: 800.0, // Maximum width for readability
),
child: ListView.builder(
itemCount: 50,
itemBuilder: (context, index) {
return ListTile(
title: Text('Item $index'),
);
},
),
),
),
);
}
}
Agent 工作流
创造有效技能指南。 当用户想创造出新的技能(或更新现有的技能),以专业知识,工作流程,或工具集成来扩展克洛德的能力时,应该使用这种技能.
Agent 工作流
使用ClawdHub CLI搜索,安装,更新并发布从taladhub.com的代理技能. 需要获取苍蝇上的新技能时使用,将安装的技能同步到最新版本或特定版本,或者发布 npm-instainddhub CLI 的新/更新的技能文件夹.
Agent 工作流
管弦乐团多代理团队,任务设定周期,交接协议,审查工作流程. 使用时间: (1)建立2+特派员队伍,具有不同专业,(2)确定任务路线和生命周期(收录框_ spec_建设_审查_完成),(3)在特派员之间制定交接协议,(4)建立审查和质量关口,(5)管理特派员之间的交流和文物共享.
Agent 工作流
Spec-first,TDD,子代理驱动的软件开发工作流程. 当:(1)构建任何新功能或应用——触发脑暴_计划_子代理执行回路,(2)调试出一个bug或测试失败——触发系统性的根起过程,(3)用户说"让我们构建","帮助我计划","我想添加X",或"这个被打破",(4)完成一个功…