SPResponsive class

Provides convenient access to viewport-responsive information.

Use SPResponsive.of or the context.sp extension:

final responsive = context.sp;

if (responsive.isDesktop) {
  // Execute desktop-specific non-layout behavior.
}

Layout differences should generally be implemented with SPRow, SPCol, SPVisibility, and other responsive widgets instead of conditionally constructing completely separate page trees.

Annotations

Constructors

SPResponsive.fromSize(Size size, {SPBreakpoints breakpoints = SPBreakpoints.standard})
Creates responsive information from an explicit viewport size.
factory
SPResponsive.of(BuildContext context, {SPBreakpoints breakpoints = SPBreakpoints.standard})
Creates responsive information from the current MediaQuery.
factory

Properties

breakpoint → SPBreakpoint
Currently active breakpoint.
final
breakpoints → SPBreakpoints
Breakpoint configuration used to resolve breakpoint.
final
hashCode → int
The hash code for this object.
no setteroverride
height → double
Current viewport height.
no setter
isDesktop → bool
True from the lg breakpoint upward.
no setter
isLargeDesktop → bool
True from the xxl breakpoint upward.
no setter
isLg → bool
no setter
isMd → bool
no setter
isMobile → bool
True for xs and sm viewports.
no setter
isSm → bool
no setter
isTablet → bool
True for the md viewport.
no setter
isXl → bool
no setter
isXs → bool
no setter
isXxl → bool
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
size → Size
Current viewport size.
final
width → double
Current viewport width.
no setter

Methods

atLeast(SPBreakpoint minimum) → bool
Returns true when the active breakpoint is at least minimum.
below(SPBreakpoint minimum) → bool
Returns true when the active breakpoint is below minimum.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve<T>(SPResponsiveValue<T> value) → T
Resolves a responsive value using the already-known breakpoint.
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override