Motion.elevated constructor

Motion.elevated({
  1. Key? key,
  2. required int elevation,
  3. required Widget child,
  4. MotionController? controller,
  5. BorderRadius? borderRadius,
  6. bool glare = true,
  7. bool shadow = true,
  8. bool translation = true,
  9. FilterQuality? filterQuality = defaultFilterQuality,
})

Creates a Motion widget by setting configurations according to the elevation of the widget.

This will influence the shadow's movement and offset, if greater than 0.

Higher elevation values allows to :

  • Blur and lower the shadow from behind your widget, as if it was floating higher
  • Increase the distance by which the widget will be translated on the X and Y axises

elevation may range from 0 to 100, allowing you to easily stay consistent accross your design.

Implementation

factory Motion.elevated({
  Key? key,
  required int elevation,
  required Widget child,
  MotionController? controller,
  BorderRadius? borderRadius,
  bool glare = true,
  bool shadow = true,
  bool translation = true,
  FilterQuality? filterQuality = defaultFilterQuality,
}) =>
    Motion(
      key: key,
      controller: controller,
      glare: glare ? GlareConfiguration.fromElevation(elevation) : null,
      shadow: shadow ? ShadowConfiguration.fromElevation(elevation) : null,
      translation: translation
          ? TranslationConfiguration.fromElevation(elevation)
          : null,
      borderRadius: borderRadius,
      filterQuality: filterQuality,
      child: child,
    );