asBoxDecoration static method

BoxDecoration asBoxDecoration(
  1. double elevation, {
  2. Color? color,
  3. bool preserveOpacity = true,
})

kElevationToShadow only contains values for

key: 0, 1, 2, 3, 4, 6, 8, 9, 12, 16, 24

Optionally override the color of the kElevationToShadow shadows; further set preserveOpacity false to override the Material-standard shadow opacities with that of color.

If elevation is a value not directly found in kElevationToShadow, asBoxShadows will lerp between the two closest options.

Requests in range 24 < elevation <= 100

lerp between established kElevationToShadow.last and Elevation-created _kArbitraryElevation100.

See 🕴 Elevation documentation for more information.

Implementation

static BoxDecoration asBoxDecoration(
  double elevation, {
  Color? color,
  bool preserveOpacity = true,
}) =>
    BoxDecoration(
        boxShadow: Elevation.asBoxShadows(
      elevation,
      color: color,
      preserveOpacity: preserveOpacity,
    ));