Window size classes for the adaptive design system.
The three thresholds match the Material 3 window size classes, which in practice also line up with the iPad form factors: below 600 is a phone, 600–840 a tablet in portrait or an unfolded foldable, 840–1200 a tablet in landscape, and beyond that a desktop-class window.
Breakpoints drive LAYOUT, never type size
This is the rule the whole file exists to enforce. A wider screen shows more content — more grid columns, a permanent sidebar, a detail pane next to the list — it does not show bigger text. Body text is 17pt on an iPhone SE and 17pt on a 13" iPad, exactly as it is in every first-party app on both platforms.
The only thing that legitimately changes text size is the user's own
accessibility setting (Dynamic Type on iOS, font size on Android), which
Flutter applies for you. For anything typographic go to
AdaptiveTypography in templates/foundation/adaptive_typography.dart;
never derive a fontSize from a value in this file.
Window width vs. available width
of reads the window through MediaQuery, which is the right measure for a full-screen page. A widget that occupies only part of the window — an iPad Slide Over pane, a detail pane, a dialog — must instead measure its own box with a LayoutBuilder and call fromWidth; otherwise a 300pt-wide pane on a 1200pt window believes it is a desktop.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
fromWidth(
double width) → ScreenSize -
The size class of an arbitrary
width, in logical pixels. -
of(
BuildContext context) → ScreenSize - The size class of the current window.
Constants
- compact → const double
- Upper bound of ScreenSize.compact — phones in portrait.
- expanded → const double
- Upper bound of ScreenSize.expanded — tablets in landscape, small desktop windows. Anything wider is ScreenSize.large.
- medium → const double
- Upper bound of ScreenSize.medium — tablets in portrait, foldables.