LayoutValue<T> class
abstract
A responsive value that adapts dynamically to the width of the screen.
The valueBuilder
callback returns the responsive value for a given container
width.
final isTablet = FluidValue.fromWidth((containerWidth) {
return containerWidth >= 600;
});
Calculating the responsive values is usually done by this library automatically
but it can also be calculated with the following methods:
To get the value for a given width screen use the method resolveForWidth
.
If there is a Layout inside the widget you can also use resolveForContext
that will automatically calulate the value for the container width provided by
the closest Layout inside the upper widget tree from the context
referenced
provided as param.
See also:
- BreakpointValue, a value that adapts dinamically to relative width screen breakpoints
- Implementers
Constructors
- LayoutValue()
-
const
- LayoutValue.constant(T value)
-
factory
- LayoutValue.fromBreakpoint({required T xs, T? sm, T? md, T? lg, T? xl})
-
factory
-
LayoutValue.widthBuilder(_WidthBuilder<
T> builder) -
factory
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
-
resolve(
BuildContext context) → T -
resolveForLayout(
LayoutData layout) → T -
resolveForLayoutData(
double width, LayoutBreakpoint breakpoint) → T -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
breakpointBuilder<
T> (BreakpointValueBuilder< T> builder) → LayoutValue<T>
Constants
- screenWidth → const _ScreenWidthValue