StreamElevation class
Material elevation primitives, in logical pixels, for the Stream design system.
The design system describes four elevation levels. Each level is specified as
both a drop shadow and a Material level, and Flutter renders drop shadows
through Material, so the logical-pixel value is the representation used
here:
| Design system token | Material level | Logical pixels |
|---|---|---|
elevation-1 |
1 | 1 |
elevation-2 |
2 | 3 |
elevation-3 |
3 | 6 |
elevation-4 |
3–4 | 6–8 |
Pass these to Material.elevation (or to a component theme's elevation
field) rather than painting a BoxShadow. See StreamBoxShadow for the
cases where Material cannot render the shadow, such as text shadows.
The four levels are themeable, so an app can retune the whole system at
once. none is not — it is always 0.
{@tool snippet}
Elevate a surface to the level used by floating components:
Material(
elevation: context.streamElevation.level3,
child: child,
);
{@end-tool}
- Annotations
-
- @immutable
- @ThemeGen.new()
Constructors
- StreamElevation({double level1 = 1, double level2 = 3, double level3 = 6, double level4 = 8})
-
Creates a StreamElevation with the default values.
const
Properties
- canMerge → bool
-
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- level1 → double
-
Low elevation, for subtle separation.
final
- level2 → double
-
Medium-low elevation.
final
- level3 → double
-
Medium-high elevation.
final
- level4 → double
-
High elevation, for the most prominent surfaces.
final
- none → double
-
No elevation, for a surface flush with its background.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
copyWith(
{double? level1, double? level2, double? level3, double? level4}) → StreamElevation -
inherited
-
merge(
StreamElevation? other) → StreamElevation -
inherited
-
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
-
lerp(
StreamElevation? a, StreamElevation? b, double t) → StreamElevation? - Linearly interpolates between two StreamElevation instances.