Repository navigation
feat: 布局补齐——weight、border、Column / Row 的 scroll - #8
Conversation
weight 由父 Row / Column 按 child 的 prop 造 Modifier.weight 经 CompositionLocal 交给 child,放在其 modifier 最外层;其他容器重置该 local。borderWidth / borderColor 插在 background 之后、与 cornerRadius 同一个 shape,宽 0 视为无边框(Compose 的 0.dp 是一像素 hairline), 色缺省 outline token。scroll 在 padding 之外。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
@coderabbitai review |
There was a problem hiding this comment.
Sorry @HarlonWang, you've used your own review budget of 250,000 diff characters for the last 7 days.
You can request another review in 2 days and 16 hours by commenting @sourcery-ai review. Upgrade to get a review now.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
审查者指南本 PR 在公共布局 schema、Compose 渲染和生成代码之间同步加入 weight、边框及 Row/Column 主轴滚动:weight 通过 CompositionLocal 从父布局注入子节点最外层 Modifier,边框复用圆角 shape 且正确忽略 0dp,滚动追加在容器基础 modifier 后;同时更新文档、示例、生成 API 与测试。 父级作用域子节点 weight 渲染时序图sequenceDiagram
participant Column
participant NodeScope
participant LocalChildModifier
participant Child
Column->>NodeScope: Children(childModifier)
NodeScope->>LocalChildModifier: provide Modifier.weight(weight)
LocalChildModifier->>Child: Render(child)
Child->>NodeScope: modifier()
NodeScope-->>Child: weight modifier outermost
布局 Modifier 组合流程图flowchart LR
A["Parent-scoped weight"] --> B["Size"]
B --> C["Clip with cornerRadius"]
C --> D["Background"]
D --> E["Border when borderWidth > 0"]
E --> F["Clickable"]
F --> G["Padding"]
文件级变更
提示和命令与 Sourcery 交互
自定义使用体验访问你的控制面板以:
获取帮助Original review guide in EnglishReviewer's Guide本 PR 在公共布局 schema、Compose 渲染和生成代码之间同步加入 weight、边框及 Row/Column 主轴滚动:weight 通过 CompositionLocal 从父布局注入子节点最外层 Modifier,边框复用圆角 shape 且正确忽略 0dp,滚动追加在容器基础 modifier 后;同时更新文档、示例、生成 API 与测试。 Sequence diagram for parent-scoped child weight renderingsequenceDiagram
participant Column
participant NodeScope
participant LocalChildModifier
participant Child
Column->>NodeScope: Children(childModifier)
NodeScope->>LocalChildModifier: provide Modifier.weight(weight)
LocalChildModifier->>Child: Render(child)
Child->>NodeScope: modifier()
NodeScope-->>Child: weight modifier outermost
Flow diagram for layout modifier compositionflowchart LR
A["Parent-scoped weight"] --> B["Size"]
B --> C["Clip with cornerRadius"]
C --> D["Background"]
D --> E["Border when borderWidth > 0"]
E --> F["Clickable"]
F --> G["Padding"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
CodeSeer 审查
结论:不批准(本轮 2 条严重或建议级意见)
摘要
本次改动为公共布局属性增加了 weight、边框,并为 Column/Row 增加主轴滚动;CompositionLocal 用于将父容器的 weight modifier 传递给直接子节点。边框的零宽处理和常规的 modifier 顺序基本符合描述。主要风险在于滚动容器与 weight 组合时会丢失可分配空间,以及公开的 NodeScope 接口新增了抽象方法,会破坏既有实现的兼容性。
整个 PR 至 648da17 · gpt-5.6-terra
滚动轴无界、没有剩余空间可分,weight 会被 Compose 压成 0,改为忽略; NodeScope 新重载默认回退到 Children(),既有实现不受影响。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
做了什么
TrendingAI 订阅页接入的框架第 2 步(共 3 步),三项都由订阅页的价格卡触发(
Column(Modifier.weight(1f))、选中卡 2dpprimary边框、整页verticalScroll)。规则见docs/components.md§2 / §3。weight(公共布局 prop,序列第 0 位):父Row/Column渲染 children 时按每个 child 的 prop 造Modifier.weight经LocalChildModifier交给它,child 的modifier()放最外层;Box/LazyColumn等把 local 重置,所以写错位置不生效也不报错borderWidth/borderColor(序列第 3.5 位,background之后):与cornerRadius同一个 shape;宽 0 视为无边框——Compose 的0.dp是一像素 hairline,第一版就被它咬了一次(截图核对时未选中行全出了细边);色缺省outlinetokenColumn/Row加scroll:沿主轴滚动,加在padding之后(padding 固定在滚动内容外)NodeScope.Children(childModifier)新增重载,Children()委托给它weight划掉,alignSelf仍等需求验证
scroll的 E5);apiCheck过weight={1}撑满、remove 靠右;已完成行 2dpprimary边框,未完成行无边框🤖 Generated with Claude Code
Sourcery 摘要
通过为 UI 框架添加加权子项、边框和轴向滚动功能,完善订阅页面集成所需的下一批布局能力。
新功能:
Row和Column的直接子项添加父级作用域的weight布局支持。scroll属性,为Row和Column添加主轴滚动功能。增强功能:
Row和非Column容器中隔离这些修饰符。文档:
测试:
weight、边框属性的解析和 schema 处理,并验证对不受支持的scroll属性的拒绝行为。杂项:
Original summary in English
Sourcery 总结
完成订阅页面集成所需的下一批布局功能。
新功能:
改进:
文档:
测试:
杂项:
Original summary in English
Summary by Sourcery
Complete the next layout capabilities needed for the subscription page integration.
New Features:
Enhancements:
Documentation:
Tests:
Chores: