GlassContainer.frostedGlass constructor
GlassContainer.frostedGlass({
- 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,
- double? frostedOpacity,
- Widget? child,
Creates a widget that extends GlassContainer to implement a frosted glass effect. Its a default implementation of the effect with editable decorations
- If
color
andgradient
are null, default value is assigned to gradient. Same goes forborderColor
andborderGradient
. - Default values are assigned to
borderWidth
,blur
,elevation
,frostedOpacity
andshadowColor
properties if not specified. - If the shape is BoxShape.circle then
height
is used as the diameter.
See Constants
Implementation
GlassContainer.frostedGlass({
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,
double? frostedOpacity,
Widget? child,
}) : height = height,
width = width,
isFrostedGlass = true,
frostedOpacity = frostedOpacity ?? kFrostedOpacity,
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);