FSResponsive class

Responsive utility class that provides methods for responsive design with performance optimizations and comprehensive breakpoint handling.

Constructors

FSResponsive({required double screenWidth, FSCustomBreakpoints breakpoints = const FSCustomBreakpoints()})
const
FSResponsive.fromContext(BuildContext context, {FSCustomBreakpoints? breakpoints})
Factory constructor from BuildContext using MediaQuery
factory
FSResponsive.of(double width, {FSCustomBreakpoints? breakpoints})
Factory constructor that creates responsive instance from screen width
factory

Properties

breakpoint FSBreakpoint
Get the current breakpoint based on screen width with LRU caching
no setter
breakpoints FSCustomBreakpoints
final
hashCode int
The hash code for this object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
screenWidth double
final

Methods

builder({required Widget builder(FSBreakpoint breakpoint), Widget? fallback}) Widget
Responsive widget builder for conditional rendering
copyWith({double? screenWidth, FSCustomBreakpoints? breakpoints}) FSResponsive
Create a copy with updated screen width
hide({required Widget child, bool hideOnXs = false, bool hideOnSm = false, bool hideOnMd = false, bool hideOnLg = false, bool hideOnXl = false, bool hideOnXxl = false, Widget? fallback}) Widget
Hide widget based on breakpoint (inverse of show)
isBreakpoint(FSBreakpoint breakpoint) bool
Check if current screen size is exactly a specific breakpoint
isEqualOrLargerThan(FSBreakpoint breakpoint) bool
Check if current screen size is equal to or larger than a specific breakpoint
isEqualOrSmallerThan(FSBreakpoint breakpoint) bool
Check if current screen size is equal to or smaller than a specific breakpoint
isLargerThan(FSBreakpoint breakpoint) bool
Check if current screen size is larger than a specific breakpoint
isSmallerThan(FSBreakpoint breakpoint) bool
Check if current screen size is smaller than a specific breakpoint
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
show({required Widget child, bool showOnXs = true, bool showOnSm = true, bool showOnMd = true, bool showOnLg = true, bool showOnXl = true, bool showOnXxl = true, Widget? fallback}) Widget
Conditional rendering based on breakpoint
toString() String
A string representation of this object.
override
value<T>({T? xs, T? sm, T? md, T? lg, T? xl, T? xxl, required T fallback}) → T
Responsive value selector with efficient fallback logic

Operators

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

Static Properties

cacheStats → (int, int, double)
Get cache statistics for performance monitoring
no setter

Static Methods

clearCache() → void
Clear the breakpoint cache (useful for testing and memory management)
layoutBuilder(BuildContext context, {required Widget builder(FSResponsive responsive), FSCustomBreakpoints? breakpoints}) Widget
Create a responsive layout builder widget
setCacheSize(int size) → void
Set cache size (useful for memory management in constrained environments)
valueBuilder<T>({required BuildContext context, required T valueSelector(FSResponsive responsive), required Widget builder(T value), FSCustomBreakpoints? breakpoints}) Widget
Create a responsive value builder widget