makepad-2-0-layout
Skill này làm gì
Agent này giúp bạn sắp xếp các phần tử hình ảnh (bố cục) trong ứng dụng làm bằng Makepad. Nó giải thích cách các thành phần tự điều chỉnh kích thước và vị trí của mình, thông qua một hệ thống gọi là 'layout turtle'.
Khi nào nên dùng
- ✓Khi bạn tạo giao diện trực quan cho một ứng dụng Makepad.
- ✓Khi các phần tử trên màn hình không hiển thị như bạn mong đợi.
- ✓Khi bạn muốn các thành phần chiếm đúng lượng không gian cần thiết.
Liên kết skill
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/makepad-2-0-layout/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Làm sao để văn bản chiếm hết chiều rộng còn trống nhưng không vượt quá 500 pixel?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Công cụ dùng hệ thống 'layout turtle', định nghĩa cách các thành phần tự đặt kích thước ('walk') và cách một container sắp xếp các phần tử con ('layout'). Bạn đặt các thuộc tính như 'width', 'height', 'flow' và 'spacing' để kiểm soát diện mạo.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Limitations
- Verify against current Makepad 2.0 docs; upstream APIs change frequently.
- Do not run bundled scripts without explicit user approval.
When to Use
- Use when this upstream workflow matches the user's stated goal.
- Use when the task requires the procedures documented in this skill.
Makepad 2.0 Layout System
Makepad uses a layout turtle system -- not CSS flexbox, not CSS grid. The turtle walks through children one by one, placing each widget according to two core concepts:
- Walk -- how a widget sizes itself (width, height, margin)
- Layout -- how a container arranges its children (flow, spacing, padding, align)
Every container widget (View, SolidView, RoundedView, ScrollYView, etc.) has both Walk properties (its own size) and Layout properties (how it lays out children).
Walk System (Widget Sizing)
Walk controls how an individual widget claims space inside its parent.
width / height
| Syntax | Meaning |
|---|---|
width: Fill |
Fill all remaining horizontal space (default) |
width: Fit |
Shrink to fit content |
width: 200 |
Fixed 200 pixels |
width: Fill{min: 100 max: 500} |
Fill with constraints |
width: Fit{max: Abs(300)} |
Fit content, capped at 300px |
height: Fill |
Fill all remaining vertical space (default) |
height: Fit |
Shrink to fit content |
height: 100 |
Fixed 100 pixels |
use mod.prelude.widgets.*
// Fill: takes all available width
View{
width: Fill height: Fit
flow: Down
Label{text: "I stretch to fill the width"}
}
// Fit: shrinks to content
View{
width: Fit height: Fit
padding: 10
Label{text: "I am only as wide as this text"}
}
// Fixed: exact pixel size
View{
width: 300 height: 200
Label{text: "I am exactly 300x200 pixels"}
}
// Constrained Fill: fills but within bounds
View{
width: Fill{min: 200 max: 600} height: Fit
flow: Down padding: 16
Label{text: "I fill available space but stay between 200-600px"}
}
CRITICAL: height: Fit on Containers
This is the number one layout bug in Makepad.
The default height is Fill. When your output renders inside a Fit container,
Fill inside Fit creates a circular dependency and resolves to 0 pixels.
Your entire UI becomes invisible.
Rule: ALWAYS set height: Fit on every View, SolidView, RoundedView, and similar
container unless the parent has a fixed or Fill height.
// CORRECT -- height: Fit makes the container visible
View{
width: Fill height: Fit
flow: Down padding: 10
Label{text: "I am visible"}
}
// WRONG -- defaults to height: Fill, resolves to 0px, invisible
View{
width: Fill
flow: Down padding: 10
Label{text: "I am invisible (0px tall)"}
}
Exceptions where height: Fill is acceptable:
- Inside a fixed-height parent:
View{
height: 400
View{
height: Fill
Label{text: "I fill the 400px parent"}
}
}
- Inside a
height: Fillchain that ultimately reaches a known size (e.g., Window body). - ScrollYView always uses
height: Fillbecause it must fill its parent to scroll.
margin
Margin adds space around the outside of a widget.
// Uniform margin on all sides
Label{text: "Hello" margin: 10}
// Selective margin with Inset
Label{
text: "Indented"
margin: Inset{top: 5 bottom: 5 left: 20 right: 20}
}
// Zero margin (note the trailing dot for float literal)
Label{text: "Flush" margin: 0.}
Layout System (Child Arrangement)
Layout controls how a container positions its children.
flow (Direction)
| Syntax | Meaning | CSS Equivalent |
|---|---|---|
flow: Right |
Left-to-right, single line (default) | flex-direction: row |
flow: Down |
Top-to-bottom, single column | flex-direction: column |
flow: Overlay |
Stack children on top of each other | position: absolute stacking |
flow: Flow.Right{wrap: true} |
Left-to-right with wrapping | flex-wrap: wrap |
flow: Flow.Down{wrap: true} |
Top-to-bottom with wrapping | column wrap |
use mod.prelude.widgets.*
// Vertical stack (most common)
View{
width: Fill height: Fit
flow: Down spacing: 10
Label{text: "First"}
Label{text: "Second"}
Label{text: "Third"}
}
// Horizontal row
View{
width: Fill height: Fit
flow: Right spacing: 10
Label{text: "Left"}
Label{text: "Center"}
Label{text: "Right"}
}
// Overlay -- children stacked on top of each other
…
Câu hỏi thường gặp
Vì sao giao diện của bạn biến mất?
Điều này thường xảy ra khi bạn dùng 'height: Fill' bên trong một container cũng có 'height: Fit'. Quy tắc là dùng 'height: Fit' cho container, trừ khi phần tử cha có chiều cao cố định.
Khác nhau giữa 'Walk' và 'Layout' là gì?
'Walk' xác định kích thước của một thành phần (chiều rộng, chiều cao). 'Layout' xác định cách một container sắp xếp các thành phần bên trong (hướng, khoảng cách, căn lề).
Làm sao để xếp các phần tử theo chiều dọc?
Dùng `flow: Down` trong container chứa các phần tử. Bạn cũng có thể điều chỉnh khoảng cách giữa chúng bằng thuộc tính `spacing`.
Chi tiết
Mô tả gốc của tác giả
Makepad 2.0 guidance for layout; use when building or debugging Makepad UI code.
Độ phổ biến
- Sao GitHub
- 48k
- Vị trí xếp hạng
- #5142
- Giấy phép
- MIT
- Cập nhật
- 15/10/2026
Bình luận
- …
Thêm skill từ kho mã này
00-andruia-consultant
48kGiúp agent của bạn bắt đầu hoặc cải thiện các dự án AI. Phân tích mã, gợi ý công cụ và lập kế hoạch hành động bằng tiếng Tây Ban Nha.
007
48kCho phép agent của bạn thực hiện kiểm toán bảo mật và mô hình hóa mối đe dọa. Hữu ích để bảo vệ dự án khỏi các cuộc tấn công và lỗ hổng.
10-andruia-skill-smith
48kGiúp agent của bạn tạo hoặc cải thiện các công cụ AI. Xác định cách công cụ hoạt động, viết tài liệu và kiểm tra cấu trúc.
20-andruia-niche-intelligence
48kGiúp agent của bạn tạo bản tóm tắt về một ngành cụ thể. Hữu ích để hiểu bối cảnh, quy tắc, cách người dùng tương tác và rủi ro của dự án.
Skill tương tự
angular-developer
280kGiúp agent của bạn viết code Angular và tư vấn cấu trúc dự án, hữu ích khi bắt đầu dự án mới hoặc cải thiện hiệu suất.
frontend-a11y
280kGiúp agent của bạn làm cho giao diện web dễ tiếp cận với mọi người. Đảm bảo website và ứng dụng hoạt động tốt với trình đọc màn hình và điều hướng bằng bàn phím.
frontend-patterns
280kGiúp agent của bạn áp dụng các mẫu hiện đại trong phát triển frontend. Tối ưu hiệu năng, quản lý trạng thái và tuân theo thực hành tốt nhất với React và Next.js.