GlassContainer.clearGlass constructor

GlassContainer.clearGlass({
  1. Key? key,
  2. required double height,
  3. required double width,
  4. AlignmentGeometry? alignment,
  5. Matrix4? transform,
  6. AlignmentGeometry? transformAlignment,
  7. EdgeInsetsGeometry? padding,
  8. EdgeInsetsGeometry? margin,
  9. Gradient? gradient,
  10. Color? color,
  11. BorderRadius? borderRadius,
  12. double? borderWidth,
  13. Gradient? borderGradient,
  14. Color? borderColor,
  15. double? blur,
  16. double? elevation,
  17. Color? shadowColor,
  18. BoxShape shape = BoxShape.rectangle,
  19. Widget? child,
})

Creates a widget that extends GlassContainer to implement a clear glass effect. Its a default implementation of the effect with editable decorations

  • If color and gradient are null, default value is assigned to gradient. Same goes for borderColor and borderGradient.
  • Default values are assigned to borderWidth, blur, elevation, and shadowColor properties if not specified.
  • If the shape is BoxShape.circle then height is used as the diameter.

See Constants

Implementation

GlassContainer.clearGlass({
  Key? key,
  required double height,
  required double width,
  AlignmentGeometry? alignment,
  Matrix4? transform,
  AlignmentGeometry? transformAlignment,
  EdgeInsetsGeometry? padding,
  EdgeInsetsGeometry? margin,
  Gradient? gradient,
  Color? color,
  BorderRadius? borderRadius,
  double? borderWidth,
  Gradient? borderGradient,
  Color? borderColor,
  double? blur,
  double? elevation,
  Color? shadowColor,
  BoxShape shape = BoxShape.rectangle,
  Widget? child,
})  : height = height,
      width = width,
      isFrostedGlass = false,
      frostedOpacity = 0.0,
      blur = blur ?? kBlur,
      gradient = gradient ?? (color == null ? kGradientFill : null),
      color = color,
      borderGradient = borderGradient ??
          (borderColor == null ? kBorderGradientFill : null),
      borderColor = borderColor,
      borderRadius = shape == BoxShape.rectangle
          ? (borderRadius ?? kBorderRadius)
          : null,
      borderWidth = borderWidth ?? kBorderWidth,
      elevation = elevation ?? kElevation,
      margin = margin,
      padding = padding,
      shadowColor = shadowColor ?? kShadowColor,
      shape = shape,
      transform = transform,
      transformAlignment = transformAlignment,
      alignment = alignment,
      child = child,
      assert(shape != BoxShape.circle || borderRadius == null,
          'The [borderRadius] needs to be null if the shape is [BoxShape.circle]\n'),
      assert(kIsWeb != true || borderColor != null,
          'borderColor cannot be null when runing on the Web\n'),
      super(key: key);