From d8c52527cc98003bc01b3c5bf7fd65655b2bd889 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Tue, 14 Jun 2016 09:33:41 -0700 Subject: [PATCH] Two minor improvements (#4554) Add `@required` for some required parameters in `RRect`. Use elvis operator to simplify a function. --- packages/flutter/lib/src/rendering/layer.dart | 3 +-- packages/flutter/lib/src/widgets/basic.dart | 8 ++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/flutter/lib/src/rendering/layer.dart b/packages/flutter/lib/src/rendering/layer.dart index 02d87bd7ff..7e8be48e5c 100644 --- a/packages/flutter/lib/src/rendering/layer.dart +++ b/packages/flutter/lib/src/rendering/layer.dart @@ -33,8 +33,7 @@ abstract class Layer { /// Removes this layer from its parent layer's child list @mustCallSuper void detach() { - if (_parent != null) - _parent._remove(this); + _parent?._remove(this); } /// Replaces this layer with the given layer in the parent layer's child list diff --git a/packages/flutter/lib/src/widgets/basic.dart b/packages/flutter/lib/src/widgets/basic.dart index 57b644926a..1460d11fe6 100644 --- a/packages/flutter/lib/src/widgets/basic.dart +++ b/packages/flutter/lib/src/widgets/basic.dart @@ -310,8 +310,12 @@ class ClipRect extends SingleChildRenderObjectWidget { /// rectangle. class ClipRRect extends SingleChildRenderObjectWidget { /// Creates a rounded-rectangular clip. - ClipRRect({ Key key, this.xRadius, this.yRadius, Widget child }) - : super(key: key, child: child); + ClipRRect({ + Key key, + @required this.xRadius, + @required this.yRadius, + Widget child + }) : super(key: key, child: child); /// The radius of the rounded corners in the horizontal direction in logical pixels. ///