Skip to main content

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 - Whether to use 24-hour format when formatting time.
  • device_pixel_ratio - The number of device pixels for each logical pixel.
  • orientation - The orientation of the page.
  • padding - The space surrounding the entire display, accounting for system UI like notches and status bars.
  • view_insets - Areas obscured by system UI overlays, such as the on-screen keyboard or system gesture areas.
  • view_padding - Similar to padding, but includes padding that is always reserved (even when the system UI is hidden).

Properties

always_use_24_hour_formatclass-attributeinstance-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_ratioinstance-attribute

device_pixel_ratio: float

The number of device pixels for each logical pixel.

orientationinstance-attribute

orientation: Orientation

The orientation of the page.

paddinginstance-attribute

padding: Padding

The space surrounding the entire display, accounting for system UI like notches and status bars.

view_insetsinstance-attribute

view_insets: Padding

Areas obscured by system UI overlays, such as the on-screen keyboard or system gesture areas.

view_paddinginstance-attribute

view_padding: Padding

Similar to padding, but includes padding that is always reserved (even when the system UI is hidden).