Material constructor

const Material({Key key, MaterialType type: MaterialType.canvas, double elevation: 0.0, Color color, Color shadowColor: const Color(0xFF000000), TextStyle textStyle, BorderRadiusGeometry borderRadius, ShapeBorder shape, bool borderOnForeground: true, Clip clipBehavior: Clip.none, Duration animationDuration: kThemeChangeDuration, Widget child })

Creates a piece of material.

The type, elevation, shadowColor, borderOnForeground and animationDuration arguments must not be null. Additionally, elevation must be non-negative.

If a shape is specified, then the borderRadius property must be null and the type property must not be If the borderRadius is specified, then the type property must not be In both cases, these restrictions are intended to catch likely errors.


const Material({
  Key key,
  this.type = MaterialType.canvas,
  this.elevation = 0.0,
  this.shadowColor = const Color(0xFF000000),
  this.borderOnForeground = true,
  this.clipBehavior = Clip.none,
  this.animationDuration = kThemeChangeDuration,
}) : assert(type != null),
     assert(elevation != null && elevation >= 0.0),
     assert(shadowColor != null),
     assert(!(shape != null && borderRadius != null)),
     assert(animationDuration != null),
     assert(!(identical(type, && (borderRadius != null || shape != null))),
     assert(clipBehavior != null),
     assert(borderOnForeground != null),
     super(key: key);