移动开发

flutter-layout

flutter/agent-plugins

How to build your app's layout using Flutter's layout widgets and constraint system

  • 1255 次安装
  • 3100 星标
  • 收录于

安装命令

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

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.