From 20d401de1b06cce3e9b24a69c553bea1e18f34fe Mon Sep 17 00:00:00 2001 From: Hans Muller Date: Tue, 7 Mar 2017 17:15:29 -0800 Subject: [PATCH] Revert the new "physical model" shadow rendering code (#8636) --- .../flutter/lib/src/material/material.dart | 29 +++++-------------- 1 file changed, 7 insertions(+), 22 deletions(-) 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 ),