Thanks to visit codestin.com
Credit goes to github.com

Skip to content

v1: DateRangePicker and more integration tests#5642

Merged
FeodorFitsner merged 14 commits intomainfrom
inesa/v1-integration-tests-p6
Sep 26, 2025
Merged

v1: DateRangePicker and more integration tests#5642
FeodorFitsner merged 14 commits intomainfrom
inesa/v1-integration-tests-p6

Conversation

@InesaFitsner
Copy link
Contributor

@InesaFitsner InesaFitsner commented Sep 16, 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

Add Material-style DateRangePicker support with theming, register it in SDKs, remove obsolete locale setting, and provide examples and integration tests

New Features:

  • Introduce DateRangePicker control in Python and Dart SDKs with full customization properties

Enhancements:

  • Extend Theme API to include DataTable and DatePicker theme entries and remove deprecated locale from DatePickerTheme
  • Register DateRangePicker in core extensions and expose it in the Python package
  • Clarify ListTile hover_color behavior in documentation

Documentation:

  • Add DateRangePicker documentation page and basic example
  • Update mkdocs configuration to include test images and navigation entry for DateRangePicker

Tests:

  • Add integration tests for DateRangePicker functionality and theme rendering for both DatePicker and DateRangePicker

Chores:

  • Remove locale field and parsing logic from DatePickerTheme

Introduces an integration test for DatePicker theme customization with a golden screenshot for macOS. Updates docstrings for Theme class to clarify DataTableTheme and DatePickerTheme usage. Also refines ListTile hover_color docstring to specify when it takes effect.
DateRangePicker-related theme properties have been commented out in both Dart and Python implementations. This change likely reflects that these properties are not yet supported or are pending future implementation.
Introduced DateRangePicker control for both Dart and Python SDKs, including its registration in FletCoreExtension and Python __init__.py. This enables Material-style date range selection dialogs with customizable properties and event handling.
Introduces the DateRangePicker control to the Python SDK, including its implementation, example usage, documentation, and integration tests. Updates the Dart backend to support new properties and events for date range selection. Adds related documentation and navigation entry in mkdocs.
Updated the image path and size in the DateRangePicker documentation. Modified mkdocs.yml to include test images from integration_tests. Refactored date_range_picker.py to import DatePickerEntryMode from the material.date_picker module instead of defining it locally.
Uncommented and activated all DateRangePicker theme properties in both Dart and Python implementations, allowing full customization of elevation, background, header, shape, and selection colors. Also improved event handling in the Dart DateRangePicker control by passing the selected range to 'change' and 'dismiss' events.
Updated the 'basic' DateRangePicker test and golden image, and added a new 'properties1' test with corresponding screenshot. The new test covers various DateRangePicker properties to improve test coverage and reliability.
Renamed properties1.png to properties_calendar.png and added properties_input.png for input mode. Modified test_date_range_picker.py to capture screenshots for both calendar and input modes, improving test coverage for date picker entry modes.
Introduces a new integration test for the DateRangePicker theme on macOS, including a golden screenshot for visual regression. This ensures custom theme properties are correctly applied and rendered.
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

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Sep 16, 2025

Deploying flet-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 937a703
Status: ✅  Deploy successful!
Preview URL: https://3fd20270.flet-docs.pages.dev
Branch Preview URL: https://inesa-v1-integration-tests-p.flet-docs.pages.dev

View logs

--8<-- "../../examples/controls/date_range_picker/basic.py"
```

![basic](../test-images/controls/golden/macos/date_range_picker/basic.png){width="60%"}
Copy link
Contributor

Choose a reason for hiding this comment

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

I won't suggest we use references to golden images folder. The image for this example should be in examples/controls/daterangepicker/media. You could basically copy the golden image in there.

Comment on lines +149 to +151
- source_dir: integration_tests
target_url_path: test-images
include_exts: [".png", ".gif", ".svg"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be removed when addressing #5642 (comment).

Comment on lines -2076 to -2081
locale: Optional[Locale] = None
"""
An optional locale argument can be used to set the locale for the date picker. It
defaults to the ambient locale provided by Localizations.
"""

Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason for this change?

Copy link
Contributor

Choose a reason for hiding this comment

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

We currently don't have locale in DatePicker control, so it's being configured for the whole page via page.

@ndonkoHenri ndonkoHenri requested a review from Copilot September 17, 2025 05:09
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 introduces support for the DateRangePicker control with Material-style theming, integrates it into both Python and Dart SDKs, and includes comprehensive testing.

  • Adds DateRangePicker control with full customization properties for date range selection
  • Extends Theme API with improved documentation and removes deprecated locale field from DatePickerTheme
  • Provides integration tests, documentation, and examples for the new control

Reviewed Changes

Copilot reviewed 14 out of 20 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
sdk/python/packages/flet/src/flet/controls/theme.py Removes locale field from DatePickerTheme and adds documentation for theme properties
sdk/python/packages/flet/src/flet/controls/material/list_tile.py Clarifies hover_color behavior documentation
sdk/python/packages/flet/src/flet/controls/material/date_range_picker.py Implements new DateRangePicker control with comprehensive properties
sdk/python/packages/flet/src/flet/controls/material/date_picker.py Updates DatePicker documentation for consistency
sdk/python/packages/flet/src/flet/__init__.py Registers DateRangePicker in Python package exports
sdk/python/packages/flet/mkdocs.yml Adds DateRangePicker documentation and test image support
integration_tests/controls/test_date_range_picker_theme.py Tests DateRangePicker theme rendering
integration_tests/controls/test_date_range_picker.py Tests DateRangePicker functionality and properties
integration_tests/controls/test_date_picker_theme.py Tests DatePicker theme rendering
docs/controls/daterangepicker.md Provides DateRangePicker documentation page
examples/controls/date_range_picker/basic.py Basic example demonstrating DateRangePicker usage
packages/flet/lib/src/utils/theme.dart Comments out locale parsing in Dart theme implementation
packages/flet/lib/src/flet_core_extension.dart Registers DateRangePicker in Dart SDK
packages/flet/lib/src/controls/date_range_picker.dart Implements DateRangePicker control in Dart

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Corrected references and improved clarity in docstrings for DateRangePicker and ListTile controls. Updated event handler type annotations in the date_range_picker example for better type safety.
Replaced specific class references in docstrings with generic [(c).] links in DateRangePicker and ListTile controls. This change improves maintainability and consistency in documentation references.
Set 'inherited_members' to false in mkdocs.yml to exclude inherited members from documentation. Updated docstrings in date_range_picker.py and divider.py for improved clarity and accuracy.
Simplified the on_tap_down event handler type in the Container control to only accept TapEvent, removing support for Event. Also removed outdated documentation regarding the event argument type.
@FeodorFitsner FeodorFitsner merged commit 9dd1530 into main Sep 26, 2025
4 of 5 checks passed
@FeodorFitsner FeodorFitsner deleted the inesa/v1-integration-tests-p6 branch September 26, 2025 23:40
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