-
Notifications
You must be signed in to change notification settings - Fork 564
v1: IconButton
variants
#5522
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
v1: IconButton
variants
#5522
Conversation
Deploying flet-docs with
|
Latest commit: |
bb8b967
|
Status: | ✅ Deploy successful! |
Preview URL: | https://9c8812e3.flet-docs.pages.dev |
Branch Preview URL: | https://v1-icon-button-variants.flet-docs.pages.dev |
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.
We've reviewed this pull request using the Sourcery rules engine
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
||
|
||
@pytest.mark.asyncio(loop_scope="module") | ||
async def test_button_1(flet_app: ftt.FletTestApp, request): | ||
flet_app.page.theme_mode = ft.ThemeMode.LIGHT | ||
await flet_app.assert_control_screenshot( | ||
request.node.name, | ||
ft.Button("Click me"), | ||
control=ft.Button("Click me"), |
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.
control
in that method is a normal, positional, required parameter. Why using it by name here?
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Refactored IconButton control to support filled, filled tonal, and outlined variants with dedicated constructors. Updated Python integration tests and golden image filenames to match new variant naming. Cleaned up API usage and removed unnecessary parameters and code in both Dart and Python implementations.
Deleted the inspect_golden_images.py script from integration test utilities. This script was used to check for mismatches between test functions and golden images, but is no longer needed.
Introduces a Python example for IconButton variants, including normal, disabled, and toggle states. Expands integration tests to cover disabled, selected, and unselected states for standard, filled, filled tonal, and outlined icon buttons, with corresponding golden images for macOS. Minor code cleanups and docstring updates are also included.
@@ -253,28 +253,6 @@ class _ViewControlState extends State<ViewControl> { | |||
child: scaffold); | |||
} | |||
|
|||
if (pageData?.widgetsDesign == PageDesign.material) { |
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 removed this hack as it messes really bad with the styling.
Removing this could affect some material controls when page.platform = ft.PagePlatform.MACOS
or IOS
is set. I don't know which controls though - we need to add tests for that.
Merged alert dialog body test into test_alert_dialog.py and removed test_alert_dialog_body.py. Updated screenshot assets and renamed files for consistency. Enhanced conftest.py with reusable app creation and added function-scoped fixture for tests. Added docstring to close_in_app_web_view method in url_launcher.py.
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.
We've reviewed this pull request using the Sourcery rules engine
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 introduces Material 3 icon button variants and a unified URL handling mechanism. The changes add support for filled, filled tonal, and outlined icon button variants, enhance URL handling with a new Url
type, and improve documentation throughout the codebase.
- Add FilledIconButton, FilledTonalIconButton, and OutlinedIconButton classes
- Introduce unified URL handling with
Url
type across Python and Dart SDKs - Enhance icon button styling with proper before_update hooks and validation
Reviewed Changes
Copilot reviewed 56 out of 78 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
sdk/python/packages/flet/src/flet/controls/material/icon_button.py | Adds new icon button variants and improves style handling with before_update validation |
sdk/python/packages/flet/src/flet/controls/types.py | Introduces new Url dataclass for consistent URL handling |
packages/flet/lib/src/controls/icon_button.dart | Updates Dart implementation to support icon button variants with proper constructors |
sdk/python/packages/flet/src/flet/controls/services/url_launcher.py | Refactors URL launching to use new Url type with improved parameter naming |
sdk/python/packages/flet/integration_tests/controls/test_icon_button.py | Adds comprehensive integration tests for all icon button variants |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
sdk/python/packages/flet/src/flet/controls/services/file_picker.py
Outdated
Show resolved
Hide resolved
sdk/python/packages/flet/src/flet/controls/material/icon_button.py
Outdated
Show resolved
Hide resolved
Replaced references to 'web' with 'web mode' across documentation, examples, and service classes for consistency and clarity. This affects user-facing messages, docstrings, and error handling in file picker and storage paths services.
Changed the assertion in IconButton.before_update to compare splash_radius against 0 instead of 0.0, ensuring the value is greater than zero regardless of type.
Closes #5469
Test Code
Summary by Sourcery
Introduce Material 3 icon button variants and update both Python SDK and Dart control implementations to support filled, filled tonal, and outlined IconButtons, while refining style handling and documentation for IconButton properties.
New Features:
Enhancements:
Documentation:
Summary by Sourcery
Introduce Material 3 icon button variants and a unified URL handling mechanism, refine style merging and validations, extend platform brightness event support, and update documentation, examples, and tests accordingly.
New Features:
Enhancements:
Documentation:
Tests: