feature: Allow changing ResizablePanel size and content
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start with the Python ResizablePanel and ResizablePanelGroup APIs and trace how changes to content and default_size are sent to the Flutter panel widgets. Reproduce the sample by changing both properties after the group is mounted, then inspect the related update path and tests. Done means direct property updates change panel content and sizes without rebuilding the panel list or losing existing scroll state.
由索引模型根据 Issue 内容生成。
描述
Duplicate Check
- I have searched the opened issues and there are no duplicates
Describe the requested feature
Thanks for the nice ResizablePanel addition. I'm requesting some improvements though:
Currently it does not seem to be possible to change the content, or programmatically change the sizes of the ResizablePanels once they have been added to ResizablePanelGroup.panels.
I'd expect the following sample code to change the panel sizes and content when the button is clicked, but neither are changing:
import flet as ft
import flet_shadcn_ui as shad
def main(page: ft.Page):
panelgroup = shad.ResizablePanelGroup(
width=500,
height=200,
panels=[
shad.ResizablePanel(default_size=0.8, content=ft.Text("One")),
shad.ResizablePanel(default_size=0.2, content=ft.Text("Two")),
],
)
page.add(panelgroup)
def on_click():
panelgroup.panels[0].default_size=0.5
panelgroup.panels[0].content=ft.Text("Three")
panelgroup.panels[1].default_size=0.5
panelgroup.panels[1].content=ft.Text("Four")
panelgroup.update()
print("button clicked")
page.add(
ft.Button(
content="click",
on_click=on_click,
)
)
if __name__ == "__main__":
ft.run(main)
If the ResizablePanelGroup.panels list is fully reassigned, the content does seem to change, however the panel sizes remain unchanged:
def on_click():
panelgroup.panels=[
shad.ResizablePanel(default_size=0.5, content=ft.Text("Three")),
shad.ResizablePanel(default_size=0.5, content=ft.Text("Four")),
]
panelgroup.update()
print("button clicked")
However chaning the content this way has the disadvantage that any existing panel content are re-added on the page, and for example the scroll position of any ScrollableControl will be lost.
Only thing that seems to change the sizes currently is if the number of items in ResizablePanelGroup.panels changes:
def on_click():
panelgroup.panels=[
shad.ResizablePanel(default_size=0.6, content=ft.Text("One")),
shad.ResizablePanel(default_size=0.2, content=ft.Text("Two")),
shad.ResizablePanel(default_size=0.2, content=ft.Text("Three")),
]
panelgroup.update()
print("button clicked")
EDIT: I relized that even in this case the default_size values aren't abided, but each ResizablePanel always will be equal size.
Please allow changing the ResizablePanel size and content directly via the content and default_size properties.
Suggest a solution
No response
Screenshots
No response
Additional details
No response
- 主要语言
- Python
- 星标
- 17.6k
- 派生
- 753
- 平均合并
- 2 天 8 小时
- 30 天内合并 PR
- 64
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
flet-dev/flet 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
feature request
难度 2/5 1-3 小时 新手友好度 66/100
flet-dev/flet#6985 · 3 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
bug: dataclass_transform() uses should include `field_specifiers` argument可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
Desktop 0.86.x: silent callback crashes, ambiguous run_thread/run_task semantics, and focus() no-op via run_task可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 5/5 一周以上 新手友好度 25/100
维护者通常 1 天内回复
-
bug: InputFilter number checking可能已有人在做 @ndonkoHenri 今天认领。 未关闭bug
flet-dev/flet#7098 · 已指派 1 人 ·
维护者通常 1 天内回复
相似的 Issue
-
CI flake: test-windows times out spawning Node in tests/test_antigravity_node_hooks.py (develop red)未关闭area/ci P2
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 2 天内回复
-
benchmark
难度 1/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 79/100
-
难度 2/5 1-3 小时 新手友好度 77/100
mozilla-ai/cq#601 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复