mta-mcp 3.6.0 → 3.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  # Flutter 开发代理
2
2
 
3
3
  > 此 Agent 引导 AI 通过 MCP 工具获取 npm 包中的详细规范
4
- > 版本: v3.5.0 | 最后更新: 2026-01-23
4
+ > 版本: v3.6.0 | 最后更新: 2026-01-26
5
5
 
6
6
  ---
7
7
 
@@ -248,11 +248,24 @@ get_standard_by_id({ id: 'sketch-pitfalls' })
248
248
 
249
249
  | 关键点 | 说明 |
250
250
  |--------|------|
251
+ | **布局选择** | 测量元素 Y/X 坐标,不同则用 `Stack + Positioned`,相同才用 `Row/Column` |
252
+ | **还原原则** | 还原视觉效果,不是参数 - 参数正确不代表效果正确 |
251
253
  | **渐变色** | 检查 `fillType` 后读取 `gradient.stops`,勿直接用 `color` 属性 |
252
254
  | **全局样式** | 还原前先 grep 搜索项目现有 Token(颜色、圆角、阴影) |
253
255
  | **新拟态阴影** | 双阴影:右下深色 + 左上高光 |
254
256
  | **行高** | Flutter `height` 是比例值,非像素(如 24px/16px = 1.5) |
255
257
 
258
+ ### 🔴 布局选择原则(核心)
259
+
260
+ **当同一行/列的元素有不同的 top/left 值时,必须使用 Stack + Positioned!**
261
+
262
+ ```
263
+ ❌ Row/Column: 强制元素对齐到同一轴线,丢失独立位置控制
264
+ ✅ Stack + Positioned: 每个元素可独立定位到设计稿指定位置
265
+ ```
266
+
267
+ > 📖 **详细规范**:`get_standard_by_id({ id: 'design-restoration' })` → "布局选择原则" 章节
268
+
256
269
  ### 相关规范
257
270
 
258
271
  | 规范 | 调用方式 |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mta-mcp",
3
- "version": "3.6.0",
3
+ "version": "3.7.1",
4
4
  "description": "MTA - 智能编码助手 MCP 服务器(规范 + 技能 + 诊断 + 模板 + 记忆 + 思考)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -143,6 +143,131 @@ CSS: line-height: 24px 或 line-height: 1.5
143
143
 
144
144
  ---
145
145
 
146
+ ## 🔴 布局选择原则(最高优先级)
147
+
148
+ > **核心理念:还原的是视觉效果,不是参数**
149
+
150
+ ### 问题本质
151
+
152
+ 使用 `Row`、`Column`、`Flex` 等相对布局时,元素会被强制对齐到同一轴线,**失去独立的位置控制**。这导致即使测量数据正确,视觉效果仍然无法还原。
153
+
154
+ ### 🔴 判断标准(三种情况)
155
+
156
+ #### 情况 1:元素 Y 坐标各不相同 → 完全使用绝对定位
157
+
158
+ ```
159
+ 测量结果:
160
+ - 返回按钮: y=55
161
+ - 标题: y=61
162
+ - 客服图标: y=41
163
+
164
+ → 三个元素 Y 值都不同,必须每个单独 Positioned
165
+ ```
166
+
167
+ ```dart
168
+ // ✅ 正确:每个元素独立定位
169
+ Stack(
170
+ children: [
171
+ Positioned(left: 0, top: 11, child: backButton),
172
+ Positioned(left: 0, right: 0, top: 17, child: title),
173
+ Positioned(right: 0, top: -3, child: serviceIcon),
174
+ ],
175
+ )
176
+ ```
177
+
178
+ #### 情况 2:元素 Y 坐标相同 → 绝对定位 Y + 相对布局处理宽度
179
+
180
+ ```
181
+ 测量结果:
182
+ - 充值按钮: y=196, width=145
183
+ - 提现按钮: y=196, width=145
184
+
185
+ → Y 值相同,但需要响应式宽度
186
+ ```
187
+
188
+ ```dart
189
+ // ✅ 正确:外层 Positioned 定位 Y,内层 Row 处理宽度
190
+ Positioned(
191
+ left: 16,
192
+ right: 23,
193
+ top: 96, // 精确的 Y 坐标
194
+ child: Row(
195
+ children: [
196
+ Expanded(child: 充值按钮), // 宽度自适应
197
+ SizedBox(width: 21), // 固定间距
198
+ Expanded(child: 提现按钮), // 宽度自适应
199
+ ],
200
+ ),
201
+ )
202
+
203
+ // ❌ 错误:每个按钮单独 Positioned + 固定宽度
204
+ Positioned(left: 16, top: 96, child: SizedBox(width: 145, child: 充值按钮)),
205
+ Positioned(left: 182, top: 96, child: SizedBox(width: 145, child: 提现按钮)),
206
+ // 问题:无法响应式适配不同屏幕宽度!
207
+ ```
208
+
209
+ #### 情况 3:纯垂直排列 + 水平居中 → 直接使用 Column
210
+
211
+ ```
212
+ 测量结果:
213
+ - 图标容器: 水平居中
214
+ - 标题: 水平居中
215
+ - 描述: 水平居中
216
+ - 按钮: 水平居中
217
+
218
+ → 所有元素水平居中,垂直排列
219
+ ```
220
+
221
+ ```dart
222
+ // ✅ 正确:Column + Center,间距用 SizedBox
223
+ Column(
224
+ children: [
225
+ SizedBox(height: 40),
226
+ iconContainer,
227
+ SizedBox(height: 20),
228
+ title,
229
+ SizedBox(height: 7),
230
+ description,
231
+ SizedBox(height: 16),
232
+ button,
233
+ ],
234
+ )
235
+ ```
236
+
237
+ ### 完整判断流程
238
+
239
+ ```
240
+ 1. 测量同组元素的 Y 坐标
241
+ ├─ Y 坐标都不同 → 每个元素单独 Positioned
242
+ └─ Y 坐标相同 → 继续判断
243
+
244
+ 2. 判断是否需要响应式宽度
245
+ ├─ 需要(如按钮、输入框)→ Positioned 定位 Y + Row/Expanded 处理宽度
246
+ └─ 不需要(固定尺寸元素)→ 可以直接 Row
247
+
248
+ 3. 判断是否需要溢出
249
+ └─ 需要 → clipBehavior: Clip.none
250
+ ```
251
+
252
+ ### 常见错误
253
+
254
+ | 错误 | 原因 | 正确做法 |
255
+ |------|------|----------|
256
+ | Y 相同的按钮用单独 Positioned | 无法响应式适配 | 外层 Positioned + 内层 Row/Expanded |
257
+ | Y 不同的元素用 Row | 丢失独立 Y 坐标 | 每个元素单独 Positioned |
258
+ | 全部用固定宽度 | 不同屏幕显示错误 | 使用 Expanded 或百分比 |
259
+
260
+ ### 框架语法映射
261
+
262
+ | 场景 | Flutter | Vue/CSS | React |
263
+ |------|---------|---------|-------|
264
+ | 绝对定位容器 | `Stack` | `position: relative` | `position: relative` |
265
+ | 绝对定位元素 | `Positioned` | `position: absolute` | `position: absolute` |
266
+ | 水平均分 | `Row` + `Expanded` | `display: flex` + `flex: 1` | `display: flex` + `flex: 1` |
267
+ | 固定间距 | `SizedBox(width: 21)` | `gap: 21px` | `gap: 21px` |
268
+
269
+ ---
270
+
146
271
  ## 🎨 颜色规范
147
272
 
148
273
  ### 颜色提取完整流程