Material constructor
Creates a piece of material.
The type
, elevation
, shadowColor
, and animationDuration
arguments
must not be null.
If a shape
is specified, then the borderRadius
property must be
null and the type
property must not be MaterialType.circle. If the
borderRadius
is specified, then the type
property must not be
MaterialType.circle. In both cases, these restrictions are intended to
catch likely errors.
Implementation
const Material({
Key key,
this.type = MaterialType.canvas,
this.elevation = 0.0,
this.color,
this.shadowColor = const Color(0xFF000000),
this.textStyle,
this.borderRadius,
this.shape,
this.clipBehavior = Clip.none,
this.animationDuration = kThemeChangeDuration,
this.child,
}) : assert(type != null),
assert(elevation != null),
assert(shadowColor != null),
assert(!(shape != null && borderRadius != null)),
assert(animationDuration != null),
assert(!(identical(type, MaterialType.circle) && (borderRadius != null || shape != null))),
assert(clipBehavior != null),
super(key: key);