physical_diagonal 2.0.0
physical_diagonal: ^2.0.0 copied to clipboard
Device and current-window physical screen diagonal (inches), with a configurable tablet-layout threshold.
2.0.0 #
Breaking rewrite. Nothing from 0.1.1 is backward compatible.
- Breaking:
PhysicalDiagonal.platformVersionremoved. Replaced byPhysicalDiagonal.ensureInitialized()(call beforerunApp) and thePhysicalMetricsScopewidget /context.physicalgetter. See README for the new usage. - Add:
windowDiagonal— physical diagonal of the current window, distinct fromdeviceDiagonal(the full-screen diagonal). Tracks split-screen, multi-window, folding, and Stage Manager resizing. - Add:
isTabletLayoutwith a configurabletabletThreshold. - Fix: Android now reads
computeCurrentWindowMetricsforwindowDiagonalandcomputeMaximumWindowMetricsfordeviceDiagonalseparately, guardsdisplay.getRealMetricsbehind an SDK check (real API 30+,minSdk21), and implements the fullComponentCallbacks2contract (onTrimMemoryincluded) so window/orientation changes push live updates. - Fix: Android namespace/package changed from the template default
com.example.physical_diagonaltodev.ivanitsky.physical_diagonal.namespaceis now declared inbuild.gradle(required by current AGP). - Fix: iOS unrecognized machine identifiers no longer report a fixed phone
diagonal (this inverted tablet detection for any iPad released after the
table was written). Falls back to
UIDevice.userInterfaceIdiom. - Fix: iOS identifier table — four entries corrected against Apple's
published identifiers (
iPhone14,3,iPhone14,5,iPhone14,7,iPad13,8/iPad13,9previously mapped to the wrong physical size). - Fix: iOS window-resize ratio computed from a
screenLogicalDiagonalvalue read from the activeUIWindowScene(with aUIScreen.mainfallback), instead of a hardcoded points-per-inch constant. - Add: Swift Package Manager support alongside CocoaPods
(
ios/physical_diagonal/Package.swift), ahead of the CocoaPods trunk read-only cutover (2026-12-02). iOS deployment target raised to 13.0 — required by theUIWindowScene/connectedScenesAPIs this release depends on. - Add:
example/app demonstratingensureInitialized,PhysicalMetricsScope, and a live threshold slider.
0.1.1 #
Adding proper documentation.
0.0.1 #
Physical diagonal of the screen helps to optimize design for Tablets/bigger screens. Calculation relies on system pixel density information, so it might be slightly inaccurate for Android devices (about 5%).