Skip to content

Conversation

@InesaFitsner
Copy link
Contributor

@InesaFitsner InesaFitsner commented Nov 19, 2025

Description

Test Code

# Test code for the review of this PR

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

  • I signed the CLA.
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing tests pass locally with my changes
  • I have made corresponding changes to the documentation (if applicable)

Screenshots

Additional details

Summary by Sourcery

Refine and fix various Python SDK example scripts by updating code to match current APIs, correcting constant names, improving functionality in data table sorting and infinite scrolling, consolidating dialog component instantiation, and cleaning up imports and formatting. Add new declarative drag-and-drop examples for grouping and ordering, update dependencies for chart support, and refresh documentation sections accordingly.

New Features:

  • Add new declarative drag-and-drop grouping and ordering examples for containers and items

Enhancements:

  • Enable sortable columns in DataTable2 example and streamline instance creation
  • Update example scripts to use updated API properties (e.g., Colors constants, Border/BorderRadius constructors, key attribute, ft.Button instead of ElevatedButton)
  • Consolidate dialog components for DatePicker and DateRangePicker and reuse instances across clicks
  • Improve infinite scrolling and gesture detector examples by fixing scroll/key handling and using local_delta
  • Clean up SVG, text span, and canvas example formatting and expand content containers

Build:

  • Add matplotlib, plotly, and kaleido dependencies for PlotlyChart support

Documentation:

  • Add imperative/declarative sections to draggable.md
  • Refresh bottomsheet.md example snippet

Updated brush_on_image.py to remove invalid width and set expand on Stack for proper layout. Added a missing newline in bottomsheet.md for improved markdown formatting.
Refactored chart and color examples for improved clarity and modern Python practices, including use of dataclasses and async clipboard handling. Enhanced custom scrollbar and infinite scrolling examples with more realistic content and fixed key usage. Updated documentation to require both 'plotly' and 'kaleido' for PlotlyChart. Added 'matplotlib', 'plotly', and 'kaleido' to dependencies in pyproject.toml.
Updated scroll event handler to use generic OnScrollEvent type in column example. Replaced ft.border.all with ft.Border.all in nested container themes example for correct class usage.
Replaced deprecated usages in CupertinoButton and CupertinoRadio examples to match updated Flet API. Refactored CupertinoTimerPicker example to simplify timer value handling and fix event data usage.
Corrected color constant names and border usage in DataTable examples. Refactored sorting logic in datatable2 example to properly sort data and update table state, and fixed initialization of sorted data and DataTable2 instance.
Moves DatePicker creation outside the button click handler to reuse the same instance. This simplifies the code and avoids creating a new DatePicker object on each click.
Moves DateRangePicker creation outside the button click handler to avoid redundant instantiation. The picker is now created once and reused when the button is clicked.
Deleted ordering.py and outer_inner.py from the drag_target_and_draggable examples to clean up deprecated or redundant code. Also fixed a color constant typo in drag_and_drop_containers.py.
Added two new Python examples demonstrating declarative drag-and-drop: one for containers and one for ordering items and groups. Updated draggable.md documentation to reference the new declarative containers example.
Renamed 'reactive.py' to 'declarative.py' for clarity. Removed unused logging setup from 'basic.py'. Fixed icon name reference in 'dropdown_random_icon.py' to use 'icon.icon' instead of 'icon.name'.
Replaces incorrect usage of 'name' with 'icon' for the trailing property in ExpansionTile event handlers. Also updates SnackBar text assignment for ruff formatting.
Replaced usage of delta_x and delta_y with local_delta.x and local_delta.y in draggable_containers.py for more accurate drag updates. Simplified mouse cursor change logic in mouse_cursors.py by using random.choice instead of a generator.
Added app_icon_512.png and updated gallery.py to use the new image asset. Fixed property names and usage in static_svg.py, handling_events.py, and outlined_button/icons.py to use correct constants and class references for colors, margins, and icons.
Replaces 'ft.Colors.BLACK54' with 'ft.Colors.BLACK_54' to use the correct color constant for the button border.
Changed event handler print statements to output the control object instead of its uid for better debugging and information in rich text example.
Corrected multi-line string assignment in prefix_and_suffix.py to properly display textbox values. Updated styled.py to use the correct color constant 'BLACK_26' instead of 'BLACK26'.
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a 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

Comment on lines +6 to 24
if e.control.data:
if e.control.data == 1:
row1.selected = not row1.selected
case 2:
elif e.control.data == 2:
row2.selected = not row2.selected
case 3:
elif e.control.data == 3:
row3.selected = not row3.selected
page.update()

def handle_column_sort(e: ft.DataColumnSortEvent):
match e.control.data:
case 1:
if e.control.data:
if e.control.data == 1:
print(f"{e.column_index}, {e.ascending}")
# table.sort_column_index = 1
table.sort_ascending = e.ascending
case 2:
elif e.control.data == 2:
print(f"{e.column_index}, {e.ascending}")
# table.sort_column_index = 2
table.sort_ascending = e.ascending
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.control.data could be stored in a variable for better code readability.

Eliminated unnecessary logging configuration and logger level settings from the drag_and_drop_ordering_declarative.py example to simplify the code.
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Nov 19, 2025

Deploying flet-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0189602
Status: ✅  Deploy successful!
Preview URL: https://db38ab19.flet-docs.pages.dev
Branch Preview URL: https://inesa-test-examples.flet-docs.pages.dev

View logs

matplotlib, plotly, and kaleido have been moved from main dependencies to dev dependencies in pyproject.toml. This reduces the default install footprint for end users and keeps plotting tools available for development and testing.
@FeodorFitsner FeodorFitsner merged commit fd461e4 into main Nov 20, 2025
18 checks passed
@FeodorFitsner FeodorFitsner deleted the inesa/test-examples branch November 20, 2025 01:07
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.

4 participants