-
Notifications
You must be signed in to change notification settings - Fork 607
feat: page.get_device_info() to get device informations
#5672
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
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 page.get_device_info() method to retrieve device information across different platforms (Web, Android, iOS, macOS, Linux, Windows). The implementation provides platform-specific device information classes with comprehensive device details.
- Adds new
get_device_info()method to the Page class that returns platform-specific device information - Creates comprehensive device information data structures for all supported platforms
- Upgrades device_info_plus dependency to enable additional device information features
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/python/packages/flet/src/flet/controls/page.py | Adds the get_device_info() method that returns platform-specific device info objects |
| sdk/python/packages/flet/src/flet/controls/device_info.py | Defines comprehensive device information data classes for all platforms |
| sdk/python/packages/flet/src/flet/init.py | Exports all device info classes in the public API |
| packages/flet/pubspec.yaml | Upgrades device_info_plus dependency from ^11.2.0 to ^12.1.0 |
| packages/flet/lib/src/utils/device_info.dart | Implements device info collection logic for Flutter/Dart side |
| packages/flet/lib/src/controls/page.dart | Adds device info method handler and minor theme parsing improvements |
| sdk/python/packages/flet/src/flet/controls/layout_control.py | Adds missing ConstrainedControl to all exports |
| sdk/python/packages/flet/src/flet/controls/core/keyboard_listener.py | Adds missing keyboard event classes to all exports |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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
Deploying flet-docs with
|
| Latest commit: |
46dd7f4
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://54b22ca0.flet-docs.pages.dev |
| Branch Preview URL: | https://device-info.flet-docs.pages.dev |
|
|
I'd keep |
Replaced direct class instantiation with the from_dict utility for device info objects in Page.get_device_info. This improves consistency and handles dictionary-to-object conversion more robustly.
Introduces JSAny type and conditional JS interop import for Dart, enabling serialization of JS interop objects in FletMsgpackEncoder. Updates protocol.py to handle new ext type code for JSAny. Also comments out unused HTML view sections and updates PyPI cleanup version pattern.
Fix #1938
Test Code
Note
page.client_user_agentcould be removed in favor ofpage.get_device_info().user_agentfor webSummary by Sourcery
--
Implement a unified page.get_device_info() API across Python and Flutter SDKs, including new platform-specific DeviceInfo types and a Dart mapping layer, and upgrade the device_info_plus dependency.
New Features:
Add get_device_info() method to Page in Python SDK and to Flutter PageControl for retrieving device information.
Enhancements:
Introduce platform-specific DeviceInfo dataclasses and WebBrowserName enum in Python SDK for typed device info.
Add Dart utility and BaseDeviceInfo extension to map device_info_plus data into a structured JSON representation.
Build:
Bump Flutter device_info_plus dependency from ^11.2.0 to ^12.1.0.