-
Notifications
You must be signed in to change notification settings - Fork 607
v1: Rename ConstrainedControl to LayoutControl, swap Button and ElevatedButton
#5592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Refactored all usages of ConstrainedControl to LayoutControl across control implementations. Introduced LayoutControl as the new wrapper for layout constraints, with ConstrainedControl now extending LayoutControl for backward compatibility. Updated documentation and example paths to reflect the new naming and organization.
Replaces the ElevatedButton control with Button throughout the codebase, consolidating button logic into a single Button class. ElevatedButton is now a deprecated alias for Button. Updates all usages, tests, and control registration to use Button, simplifying the API and improving maintainability.
Updated all Python example files to use ft.Button instead of ft.ElevatedButton for consistency with the latest Flet API. This affects authentication, controls-gallery, routing-navigation, studio-gallery, desktop-window-manager, and other sample apps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a comprehensive refactoring to modernize the button control architecture in Flet. It renames ConstrainedControl to LayoutControl and swaps the roles of Button and ElevatedButton to better align with Material Design 3 guidelines.
- Renames
ConstrainedControltoLayoutControlwith a deprecated alias for backward compatibility - Makes
ElevatedButtona deprecated alias that inherits from the newButtonclass - Updates all control classes to inherit from
LayoutControlinstead ofConstrainedControl
Reviewed Changes
Copilot reviewed 280 out of 328 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
layout_control.py |
Renames ConstrainedControl to LayoutControl and adds deprecated alias |
button.py |
Moves elevated button implementation to become the main Button class |
elevated_button.py |
Converts to deprecated alias that inherits from Button |
| Various control files | Updates inheritance from ConstrainedControl to LayoutControl |
| Documentation and examples | Updates references from ElevatedButton to Button throughout |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Deploying flet-docs with
|
| Latest commit: |
81b4d48
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://cc03d05f.flet-docs.pages.dev |
| Branch Preview URL: | https://v1-layout-control.flet-docs.pages.dev |
| ElevatedButton( | ||
| Button( | ||
| style=ft.ButtonStyle(padding=0), | ||
| text="-", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be content over here (and in other buttons of the file) instead of text.
Can you please rename while at it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've fixed this particular file, but others need more attention. Most of the examples, are either non-runnable or are in old style. I want to do a different PR and go through all examples one-by-one.
Replaces deprecated 'colors' import with 'Colors' and updates Button controls to use 'content' instead of 'text'. Also changes alignment to use MainAxisAlignment.END and updates class inheritance from UserControl to Container for improved compatibility with Flet API.
Close #5589