ScreenSize enum

小屏手机优先的响应式设计

material3 https://m3.material.io/foundations/layout/applying-layout/window-size-classes Compact Width < 600 Phone in portrait Medium 600 ≤ width < 840 Tablet in portrait Foldable in portrait (unfolded) Expanded 840 ≤ width < 1200* Phone in landscape, Tablet in landscape , Foldable in landscape (unfolded) Desktop Large 1200 ≤ width < 1600 Desktop Extra-large 1600 ≤ width Desktop Ultra-wide

tailwindcss: https://www.tailwindcss.cn/docs/responsive-design#targeting-a-breakpoint-range sm 640px @media (min-width: 640px) { ... } md 768px @media (min-width: 768px) { ... } lg 1024px @media (min-width: 1024px) { ... } xl 1280px @media (min-width: 1280px) { ... } 2xl 1536px @media (min-÷÷width: 1536px) { ... } 命名模仿tailwindcss命名习惯

Inheritance
Available extensions

Values

min → const ScreenSize

即缺省档, mobile优先设计

const ScreenSize(minWidth: 0)
sm → const ScreenSize
const ScreenSize(minWidth: 640)
md → const ScreenSize
const ScreenSize(minWidth: 768)
lg → const ScreenSize
const ScreenSize(minWidth: 1024)
xl → const ScreenSize
const ScreenSize(minWidth: 1280)
xxl → const ScreenSize
const ScreenSize(minWidth: 1536)

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
minWidth double
final
name String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
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

best<T>(BuildContext context, {required T min, T? sm, T? md, T? lg, T? xl, T? xxl}) → T
bestWithWidth<T>(double screenWidth, {required T min, T? sm, T? md, T? lg, T? xl, T? xxl}) → T
为一个宽度的屏幕选择其相应的样式,概念和tailwindcss相似 屏幕宽度落在哪档的计算参考byScreen
byName(String name) ScreenSize
byScreen(double screenWidth) ScreenSize
计算当前屏幕宽度卡在哪一档,比如

Constants

values → const List<ScreenSize>
A constant List of the values in this enum, in order of their declaration.