Commit 726eff49 authored by Adam Barth's avatar Adam Barth

[rename fixit] *OneChild* -> *SingleChild*

Fixes #1482
parent e71bd77e
...@@ -35,7 +35,7 @@ class RenderDots extends RenderConstrainedBox { ...@@ -35,7 +35,7 @@ class RenderDots extends RenderConstrainedBox {
} }
} }
class Dots extends OneChildRenderObjectWidget { class Dots extends SingleChildRenderObjectWidget {
Dots({ Key key, Widget child }) : super(key: key, child: child); Dots({ Key key, Widget child }) : super(key: key, child: child);
RenderDots createRenderObject(BuildContext context) => new RenderDots(); RenderDots createRenderObject(BuildContext context) => new RenderDots();
} }
......
...@@ -94,7 +94,7 @@ class _BottomSheetState extends State<BottomSheet> { ...@@ -94,7 +94,7 @@ class _BottomSheetState extends State<BottomSheet> {
// MODAL BOTTOM SHEETS // MODAL BOTTOM SHEETS
class _ModalBottomSheetLayout extends OneChildLayoutDelegate { class _ModalBottomSheetLayout extends SingleChildLayoutDelegate {
_ModalBottomSheetLayout(this.progress); _ModalBottomSheetLayout(this.progress);
final double progress; final double progress;
...@@ -133,7 +133,7 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> { ...@@ -133,7 +133,7 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> {
animation: config.route.animation, animation: config.route.animation,
builder: (BuildContext context, Widget child) { builder: (BuildContext context, Widget child) {
return new ClipRect( return new ClipRect(
child: new CustomOneChildLayout( child: new CustomSingleChildLayout(
delegate: new _ModalBottomSheetLayout(config.route.animation.value), delegate: new _ModalBottomSheetLayout(config.route.animation.value),
child: new BottomSheet( child: new BottomSheet(
animationController: config.route.animation, animationController: config.route.animation,
......
...@@ -274,7 +274,7 @@ class RenderInkFeatures extends RenderProxyBox implements MaterialInkController ...@@ -274,7 +274,7 @@ class RenderInkFeatures extends RenderProxyBox implements MaterialInkController
} }
} }
class InkFeatures extends OneChildRenderObjectWidget { class InkFeatures extends SingleChildRenderObjectWidget {
InkFeatures({ Key key, this.color, Widget child }) : super(key: key, child: child); InkFeatures({ Key key, this.color, Widget child }) : super(key: key, child: child);
final Color color; final Color color;
......
...@@ -233,7 +233,7 @@ class _PopupMenu<T> extends StatelessComponent { ...@@ -233,7 +233,7 @@ class _PopupMenu<T> extends StatelessComponent {
} }
} }
class _PopupMenuRouteLayout extends OneChildLayoutDelegate { class _PopupMenuRouteLayout extends SingleChildLayoutDelegate {
_PopupMenuRouteLayout(this.position, this.selectedItemOffset); _PopupMenuRouteLayout(this.position, this.selectedItemOffset);
final ModalPosition position; final ModalPosition position;
...@@ -316,7 +316,7 @@ class _PopupMenuRoute<T> extends PopupRoute<T> { ...@@ -316,7 +316,7 @@ class _PopupMenuRoute<T> extends PopupRoute<T> {
final Size screenSize = MediaQuery.of(context).size; final Size screenSize = MediaQuery.of(context).size;
return new ConstrainedBox( return new ConstrainedBox(
constraints: new BoxConstraints(maxWidth: screenSize.width, maxHeight: screenSize.height), constraints: new BoxConstraints(maxWidth: screenSize.width, maxHeight: screenSize.height),
child: new CustomOneChildLayout( child: new CustomSingleChildLayout(
delegate: new _PopupMenuRouteLayout(position, selectedItemOffset), delegate: new _PopupMenuRouteLayout(position, selectedItemOffset),
child: new _PopupMenu<T>(route: this) child: new _PopupMenu<T>(route: this)
) )
......
...@@ -189,7 +189,7 @@ class _TooltipState extends State<Tooltip> { ...@@ -189,7 +189,7 @@ class _TooltipState extends State<Tooltip> {
} }
} }
class _TooltipPositionDelegate extends OneChildLayoutDelegate { class _TooltipPositionDelegate extends SingleChildLayoutDelegate {
_TooltipPositionDelegate({ _TooltipPositionDelegate({
this.target, this.target,
this.verticalOffset, this.verticalOffset,
...@@ -271,7 +271,7 @@ class _TooltipOverlay extends StatelessComponent { ...@@ -271,7 +271,7 @@ class _TooltipOverlay extends StatelessComponent {
right: 0.0, right: 0.0,
bottom: 0.0, bottom: 0.0,
child: new IgnorePointer( child: new IgnorePointer(
child: new CustomOneChildLayout( child: new CustomSingleChildLayout(
delegate: new _TooltipPositionDelegate( delegate: new _TooltipPositionDelegate(
target: target, target: target,
verticalOffset: verticalOffset, verticalOffset: verticalOffset,
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
import 'box.dart'; import 'box.dart';
import 'object.dart'; import 'object.dart';
// For OneChildLayoutDelegate and RenderCustomOneChildLayoutBox, see shifted_box.dart // For SingleChildLayoutDelegate and RenderCustomSingleChildLayoutBox, see shifted_box.dart
/// [ParentData] used by [RenderCustomMultiChildLayoutBox]. /// [ParentData] used by [RenderCustomMultiChildLayoutBox].
class MultiChildLayoutParentData extends ContainerBoxParentDataMixin<RenderBox> { class MultiChildLayoutParentData extends ContainerBoxParentDataMixin<RenderBox> {
......
...@@ -506,7 +506,7 @@ class RenderOverflowBox extends RenderShiftedBox { ...@@ -506,7 +506,7 @@ class RenderOverflowBox extends RenderShiftedBox {
} }
/// A delegate for computing the layout of a render object with a single child. /// A delegate for computing the layout of a render object with a single child.
class OneChildLayoutDelegate { class SingleChildLayoutDelegate {
/// Returns the size of this object given the incoming constraints. /// Returns the size of this object given the incoming constraints.
Size getSize(BoxConstraints constraints) => constraints.biggest; Size getSize(BoxConstraints constraints) => constraints.biggest;
...@@ -517,7 +517,7 @@ class OneChildLayoutDelegate { ...@@ -517,7 +517,7 @@ class OneChildLayoutDelegate {
Offset getPositionForChild(Size size, Size childSize) => Offset.zero; Offset getPositionForChild(Size size, Size childSize) => Offset.zero;
/// Override this method to return true when the child needs to be laid out. /// Override this method to return true when the child needs to be laid out.
bool shouldRelayout(OneChildLayoutDelegate oldDelegate) => true; bool shouldRelayout(SingleChildLayoutDelegate oldDelegate) => true;
} }
/// Defers the layout of its single child to a delegate. /// Defers the layout of its single child to a delegate.
...@@ -526,18 +526,18 @@ class OneChildLayoutDelegate { ...@@ -526,18 +526,18 @@ class OneChildLayoutDelegate {
/// decide where to position the child. The delegate can also determine the size /// decide where to position the child. The delegate can also determine the size
/// of the parent, but the size of the parent cannot depend on the size of the /// of the parent, but the size of the parent cannot depend on the size of the
/// child. /// child.
class RenderCustomOneChildLayoutBox extends RenderShiftedBox { class RenderCustomSingleChildLayoutBox extends RenderShiftedBox {
RenderCustomOneChildLayoutBox({ RenderCustomSingleChildLayoutBox({
RenderBox child, RenderBox child,
OneChildLayoutDelegate delegate SingleChildLayoutDelegate delegate
}) : _delegate = delegate, super(child) { }) : _delegate = delegate, super(child) {
assert(delegate != null); assert(delegate != null);
} }
/// A delegate that controls this object's layout. /// A delegate that controls this object's layout.
OneChildLayoutDelegate get delegate => _delegate; SingleChildLayoutDelegate get delegate => _delegate;
OneChildLayoutDelegate _delegate; SingleChildLayoutDelegate _delegate;
void set delegate (OneChildLayoutDelegate newDelegate) { void set delegate (SingleChildLayoutDelegate newDelegate) {
assert(newDelegate != null); assert(newDelegate != null);
if (_delegate == newDelegate) if (_delegate == newDelegate)
return; return;
......
...@@ -27,7 +27,7 @@ export 'package:flutter/rendering.dart' show ...@@ -27,7 +27,7 @@ export 'package:flutter/rendering.dart' show
HitTestBehavior, HitTestBehavior,
MaxTileWidthGridDelegate, MaxTileWidthGridDelegate,
MultiChildLayoutDelegate, MultiChildLayoutDelegate,
OneChildLayoutDelegate, SingleChildLayoutDelegate,
RenderObjectPainter, RenderObjectPainter,
PaintingContext, PaintingContext,
PlainTextSpan, PlainTextSpan,
...@@ -56,7 +56,7 @@ export 'package:flutter/rendering.dart' show ...@@ -56,7 +56,7 @@ export 'package:flutter/rendering.dart' show
/// ///
/// This class is relatively expensive because it requires painting the child /// This class is relatively expensive because it requires painting the child
/// into an intermediate buffer. /// into an intermediate buffer.
class Opacity extends OneChildRenderObjectWidget { class Opacity extends SingleChildRenderObjectWidget {
Opacity({ Key key, this.opacity, Widget child }) Opacity({ Key key, this.opacity, Widget child })
: super(key: key, child: child) { : super(key: key, child: child) {
assert(opacity >= 0.0 && opacity <= 1.0); assert(opacity >= 0.0 && opacity <= 1.0);
...@@ -80,7 +80,7 @@ class Opacity extends OneChildRenderObjectWidget { ...@@ -80,7 +80,7 @@ class Opacity extends OneChildRenderObjectWidget {
} }
} }
class ShaderMask extends OneChildRenderObjectWidget { class ShaderMask extends SingleChildRenderObjectWidget {
ShaderMask({ ShaderMask({
Key key, Key key,
this.shaderCallback, this.shaderCallback,
...@@ -112,7 +112,7 @@ class ShaderMask extends OneChildRenderObjectWidget { ...@@ -112,7 +112,7 @@ class ShaderMask extends OneChildRenderObjectWidget {
/// Container insets its child by the widths of the borders, this Widget does not. /// Container insets its child by the widths of the borders, this Widget does not.
/// ///
/// Commonly used with [BoxDecoration]. /// Commonly used with [BoxDecoration].
class DecoratedBox extends OneChildRenderObjectWidget { class DecoratedBox extends SingleChildRenderObjectWidget {
DecoratedBox({ DecoratedBox({
Key key, Key key,
this.decoration, this.decoration,
...@@ -153,7 +153,7 @@ class DecoratedBox extends OneChildRenderObjectWidget { ...@@ -153,7 +153,7 @@ class DecoratedBox extends OneChildRenderObjectWidget {
/// ///
/// Because custom paint calls its painters during paint, you cannot dirty /// Because custom paint calls its painters during paint, you cannot dirty
/// layout or paint information during the callback. /// layout or paint information during the callback.
class CustomPaint extends OneChildRenderObjectWidget { class CustomPaint extends SingleChildRenderObjectWidget {
CustomPaint({ Key key, this.painter, this.foregroundPainter, Widget child }) CustomPaint({ Key key, this.painter, this.foregroundPainter, Widget child })
: super(key: key, child: child); : super(key: key, child: child);
...@@ -184,7 +184,7 @@ class CustomPaint extends OneChildRenderObjectWidget { ...@@ -184,7 +184,7 @@ class CustomPaint extends OneChildRenderObjectWidget {
/// Clips its child using a rectangle. /// Clips its child using a rectangle.
/// ///
/// Prevents its child from painting outside its bounds. /// Prevents its child from painting outside its bounds.
class ClipRect extends OneChildRenderObjectWidget { class ClipRect extends SingleChildRenderObjectWidget {
ClipRect({ Key key, this.clipper, Widget child }) : super(key: key, child: child); ClipRect({ Key key, this.clipper, Widget child }) : super(key: key, child: child);
/// If non-null, determines which clip to use. /// If non-null, determines which clip to use.
...@@ -206,7 +206,7 @@ class ClipRect extends OneChildRenderObjectWidget { ...@@ -206,7 +206,7 @@ class ClipRect extends OneChildRenderObjectWidget {
/// Creates a rounded rectangle from its layout dimensions and the given x and /// Creates a rounded rectangle from its layout dimensions and the given x and
/// y radius values and prevents its child from painting outside that rounded /// y radius values and prevents its child from painting outside that rounded
/// rectangle. /// rectangle.
class ClipRRect extends OneChildRenderObjectWidget { class ClipRRect extends SingleChildRenderObjectWidget {
ClipRRect({ Key key, this.xRadius, this.yRadius, Widget child }) ClipRRect({ Key key, this.xRadius, this.yRadius, Widget child })
: super(key: key, child: child); : super(key: key, child: child);
...@@ -235,7 +235,7 @@ class ClipRRect extends OneChildRenderObjectWidget { ...@@ -235,7 +235,7 @@ class ClipRRect extends OneChildRenderObjectWidget {
/// ///
/// Inscribes an oval into its layout dimensions and prevents its child from /// Inscribes an oval into its layout dimensions and prevents its child from
/// painting outside that oval. /// painting outside that oval.
class ClipOval extends OneChildRenderObjectWidget { class ClipOval extends SingleChildRenderObjectWidget {
ClipOval({ Key key, this.clipper, Widget child }) : super(key: key, child: child); ClipOval({ Key key, this.clipper, Widget child }) : super(key: key, child: child);
/// If non-null, determines which clip to use. /// If non-null, determines which clip to use.
...@@ -256,7 +256,7 @@ class ClipOval extends OneChildRenderObjectWidget { ...@@ -256,7 +256,7 @@ class ClipOval extends OneChildRenderObjectWidget {
// POSITIONING AND SIZING NODES // POSITIONING AND SIZING NODES
/// Applies a transformation before painting its child. /// Applies a transformation before painting its child.
class Transform extends OneChildRenderObjectWidget { class Transform extends SingleChildRenderObjectWidget {
Transform({ Key key, this.transform, this.origin, this.alignment, this.transformHitTests: true, Widget child }) Transform({ Key key, this.transform, this.origin, this.alignment, this.transformHitTests: true, Widget child })
: super(key: key, child: child) { : super(key: key, child: child) {
assert(transform != null); assert(transform != null);
...@@ -299,7 +299,7 @@ class Transform extends OneChildRenderObjectWidget { ...@@ -299,7 +299,7 @@ class Transform extends OneChildRenderObjectWidget {
/// Applies a translation expressed as a fraction of the box's size before /// Applies a translation expressed as a fraction of the box's size before
/// painting its child. /// painting its child.
class FractionalTranslation extends OneChildRenderObjectWidget { class FractionalTranslation extends SingleChildRenderObjectWidget {
FractionalTranslation({ Key key, this.translation, this.transformHitTests: true, Widget child }) FractionalTranslation({ Key key, this.translation, this.transformHitTests: true, Widget child })
: super(key: key, child: child) { : super(key: key, child: child) {
assert(translation != null); assert(translation != null);
...@@ -325,7 +325,7 @@ class FractionalTranslation extends OneChildRenderObjectWidget { ...@@ -325,7 +325,7 @@ class FractionalTranslation extends OneChildRenderObjectWidget {
/// Unlike [Transform], which applies a transform just prior to painting, /// Unlike [Transform], which applies a transform just prior to painting,
/// this object applies its rotation prior to layout, which means the entire /// this object applies its rotation prior to layout, which means the entire
/// rotated box consumes only as much space as required by the rotated child. /// rotated box consumes only as much space as required by the rotated child.
class RotatedBox extends OneChildRenderObjectWidget { class RotatedBox extends SingleChildRenderObjectWidget {
RotatedBox({ Key key, this.quarterTurns, Widget child }) RotatedBox({ Key key, this.quarterTurns, Widget child })
: super(key: key, child: child) { : super(key: key, child: child) {
assert(quarterTurns != null); assert(quarterTurns != null);
...@@ -347,7 +347,7 @@ class RotatedBox extends OneChildRenderObjectWidget { ...@@ -347,7 +347,7 @@ class RotatedBox extends OneChildRenderObjectWidget {
/// constraints by the given padding, causing the child to layout at a smaller /// constraints by the given padding, causing the child to layout at a smaller
/// size. Padding then sizes itself to its child's size, inflated by the /// size. Padding then sizes itself to its child's size, inflated by the
/// padding, effectively creating empty space around the child. /// padding, effectively creating empty space around the child.
class Padding extends OneChildRenderObjectWidget { class Padding extends SingleChildRenderObjectWidget {
Padding({ Key key, this.padding, Widget child }) Padding({ Key key, this.padding, Widget child })
: super(key: key, child: child) { : super(key: key, child: child) {
assert(padding != null); assert(padding != null);
...@@ -373,7 +373,7 @@ class Padding extends OneChildRenderObjectWidget { ...@@ -373,7 +373,7 @@ class Padding extends OneChildRenderObjectWidget {
/// unconstrained, then in that direction it will be sized to fit the child's /// unconstrained, then in that direction it will be sized to fit the child's
/// dimensions. Using widthFactor and heightFactor you can force this latter /// dimensions. Using widthFactor and heightFactor you can force this latter
/// behavior in all cases. /// behavior in all cases.
class Align extends OneChildRenderObjectWidget { class Align extends SingleChildRenderObjectWidget {
Align({ Align({
Key key, Key key,
this.alignment: const FractionalOffset(0.5, 0.5), this.alignment: const FractionalOffset(0.5, 0.5),
...@@ -429,8 +429,8 @@ class Center extends Align { ...@@ -429,8 +429,8 @@ class Center extends Align {
/// decide where to position the child. The delegate can also determine the size /// decide where to position the child. The delegate can also determine the size
/// of the parent, but the size of the parent cannot depend on the size of the /// of the parent, but the size of the parent cannot depend on the size of the
/// child. /// child.
class CustomOneChildLayout extends OneChildRenderObjectWidget { class CustomSingleChildLayout extends SingleChildRenderObjectWidget {
CustomOneChildLayout({ CustomSingleChildLayout({
Key key, Key key,
this.delegate, this.delegate,
Widget child Widget child
...@@ -438,11 +438,11 @@ class CustomOneChildLayout extends OneChildRenderObjectWidget { ...@@ -438,11 +438,11 @@ class CustomOneChildLayout extends OneChildRenderObjectWidget {
assert(delegate != null); assert(delegate != null);
} }
final OneChildLayoutDelegate delegate; final SingleChildLayoutDelegate delegate;
RenderCustomOneChildLayoutBox createRenderObject(BuildContext context) => new RenderCustomOneChildLayoutBox(delegate: delegate); RenderCustomSingleChildLayoutBox createRenderObject(BuildContext context) => new RenderCustomSingleChildLayoutBox(delegate: delegate);
void updateRenderObject(BuildContext context, RenderCustomOneChildLayoutBox renderObject) { void updateRenderObject(BuildContext context, RenderCustomSingleChildLayoutBox renderObject) {
renderObject.delegate = delegate; renderObject.delegate = delegate;
} }
} }
...@@ -511,7 +511,7 @@ class CustomMultiChildLayout extends MultiChildRenderObjectWidget { ...@@ -511,7 +511,7 @@ class CustomMultiChildLayout extends MultiChildRenderObjectWidget {
/// ///
/// Forces its child to have a specific width and/or height and sizes itself to /// Forces its child to have a specific width and/or height and sizes itself to
/// match the size of its child. /// match the size of its child.
class SizedBox extends OneChildRenderObjectWidget { class SizedBox extends SingleChildRenderObjectWidget {
SizedBox({ Key key, this.width, this.height, Widget child }) SizedBox({ Key key, this.width, this.height, Widget child })
: super(key: key, child: child); : super(key: key, child: child);
...@@ -547,7 +547,7 @@ class SizedBox extends OneChildRenderObjectWidget { ...@@ -547,7 +547,7 @@ class SizedBox extends OneChildRenderObjectWidget {
/// For example, if you wanted [child] to have a minimum height of 50.0 logical /// For example, if you wanted [child] to have a minimum height of 50.0 logical
/// pixels, you could use `const BoxConstraints(minHeight: 50.0)`` as the /// pixels, you could use `const BoxConstraints(minHeight: 50.0)`` as the
/// [additionalConstraints]. /// [additionalConstraints].
class ConstrainedBox extends OneChildRenderObjectWidget { class ConstrainedBox extends SingleChildRenderObjectWidget {
ConstrainedBox({ Key key, this.constraints, Widget child }) ConstrainedBox({ Key key, this.constraints, Widget child })
: super(key: key, child: child) { : super(key: key, child: child) {
assert(constraints != null); assert(constraints != null);
...@@ -571,7 +571,7 @@ class ConstrainedBox extends OneChildRenderObjectWidget { ...@@ -571,7 +571,7 @@ class ConstrainedBox extends OneChildRenderObjectWidget {
/// Sizes itself to a fraction of the total available space. /// Sizes itself to a fraction of the total available space.
/// ///
/// See [RenderFractionallySizedBox] for details. /// See [RenderFractionallySizedBox] for details.
class FractionallySizedBox extends OneChildRenderObjectWidget { class FractionallySizedBox extends SingleChildRenderObjectWidget {
FractionallySizedBox({ Key key, this.width, this.height, Widget child }) FractionallySizedBox({ Key key, this.width, this.height, Widget child })
: super(key: key, child: child); : super(key: key, child: child);
...@@ -611,7 +611,7 @@ class FractionallySizedBox extends OneChildRenderObjectWidget { ...@@ -611,7 +611,7 @@ class FractionallySizedBox extends OneChildRenderObjectWidget {
/// from its parent, possibly allowing the child to overflow the parent. /// from its parent, possibly allowing the child to overflow the parent.
/// ///
/// See [RenderOverflowBox] for details. /// See [RenderOverflowBox] for details.
class OverflowBox extends OneChildRenderObjectWidget { class OverflowBox extends SingleChildRenderObjectWidget {
OverflowBox({ OverflowBox({
Key key, Key key,
this.minWidth, this.minWidth,
...@@ -679,7 +679,7 @@ class OverflowBox extends OneChildRenderObjectWidget { ...@@ -679,7 +679,7 @@ class OverflowBox extends OneChildRenderObjectWidget {
} }
} }
class SizedOverflowBox extends OneChildRenderObjectWidget { class SizedOverflowBox extends SingleChildRenderObjectWidget {
SizedOverflowBox({ Key key, this.size, Widget child }) SizedOverflowBox({ Key key, this.size, Widget child })
: super(key: key, child: child); : super(key: key, child: child);
...@@ -695,7 +695,7 @@ class SizedOverflowBox extends OneChildRenderObjectWidget { ...@@ -695,7 +695,7 @@ class SizedOverflowBox extends OneChildRenderObjectWidget {
/// Lays the child out as if it was in the tree, but without painting anything, /// Lays the child out as if it was in the tree, but without painting anything,
/// without making the child available for hit testing, and without taking any /// without making the child available for hit testing, and without taking any
/// room in the parent. /// room in the parent.
class OffStage extends OneChildRenderObjectWidget { class OffStage extends SingleChildRenderObjectWidget {
OffStage({ Key key, Widget child }) OffStage({ Key key, Widget child })
: super(key: key, child: child); : super(key: key, child: child);
...@@ -728,7 +728,7 @@ class OffStage extends OneChildRenderObjectWidget { ...@@ -728,7 +728,7 @@ class OffStage extends OneChildRenderObjectWidget {
/// find a feasible size after consulting each constraint, the widget /// find a feasible size after consulting each constraint, the widget
/// will eventually select a size for the child that meets the layout /// will eventually select a size for the child that meets the layout
/// constraints but fails to meet the aspect ratio constraints. /// constraints but fails to meet the aspect ratio constraints.
class AspectRatio extends OneChildRenderObjectWidget { class AspectRatio extends SingleChildRenderObjectWidget {
AspectRatio({ Key key, this.aspectRatio, Widget child }) AspectRatio({ Key key, this.aspectRatio, Widget child })
: super(key: key, child: child) { : super(key: key, child: child) {
assert(aspectRatio != null); assert(aspectRatio != null);
...@@ -764,7 +764,7 @@ class AspectRatio extends OneChildRenderObjectWidget { ...@@ -764,7 +764,7 @@ class AspectRatio extends OneChildRenderObjectWidget {
/// instead size itself to a more reasonable width. /// instead size itself to a more reasonable width.
/// ///
/// This class is relatively expensive. Avoid using it where possible. /// This class is relatively expensive. Avoid using it where possible.
class IntrinsicWidth extends OneChildRenderObjectWidget { class IntrinsicWidth extends SingleChildRenderObjectWidget {
IntrinsicWidth({ Key key, this.stepWidth, this.stepHeight, Widget child }) IntrinsicWidth({ Key key, this.stepWidth, this.stepHeight, Widget child })
: super(key: key, child: child); : super(key: key, child: child);
...@@ -790,13 +790,13 @@ class IntrinsicWidth extends OneChildRenderObjectWidget { ...@@ -790,13 +790,13 @@ class IntrinsicWidth extends OneChildRenderObjectWidget {
/// instead size itself to a more reasonable height. /// instead size itself to a more reasonable height.
/// ///
/// This class is relatively expensive. Avoid using it where possible. /// This class is relatively expensive. Avoid using it where possible.
class IntrinsicHeight extends OneChildRenderObjectWidget { class IntrinsicHeight extends SingleChildRenderObjectWidget {
IntrinsicHeight({ Key key, Widget child }) : super(key: key, child: child); IntrinsicHeight({ Key key, Widget child }) : super(key: key, child: child);
RenderIntrinsicHeight createRenderObject(BuildContext context) => new RenderIntrinsicHeight(); RenderIntrinsicHeight createRenderObject(BuildContext context) => new RenderIntrinsicHeight();
} }
/// Positions its child vertically according to the child's baseline. /// Positions its child vertically according to the child's baseline.
class Baseline extends OneChildRenderObjectWidget { class Baseline extends SingleChildRenderObjectWidget {
Baseline({ Key key, this.baseline, this.baselineType: TextBaseline.alphabetic, Widget child }) Baseline({ Key key, this.baseline, this.baselineType: TextBaseline.alphabetic, Widget child })
: super(key: key, child: child) { : super(key: key, child: child) {
assert(baseline != null); assert(baseline != null);
...@@ -828,7 +828,7 @@ class Baseline extends OneChildRenderObjectWidget { ...@@ -828,7 +828,7 @@ class Baseline extends OneChildRenderObjectWidget {
/// ///
/// Viewport is the core scrolling primitive in the system, but it can be used /// Viewport is the core scrolling primitive in the system, but it can be used
/// in other situations. /// in other situations.
class Viewport extends OneChildRenderObjectWidget { class Viewport extends SingleChildRenderObjectWidget {
Viewport({ Viewport({
Key key, Key key,
this.paintOffset: Offset.zero, this.paintOffset: Offset.zero,
...@@ -2133,7 +2133,7 @@ class WidgetToRenderBoxAdapter extends LeafRenderObjectWidget { ...@@ -2133,7 +2133,7 @@ class WidgetToRenderBoxAdapter extends LeafRenderObjectWidget {
// EVENT HANDLING // EVENT HANDLING
class Listener extends OneChildRenderObjectWidget { class Listener extends SingleChildRenderObjectWidget {
Listener({ Listener({
Key key, Key key,
Widget child, Widget child,
...@@ -2206,12 +2206,12 @@ class Listener extends OneChildRenderObjectWidget { ...@@ -2206,12 +2206,12 @@ class Listener extends OneChildRenderObjectWidget {
/// previously. Similarly, when the child repaints but the surround tree does /// previously. Similarly, when the child repaints but the surround tree does
/// not, we can re-record its display list without re-recording the display list /// not, we can re-record its display list without re-recording the display list
/// for the surround tree. /// for the surround tree.
class RepaintBoundary extends OneChildRenderObjectWidget { class RepaintBoundary extends SingleChildRenderObjectWidget {
RepaintBoundary({ Key key, Widget child }) : super(key: key, child: child); RepaintBoundary({ Key key, Widget child }) : super(key: key, child: child);
RenderRepaintBoundary createRenderObject(BuildContext context) => new RenderRepaintBoundary(); RenderRepaintBoundary createRenderObject(BuildContext context) => new RenderRepaintBoundary();
} }
class IgnorePointer extends OneChildRenderObjectWidget { class IgnorePointer extends SingleChildRenderObjectWidget {
IgnorePointer({ Key key, Widget child, this.ignoring: true, this.ignoringSemantics }) IgnorePointer({ Key key, Widget child, this.ignoring: true, this.ignoringSemantics })
: super(key: key, child: child); : super(key: key, child: child);
...@@ -2237,7 +2237,7 @@ class IgnorePointer extends OneChildRenderObjectWidget { ...@@ -2237,7 +2237,7 @@ class IgnorePointer extends OneChildRenderObjectWidget {
/// of the meaning of the widgets, so that accessibility tools, search /// of the meaning of the widgets, so that accessibility tools, search
/// engines, and other semantic analysis software can determine the /// engines, and other semantic analysis software can determine the
/// meaning of the application. /// meaning of the application.
class Semantics extends OneChildRenderObjectWidget { class Semantics extends SingleChildRenderObjectWidget {
Semantics({ Semantics({
Key key, Key key,
Widget child, Widget child,
...@@ -2308,7 +2308,7 @@ class Semantics extends OneChildRenderObjectWidget { ...@@ -2308,7 +2308,7 @@ class Semantics extends OneChildRenderObjectWidget {
/// multiple nodes in the merged subtree can handle semantic gestures, /// multiple nodes in the merged subtree can handle semantic gestures,
/// the first one in tree order will be the one to receive the /// the first one in tree order will be the one to receive the
/// callbacks. /// callbacks.
class MergeSemantics extends OneChildRenderObjectWidget { class MergeSemantics extends SingleChildRenderObjectWidget {
MergeSemantics({ Key key, Widget child }) : super(key: key, child: child); MergeSemantics({ Key key, Widget child }) : super(key: key, child: child);
RenderMergeSemantics createRenderObject(BuildContext context) => new RenderMergeSemantics(); RenderMergeSemantics createRenderObject(BuildContext context) => new RenderMergeSemantics();
} }
...@@ -2319,12 +2319,12 @@ class MergeSemantics extends OneChildRenderObjectWidget { ...@@ -2319,12 +2319,12 @@ class MergeSemantics extends OneChildRenderObjectWidget {
/// reported but that would only be confusing. For example, the /// reported but that would only be confusing. For example, the
/// material library's [Chip] widget hides the avatar since it is /// material library's [Chip] widget hides the avatar since it is
/// redundant with the chip label. /// redundant with the chip label.
class ExcludeSemantics extends OneChildRenderObjectWidget { class ExcludeSemantics extends SingleChildRenderObjectWidget {
ExcludeSemantics({ Key key, Widget child }) : super(key: key, child: child); ExcludeSemantics({ Key key, Widget child }) : super(key: key, child: child);
RenderExcludeSemantics createRenderObject(BuildContext context) => new RenderExcludeSemantics(); RenderExcludeSemantics createRenderObject(BuildContext context) => new RenderExcludeSemantics();
} }
class MetaData extends OneChildRenderObjectWidget { class MetaData extends SingleChildRenderObjectWidget {
MetaData({ MetaData({
Key key, Key key,
Widget child, Widget child,
......
...@@ -506,12 +506,12 @@ abstract class LeafRenderObjectWidget extends RenderObjectWidget { ...@@ -506,12 +506,12 @@ abstract class LeafRenderObjectWidget extends RenderObjectWidget {
/// A superclass for RenderObjectWidgets that configure RenderObject subclasses /// A superclass for RenderObjectWidgets that configure RenderObject subclasses
/// that have a single child slot. (This superclass only provides the storage /// that have a single child slot. (This superclass only provides the storage
/// for that child, it doesn't actually provide the updating logic.) /// for that child, it doesn't actually provide the updating logic.)
abstract class OneChildRenderObjectWidget extends RenderObjectWidget { abstract class SingleChildRenderObjectWidget extends RenderObjectWidget {
const OneChildRenderObjectWidget({ Key key, this.child }) : super(key: key); const SingleChildRenderObjectWidget({ Key key, this.child }) : super(key: key);
final Widget child; final Widget child;
OneChildRenderObjectElement createElement() => new OneChildRenderObjectElement(this); SingleChildRenderObjectElement createElement() => new SingleChildRenderObjectElement(this);
} }
/// A superclass for RenderObjectWidgets that configure RenderObject subclasses /// A superclass for RenderObjectWidgets that configure RenderObject subclasses
...@@ -1772,10 +1772,10 @@ class LeafRenderObjectElement extends RenderObjectElement { ...@@ -1772,10 +1772,10 @@ class LeafRenderObjectElement extends RenderObjectElement {
} }
/// Instantiation of RenderObjectWidgets that have up to one child /// Instantiation of RenderObjectWidgets that have up to one child
class OneChildRenderObjectElement extends RenderObjectElement { class SingleChildRenderObjectElement extends RenderObjectElement {
OneChildRenderObjectElement(OneChildRenderObjectWidget widget) : super(widget); SingleChildRenderObjectElement(SingleChildRenderObjectWidget widget) : super(widget);
OneChildRenderObjectWidget get widget => super.widget; SingleChildRenderObjectWidget get widget => super.widget;
Element _child; Element _child;
...@@ -1796,7 +1796,7 @@ class OneChildRenderObjectElement extends RenderObjectElement { ...@@ -1796,7 +1796,7 @@ class OneChildRenderObjectElement extends RenderObjectElement {
_child = updateChild(_child, widget.child, null); _child = updateChild(_child, widget.child, null);
} }
void update(OneChildRenderObjectWidget newWidget) { void update(SingleChildRenderObjectWidget newWidget) {
super.update(newWidget); super.update(newWidget);
assert(widget == newWidget); assert(widget == newWidget);
_child = updateChild(_child, widget.child, null); _child = updateChild(_child, widget.child, null);
......
...@@ -375,7 +375,7 @@ class RawGestureDetectorState extends State<RawGestureDetector> { ...@@ -375,7 +375,7 @@ class RawGestureDetectorState extends State<RawGestureDetector> {
} }
} }
class _GestureSemantics extends OneChildRenderObjectWidget { class _GestureSemantics extends SingleChildRenderObjectWidget {
_GestureSemantics({ _GestureSemantics({
Key key, Key key,
Widget child, Widget child,
......
...@@ -7,7 +7,7 @@ import 'package:flutter/rendering.dart'; ...@@ -7,7 +7,7 @@ import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
class TestOneChildLayoutDelegate extends OneChildLayoutDelegate { class TestSingleChildLayoutDelegate extends SingleChildLayoutDelegate {
BoxConstraints constraintsFromGetSize; BoxConstraints constraintsFromGetSize;
BoxConstraints constraintsFromGetConstraintsForChild; BoxConstraints constraintsFromGetConstraintsForChild;
Size sizeFromGetPositionForChild; Size sizeFromGetPositionForChild;
...@@ -46,14 +46,14 @@ class TestOneChildLayoutDelegate extends OneChildLayoutDelegate { ...@@ -46,14 +46,14 @@ class TestOneChildLayoutDelegate extends OneChildLayoutDelegate {
} }
} }
Widget buildFrame(OneChildLayoutDelegate delegate) { Widget buildFrame(SingleChildLayoutDelegate delegate) {
return new Center(child: new CustomOneChildLayout(delegate: delegate, child: new Container())); return new Center(child: new CustomSingleChildLayout(delegate: delegate, child: new Container()));
} }
void main() { void main() {
test('Control test for CustomOneChildLayout', () { test('Control test for CustomSingleChildLayout', () {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
TestOneChildLayoutDelegate delegate = new TestOneChildLayoutDelegate(); TestSingleChildLayoutDelegate delegate = new TestSingleChildLayoutDelegate();
tester.pumpWidget(buildFrame(delegate)); tester.pumpWidget(buildFrame(delegate));
expect(delegate.constraintsFromGetSize.minWidth, 0.0); expect(delegate.constraintsFromGetSize.minWidth, 0.0);
...@@ -74,9 +74,9 @@ void main() { ...@@ -74,9 +74,9 @@ void main() {
}); });
}); });
test('Test OneChildDelegate shouldRelayout method', () { test('Test SingleChildDelegate shouldRelayout method', () {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
TestOneChildLayoutDelegate delegate = new TestOneChildLayoutDelegate(); TestSingleChildLayoutDelegate delegate = new TestSingleChildLayoutDelegate();
tester.pumpWidget(buildFrame(delegate)); tester.pumpWidget(buildFrame(delegate));
// Layout happened because the delegate was set. // Layout happened because the delegate was set.
...@@ -84,14 +84,14 @@ void main() { ...@@ -84,14 +84,14 @@ void main() {
expect(delegate.shouldRelayoutCalled, isFalse); expect(delegate.shouldRelayoutCalled, isFalse);
// Layout did not happen because shouldRelayout() returned false. // Layout did not happen because shouldRelayout() returned false.
delegate = new TestOneChildLayoutDelegate(); delegate = new TestSingleChildLayoutDelegate();
delegate.shouldRelayoutValue = false; delegate.shouldRelayoutValue = false;
tester.pumpWidget(buildFrame(delegate)); tester.pumpWidget(buildFrame(delegate));
expect(delegate.shouldRelayoutCalled, isTrue); expect(delegate.shouldRelayoutCalled, isTrue);
expect(delegate.constraintsFromGetConstraintsForChild, isNull); expect(delegate.constraintsFromGetConstraintsForChild, isNull);
// Layout happened because shouldRelayout() returned true. // Layout happened because shouldRelayout() returned true.
delegate = new TestOneChildLayoutDelegate(); delegate = new TestSingleChildLayoutDelegate();
delegate.shouldRelayoutValue = true; delegate.shouldRelayoutValue = true;
tester.pumpWidget(buildFrame(delegate)); tester.pumpWidget(buildFrame(delegate));
expect(delegate.shouldRelayoutCalled, isTrue); expect(delegate.shouldRelayoutCalled, isTrue);
......
...@@ -21,8 +21,8 @@ void main() { ...@@ -21,8 +21,8 @@ void main() {
test('RenderObjectWidget smoke test', () { test('RenderObjectWidget smoke test', () {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
tester.pumpWidget(new DecoratedBox(decoration: kBoxDecorationA)); tester.pumpWidget(new DecoratedBox(decoration: kBoxDecorationA));
OneChildRenderObjectElement element = SingleChildRenderObjectElement element =
tester.findElement((Element element) => element is OneChildRenderObjectElement); tester.findElement((Element element) => element is SingleChildRenderObjectElement);
expect(element, isNotNull); expect(element, isNotNull);
expect(element.renderObject is RenderDecoratedBox, isTrue); expect(element.renderObject is RenderDecoratedBox, isTrue);
RenderDecoratedBox renderObject = element.renderObject; RenderDecoratedBox renderObject = element.renderObject;
...@@ -30,7 +30,7 @@ void main() { ...@@ -30,7 +30,7 @@ void main() {
expect(renderObject.position, equals(DecorationPosition.background)); expect(renderObject.position, equals(DecorationPosition.background));
tester.pumpWidget(new DecoratedBox(decoration: kBoxDecorationB)); tester.pumpWidget(new DecoratedBox(decoration: kBoxDecorationB));
element = tester.findElement((Element element) => element is OneChildRenderObjectElement); element = tester.findElement((Element element) => element is SingleChildRenderObjectElement);
expect(element, isNotNull); expect(element, isNotNull);
expect(element.renderObject is RenderDecoratedBox, isTrue); expect(element.renderObject is RenderDecoratedBox, isTrue);
renderObject = element.renderObject; renderObject = element.renderObject;
...@@ -43,8 +43,8 @@ void main() { ...@@ -43,8 +43,8 @@ void main() {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
void checkFullTree() { void checkFullTree() {
OneChildRenderObjectElement element = SingleChildRenderObjectElement element =
tester.findElement((Element element) => element is OneChildRenderObjectElement); tester.findElement((Element element) => element is SingleChildRenderObjectElement);
expect(element, isNotNull); expect(element, isNotNull);
expect(element.renderObject is RenderDecoratedBox, isTrue); expect(element.renderObject is RenderDecoratedBox, isTrue);
RenderDecoratedBox renderObject = element.renderObject; RenderDecoratedBox renderObject = element.renderObject;
...@@ -59,8 +59,8 @@ void main() { ...@@ -59,8 +59,8 @@ void main() {
} }
void childBareTree() { void childBareTree() {
OneChildRenderObjectElement element = SingleChildRenderObjectElement element =
tester.findElement((Element element) => element is OneChildRenderObjectElement); tester.findElement((Element element) => element is SingleChildRenderObjectElement);
expect(element, isNotNull); expect(element, isNotNull);
expect(element.renderObject is RenderDecoratedBox, isTrue); expect(element.renderObject is RenderDecoratedBox, isTrue);
RenderDecoratedBox renderObject = element.renderObject; RenderDecoratedBox renderObject = element.renderObject;
...@@ -138,8 +138,8 @@ void main() { ...@@ -138,8 +138,8 @@ void main() {
) )
)); ));
OneChildRenderObjectElement element = SingleChildRenderObjectElement element =
tester.findElement((Element element) => element is OneChildRenderObjectElement); tester.findElement((Element element) => element is SingleChildRenderObjectElement);
expect(element.renderObject is RenderDecoratedBox, isTrue); expect(element.renderObject is RenderDecoratedBox, isTrue);
RenderDecoratedBox parent = element.renderObject; RenderDecoratedBox parent = element.renderObject;
expect(parent.child is RenderDecoratedBox, isTrue); expect(parent.child is RenderDecoratedBox, isTrue);
...@@ -155,7 +155,7 @@ void main() { ...@@ -155,7 +155,7 @@ void main() {
)); ));
element = element =
tester.findElement((Element element) => element is OneChildRenderObjectElement); tester.findElement((Element element) => element is SingleChildRenderObjectElement);
expect(element.renderObject is RenderDecoratedBox, isTrue); expect(element.renderObject is RenderDecoratedBox, isTrue);
expect(element.renderObject, equals(parent)); expect(element.renderObject, equals(parent));
expect(parent.child, isNull); expect(parent.child, isNull);
......
...@@ -14,8 +14,8 @@ void main() { ...@@ -14,8 +14,8 @@ void main() {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
void checkTree(BoxDecoration expectedDecoration) { void checkTree(BoxDecoration expectedDecoration) {
OneChildRenderObjectElement element = SingleChildRenderObjectElement element =
tester.findElement((Element element) => element is OneChildRenderObjectElement); tester.findElement((Element element) => element is SingleChildRenderObjectElement);
expect(element, isNotNull); expect(element, isNotNull);
expect(element.renderObject is RenderDecoratedBox, isTrue); expect(element.renderObject is RenderDecoratedBox, isTrue);
RenderDecoratedBox renderObject = element.renderObject; RenderDecoratedBox renderObject = element.renderObject;
......
part of flutter_sprites; part of flutter_sprites;
/// A widget that uses a [SpriteBox] to render a sprite node tree to the screen. /// A widget that uses a [SpriteBox] to render a sprite node tree to the screen.
class SpriteWidget extends OneChildRenderObjectWidget { class SpriteWidget extends SingleChildRenderObjectWidget {
/// The rootNode of the sprite node tree. /// The rootNode of the sprite node tree.
/// ///
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment