Bowen Xu
8982fb17bc
gpui: Allow chaining flex_grow() and flex_shrink() with custom factors (#58142)
Self-Review Checklist:
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
Release Notes:
- Allow chaining of `flex_grow()` and `flex_shrink()` with custom
factors, following Tailwind CSS conventions.
_For example:_
<img width="509" height="308" alt="aaa"
src="https://github.com/user-attachments/assets/02094fb2-d762-4ac9-a1d9-ef06e2fb047f"
/>
Before:
``` rust
div()
.flex()
.flex_row()
.size_full()
.bg(gpui::white())
.child(
div()
.map(|mut this| {
this.style().flex_grow = Some(1.);
this
})
.bg(gpui::blue()),
)
.child(
div()
.map(|mut this| {
this.style().flex_grow = Some(2.);
this
})
.bg(gpui::green()),
)
.child(
div()
.map(|mut this| {
this.style().flex_grow = Some(3.);
this
})
.bg(gpui::red()),
)
```
After:
``` rust
div()
.flex()
.flex_row()
.size_full()
.bg(gpui::white())
.child(div().flex_grow(1.).bg(gpui::blue()))
.child(div().flex_grow(2.).bg(gpui::green()))
.child(div().flex_grow(3.).bg(gpui::red()))
```
2026-06-01 04:40:13 +00:00
..
2026-05-19 17:45:07 +00:00
2026-06-01 04:40:13 +00:00
2026-05-29 15:27:28 +00:00
2026-05-21 08:32:23 +00:00
2026-05-06 09:36:43 +00:00
2026-05-27 10:31:57 +00:00
2026-04-21 09:01:42 +00:00
2026-06-01 04:40:13 +00:00
2026-06-01 04:40:13 +00:00
2026-06-01 03:19:28 +00:00
2026-05-28 13:27:55 +00:00
2026-05-19 10:05:49 +00:00
2026-05-26 15:11:19 +00:00
2025-09-18 16:47:23 +00:00
2026-05-18 12:22:22 +00:00
2026-05-29 15:27:28 +00:00
2026-03-31 17:55:05 +02:00
2026-05-19 21:08:39 +00:00
2026-05-29 15:27:28 +00:00
2026-03-06 19:45:03 +05:30
2026-04-20 22:40:00 +05:30
2026-05-29 15:27:28 +00:00
2026-05-29 15:27:28 +00:00
2026-04-22 13:39:48 +00:00
2026-05-29 15:27:28 +00:00
2026-05-29 15:27:28 +00:00
2026-05-26 15:11:19 +00:00
2026-04-21 09:01:42 +00:00
2026-05-26 15:11:19 +00:00
2026-05-26 18:48:29 +00:00
2026-04-01 17:44:25 +02:00
2026-05-29 15:27:28 +00:00
2026-05-29 03:47:05 +00:00
2026-05-20 12:47:18 +00:00
2026-05-11 19:21:10 +00:00
2026-05-29 15:27:28 +00:00
2026-05-19 21:08:39 +00:00
2026-06-01 04:40:13 +00:00
2026-05-26 15:11:19 +00:00