Slide 90
Slide 90 text
@override
Widget build(BuildContext context) {
final Color? backgroundColor =
_getBackgroundColor(context);
assert(
backgroundColor != null ||
widget.type == MaterialType.transparency,
'If Material type is not MaterialType.transparency,
‘a color must either be passed in through the
‘`color` property, or be defined in the theme',
);
…
if (widget.type == MaterialType.transparency) {
return _transparentInterior(
shape: shape,
clipBehavior: widget.clipBehavior,
contents: contents,
);
}
return _MaterialInterior(…);
}

90
MaterialType.transparencyによる挙動の違い
Material
static Widget _transparentInterior({… }) {
final _ShapeBorderPaint child =
_ShapeBorderPaint(…);
return ClipPath(
clipper: ShapeBorderClipper(
shape: shape,
textDirection:Directionality.maybeOf(context)
),
…
);
}