widget-based-design
它能做什么
这份指南讲解如何制作“小组件”。小组件就像迷你应用,是可以在屏幕上自由摆放的功能模块,外观上模仿 iOS 主屏幕的样式。
适用场景
- ✓当你想制作可以随意重新排列的信息模块时。
- ✓当你想参考 iOS 主屏幕的美学风格时。
- ✓当你想设计可自定义的迷你应用时。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/design-it/widget-based-design/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“怎样才能做出一个主屏幕设计,让其中的模块看起来像 iOS 小组件?”
每周 5 个新技能,1 分钟读完。
工作原理
这种设计依赖固定尺寸(正方形或长方形)的模块,重点是快速展示关键信息。圆角和鲜艳的颜色是常见特征。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Widget-Based Design
"Miniature applications. Small, highly functional blocks of UI designed to be rearranged."
When to Use
Use this sub-style when the user's request matches the aesthetic described above. This is a child reference of the design-it skill and is not meant to be triggered directly.
Core Principles
- Strict Aspect Ratios: Widgets usually follow strict sizes (1x1 square, 2x1 rectangle, 2x2 large square).
- Glanceability: Widgets show the most important piece of data instantly. Deep interaction usually requires opening the full app.
- Corner Radius Match: The inner content's border radius should perfectly nest within the widget's outer border radius.
Visual DNA
- Colors: Widgets often use bright, solid color backgrounds or full-bleed photos to differentiate themselves.
- Typography: Large, bold numbers (like a clock or weather temp) paired with tiny sub-labels.
- Layout: Similar to Bento UI, but specifically focused on functional app-lets rather than just content layout.
Web Implementation
- CSS Example:
.widget-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
grid-auto-rows: 160px; /* Force squares */
gap: 16px;
padding: 32px;
}
.widget {
background-color: #ffffff;
border-radius: 24px; /* Classic iOS widget radius */
box-shadow: 0 8px 24px rgba(0,0,0,0.08);
padding: 16px;
display: flex;
flex-direction: column;
justify-content: space-between;
overflow: hidden;
position: relative;
}
/* Specific Sizes */
.widget-small { grid-column: span 1; grid-row: span 1; }
.widget-medium { grid-column: span 2; grid-row: span 1; }
.widget-large { grid-column: span 2; grid-row: span 2; }
/* Weather Widget Example */
.widget.weather {
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
color: white;
}
.weather-temp { font-size: 3rem; font-weight: 300; }
.weather-icon { position: absolute; top: 16px; right: 16px; font-size: 2rem; }
App Implementation
SwiftUI
struct WidgetDesignView: View {
let columns = [GridItem(.flexible(), spacing: 16), GridItem(.flexible(), spacing: 16)]
var body: some View {
ScrollView {
LazyVGrid(columns: columns, spacing: 16) {
// 2x1 Widget
WeatherWidget()
.frame(height: 160) // Base unit height
// 1x1 Widget
FitnessWidget()
.frame(height: 160)
// 1x1 Widget
MusicWidget()
.frame(height: 160)
}
.padding(24)
}
.background(Color(white: 0.95))
}
}
struct WeatherWidget: View {
var body: some View {
ZStack(alignment: .topTrailing) {
LinearGradient(colors: [Color(hex: "4facfe"), Color(hex: "00f2fe")], startPoint: .topLeading, endPoint: .bottomTrailing)
Image(systemName: "cloud.sun.fill")
.foregroundColor(.white)
.font(.system(size: 40))
.padding()
VStack(alignment: .leading) {
Spacer()
Text("72°")
.font(.system(size: 48, weight: .thin))
.foregroundColor(.white)
Text("San Francisco")
.font(.subheadline)
.foregroundColor(.white.opacity(0.8))
}
.frame(maxWidth: .infinity, alignment: .leading)
.padding()
}
.cornerRadius(24) // Classic iOS widget radius
.shadow(color: .black.opacity(0.1), radius: 10, y: 5)
}
}
- SwiftUI is perfect for this. The
LazyVGridhandles the layout, andcornerRadius(24)matches Apple's default widget styling perfectly. - Use
ZStackas the root of the widget to easily overlay content on top of complex gradients or images.
Flutter
class WidgetDesignScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFFF2F2F2),
body: GridView.count(
crossAxisCount: 2, // 2 columns for a typical phone
padding: const EdgeInsets.all(24),
mainAxisSpacing: 16,
crossAxisSpacing: 16,
childAspectRatio: 1.0, // 1x1 squares
children: [
// Note: Flutter GridView doesn't easily span rows/cols out of the box.
…
常见问题
什么是“宽高比”?
宽高比指的是元素宽度和高度之间的比例。小组件通常使用固定比例,比如1x1(正方形)或2x1(长方形)。
“一眼可读”是什么意思?
指最重要的信息无需过多操作,就能被快速看到并理解。
为什么圆角很重要?
这样模块内部的内容才能与模块自身的圆角轮廓完美契合,形成统一的视觉效果,就像 iOS 小组件那样。
详情
作者的原始描述
Web and App implementation guide for Widget-Based Design. Trigger when user wants modular blocks, iOS Home Screen aesthetics, and customizable mini-apps.
热度
- GitHub 星标
- 48k
- 排名
- #4424
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。