PageMediaData
Represents the environmental metrics of a page or window.
This data is updated whenever the platform window or layout changes, such as when rotating a device, resizing a browser window, or adjusting system UI elements like the keyboard or safe areas.
Properties
-
always_use_24_hour_format(bool) –Whether to use 24-hour format when formatting time.
-
device_pixel_ratio(float) –The number of device pixels for each logical pixel.
-
orientation(Orientation) –The orientation of the page.
-
padding(Padding) –The space surrounding the entire display, accounting for system UI
-
view_insets(Padding) –Areas obscured by system UI overlays, such as the on-screen keyboard
-
view_padding(Padding) –Similar to
padding, but includes padding that is always reserved
Properties#
always_use_24_hour_format
class-attribute
instance-attribute
#
always_use_24_hour_format: bool = False
Whether to use 24-hour format when formatting time.
Note
The behavior of this flag is different across platforms:
- On Android this flag is reported directly from the user settings called "Use 24-hour format". It applies to any locale used by the application, whether it is the system-wide locale, or the custom locale set by the application.
- On iOS this flag is set to true when the user setting called "24-Hour Time" is set or the system-wide locale's default uses 24-hour formatting.
device_pixel_ratio
instance-attribute
#
device_pixel_ratio: float
The number of device pixels for each logical pixel.
padding
instance-attribute
#
padding: Padding
The space surrounding the entire display, accounting for system UI like notches and status bars.