Token导航 LogoToken导航TokenDH.com
前端设计只读github未标认证来源可访问许可证需确认审计通过

flutter-layoutFlutter layout 浏览器

Agent Skill

用于辅助界面设计、视觉规范、排版、配色、布局和交互体验优化。它适合让 Agent 根据产品场景整理页面结构、生成 UI 方案、检查视觉一致性或改进组件层级。使用时需要结合现有品牌、设计系统和用户任务,不应只堆装饰元素;涉及真实页面改动时,应通过截图或浏览器预览检查文本溢出、对齐和响应式表现。

总安装

31,512

周安装

1,260

GitHub Stars

1,285

下载量

10,296
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:flutter-layout(Flutter layout 浏览器)
来源仓库:https://github.com/flutter/skills
仓库路径:skills/flutter-layout
安装命令:
npx skills add https://github.com/flutter/skills --skill flutter-layout
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/flutter/skills --skill flutter-layout

简介

通过组合小部件、管理约束和适应屏幕尺寸来构建响应式 Flutter 布局。

  • 提供决策树,用于根据内容维度、重叠、滚动和响应能力需求选择正确的基本布局小部件(行、列、堆栈、ListView、GridView、CustomScrollView)
  • 强制执行 Flutter 的核心约束系统:约束向下流动,大小向上流动,父母设置位置;包括用于强制指定尺寸的 ConstrainedBox 模式
  • 使用 LayoutBuilder 实现自适应布局,根据可用宽度分支 UI 逻辑,支持移动设备到平板电脑的转换
  • 涵盖了具有扩展和灵活小部件的弹性布局组合,用于管理行和列中的子级大小,以及修复可滚动上下文中的无界约束错误

SKILL.md

Goal

Constructs robust, responsive Flutter user interfaces by composing layout widgets, managing constraints, and implementing adaptive design patterns. Assumes the target environment has the Flutter SDK installed and the user is familiar with Dart syntax and state management fundamentals.

Instructions

  1. Determine Layout Strategy (Decision Logic) Analyze the UI requirements and select the appropriate base layout widgets using the following decision tree:

- Is the content strictly 1-Dimensional? - Horizontal arrangement -> Use Row. - Vertical arrangement -> Use Column. - Does the content need to overlap (Z-axis)? - Yes -> Use Stack with Positioned or Align children. - Does the content exceed the screen size? - Yes, 1D list -> Use ListView. - Yes, 2D grid -> Use GridView. - Yes, custom scroll effects -> Use CustomScrollView with Slivers. - Does the layout need to adapt to screen size changes? - Yes -> Use LayoutBuilder or MediaQuery.

  1. Apply the Golden Rule of Constraints Enforce Flutter's core layout rule: *Constraints go down. Sizes go up. Parent sets position.* When a widget requires a specific size, ensure its parent allows it. Use ConstrainedBox to inject specific constraints, but remember it only adds to the parent's constraints. // Example: Forcing a specific size within a flexible parent Center(child: ConstrainedBox(constraints: const BoxConstraints(minWidth: 70, minHeight: 70, maxWidth: 150, maxHeight: 150,), child: Container(color: Colors.blue, width: 1000, // Will be constrained to 150 (max) height: 10, // Will be constrained to 70 (min)),),)
  2. Implement Adaptive Layouts For screens that must support both mobile and tablet/desktop form factors, implement a LayoutBuilder to branch the UI logic based on available width. class AdaptiveScreen extends StatelessWidget {const AdaptiveScreen({super.key}); @override Widget build(BuildContext context) {return Scaffold(body: SafeArea(child: LayoutBuilder(builder: (context, constraints) {if (constraints.maxWidth > 600) {return _buildWideLayout();} else {return _buildNarrowLayout();}},),),);} Widget _buildWideLayout() {return Row(children: [const SizedBox(width: 250, child: Placeholder()), // Sidebar Container(width: 1, color: Colors.grey), // Divider const Expanded(child: Placeholder()), // Main Content],);} Widget _buildNarrowLayout() {return const Column(children: [Expanded(child: Placeholder()), // Main Content],);}}
  3. Compose Flex Layouts (Rows and Columns) When using Row or Column, manage child sizing using Expanded (forces child to fill available space) or Flexible (allows child to be smaller than available space). Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.center, children: [const Icon(Icons.star), Expanded(flex: 2, child: Container(color: Colors.red, height: 50),), Flexible(flex: 1, child: Container(color: Colors.blue, height: 50),),],)
  4. Gather Context STOP AND ASK THE USER: "What are the target devices (e.g., mobile, tablet, web) and specific breakpoint widths required for this layout?"
  5. Validate-and-Fix: Handle Unbounded Constraints Verify that no Expanded or Flexible widgets are placed inside unbounded parents (like ListView or SingleChildScrollView). If a RenderFlex overflow occurs, implement the following fix: // INCORRECT: Expanded inside a scrollable view causes unbounded height errors. // SingleChildScrollView(child: Column(children: [Expanded(child: Container())])) // CORRECT: Use a bounded height or remove Expanded. // Alternatively, use CustomScrollView with SliverFillRemaining: CustomScrollView(slivers: [SliverToBoxAdapter(child: HeaderWidget()), SliverFillRemaining(hasScrollBody: false, child: ExpandedContentWidget(),),],)

Constraints

  • Always wrap top-level screen content in a SafeArea to prevent overlap with system UI.
  • Never place an Expanded or Flexible widget inside a parent that provides unbounded constraints (e.g., SingleChildScrollView, ListView, or Row inside a horizontally scrolling view).
  • Do not use Container solely for padding; use the Padding widget for better performance.
  • Assume the user is using Material 3 (useMaterial3: true is default).

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

33.71%
按下载量换算3,471

Claude

31.17%
按下载量换算3,209

Cursor

19.65%
按下载量换算2,023

Gemini CLI

8.81%
按下载量换算907

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills