diff --git a/packages/flutter/lib/src/material/material.dart b/packages/flutter/lib/src/material/material.dart index 8a303782bb..0fa3ddca51 100644 --- a/packages/flutter/lib/src/material/material.dart +++ b/packages/flutter/lib/src/material/material.dart @@ -7,6 +7,7 @@ import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; import 'constants.dart'; +import 'shadows.dart'; import 'theme.dart'; /// Signature for the callback used by ink effects to obtain the rectangle for the effect. @@ -228,28 +229,11 @@ class _MaterialState extends State with TickerProviderStateMixin { ) ); if (config.type == MaterialType.circle) { - contents = new PhysicalModel( - shape: BoxShape.circle, - elevation: config.elevation, - color: backgroundColor, - child: contents, - ); - } else if (config.type == MaterialType.transparency) { - if (radius == null) { - contents = new ClipRect(child: contents); - } else { - contents = new ClipRRect( - borderRadius: radius, - child: contents - ); - } - } else { - contents = new PhysicalModel( - shape: BoxShape.rectangle, - borderRadius: radius ?? BorderRadius.zero, - elevation: config.elevation, - color: backgroundColor, - child: contents, + contents = new ClipOval(child: contents); + } else if (kMaterialEdges[config.type] != null) { + contents = new ClipRRect( + borderRadius: radius, + child: contents ); } if (config.type != MaterialType.transparency) { @@ -263,6 +247,7 @@ class _MaterialState extends State with TickerProviderStateMixin { child: new Container( decoration: new BoxDecoration( borderRadius: radius, + boxShadow: config.elevation == 0 ? null : kElevationToShadow[config.elevation], backgroundColor: backgroundColor, shape: config.type == MaterialType.circle ? BoxShape.circle : BoxShape.rectangle ),