Skip to content

Conversation

@FeodorFitsner
Copy link
Contributor

Close #5589

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.
Copy link
Contributor

Copilot AI left a 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 ConstrainedControl to LayoutControl with a deprecated alias for backward compatibility
  • Makes ElevatedButton a deprecated alias that inherits from the new Button class
  • Updates all control classes to inherit from LayoutControl instead of ConstrainedControl

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.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Aug 23, 2025

Deploying flet-docs with  Cloudflare Pages  Cloudflare Pages

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

View logs

ElevatedButton(
Button(
style=ft.ButtonStyle(padding=0),
text="-",
Copy link
Contributor

@ndonkoHenri ndonkoHenri Aug 23, 2025

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?

Copy link
Contributor Author

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.
@FeodorFitsner FeodorFitsner merged commit 7b38442 into main Aug 24, 2025
4 checks passed
@FeodorFitsner FeodorFitsner deleted the v1-layout-control branch August 24, 2025 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v1: Rename ConstrainedControl to LayoutControl, swap Button and ElevatedButton

3 participants