Unverified Commit 1d395c5e authored by Mehmet Fidanboylu's avatar Mehmet Fidanboylu Committed by GitHub

Revert "Add clipBehavior to widgets with clipRect (#55977)" (#58344)

This reverts commit cd593dae.
parent eb1a6efe
File mode changed from 100644 to 100755
...@@ -224,7 +224,7 @@ class _PestoLogoState extends State<PestoLogo> { ...@@ -224,7 +224,7 @@ class _PestoLogoState extends State<PestoLogo> {
child: SizedBox( child: SizedBox(
width: kLogoWidth, width: kLogoWidth,
child: Stack( child: Stack(
clipBehavior: Clip.none, overflow: Overflow.visible,
children: <Widget>[ children: <Widget>[
Positioned.fromRect( Positioned.fromRect(
rect: _imageRectTween.lerp(widget.t), rect: _imageRectTween.lerp(widget.t),
......
...@@ -227,7 +227,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin { ...@@ -227,7 +227,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
EdgeInsets floatingCursorAddedMargin = const EdgeInsets.fromLTRB(4, 4, 4, 5), EdgeInsets floatingCursorAddedMargin = const EdgeInsets.fromLTRB(4, 4, 4, 5),
TextRange promptRectRange, TextRange promptRectRange,
Color promptRectColor, Color promptRectColor,
Clip clipBehavior = Clip.hardEdge,
@required this.textSelectionDelegate, @required this.textSelectionDelegate,
}) : assert(textAlign != null), }) : assert(textAlign != null),
assert(textDirection != null, 'RenderEditable created without a textDirection.'), assert(textDirection != null, 'RenderEditable created without a textDirection.'),
...@@ -258,7 +257,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin { ...@@ -258,7 +257,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
assert(devicePixelRatio != null), assert(devicePixelRatio != null),
assert(selectionHeightStyle != null), assert(selectionHeightStyle != null),
assert(selectionWidthStyle != null), assert(selectionWidthStyle != null),
assert(clipBehavior != null),
_textPainter = TextPainter( _textPainter = TextPainter(
text: text, text: text,
textAlign: textAlign, textAlign: textAlign,
...@@ -292,8 +290,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin { ...@@ -292,8 +290,7 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
_obscureText = obscureText, _obscureText = obscureText,
_readOnly = readOnly, _readOnly = readOnly,
_forceLine = forceLine, _forceLine = forceLine,
_promptRectRange = promptRectRange, _promptRectRange = promptRectRange {
_clipBehavior = clipBehavior {
assert(_showCursor != null); assert(_showCursor != null);
assert(!_showCursor.value || cursorColor != null); assert(!_showCursor.value || cursorColor != null);
this.hasFocus = hasFocus ?? false; this.hasFocus = hasFocus ?? false;
...@@ -1244,20 +1241,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin { ...@@ -1244,20 +1241,6 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
double get _caretMargin => _kCaretGap + cursorWidth; double get _caretMargin => _kCaretGap + cursorWidth;
/// {@macro flutter.widgets.Clip}
///
/// Defaults to [Clip.hardEdge], and must not be null.
Clip get clipBehavior => _clipBehavior;
Clip _clipBehavior = Clip.hardEdge;
set clipBehavior(Clip value) {
assert(value != null);
if (value != _clipBehavior) {
_clipBehavior = value;
markNeedsPaint();
markNeedsSemanticsUpdate();
}
}
@override @override
void describeSemanticsConfiguration(SemanticsConfiguration config) { void describeSemanticsConfiguration(SemanticsConfiguration config) {
super.describeSemanticsConfiguration(config); super.describeSemanticsConfiguration(config);
...@@ -2150,8 +2133,8 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin { ...@@ -2150,8 +2133,8 @@ class RenderEditable extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
@override @override
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
_layoutText(minWidth: constraints.minWidth, maxWidth: constraints.maxWidth); _layoutText(minWidth: constraints.minWidth, maxWidth: constraints.maxWidth);
if (_hasVisualOverflow && clipBehavior != Clip.none) if (_hasVisualOverflow)
context.pushClipRect(needsCompositing, offset, Offset.zero & size, _paintContents, clipBehavior: clipBehavior); context.pushClipRect(needsCompositing, offset, Offset.zero & size, _paintContents);
else else
_paintContents(context, offset); _paintContents(context, offset);
_paintHandleLayers(context, getEndpointsForSelection(selection)); _paintHandleLayers(context, getEndpointsForSelection(selection));
......
...@@ -277,20 +277,17 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl ...@@ -277,20 +277,17 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
TextDirection textDirection, TextDirection textDirection,
VerticalDirection verticalDirection = VerticalDirection.down, VerticalDirection verticalDirection = VerticalDirection.down,
TextBaseline textBaseline, TextBaseline textBaseline,
Clip clipBehavior = Clip.none,
}) : assert(direction != null), }) : assert(direction != null),
assert(mainAxisAlignment != null), assert(mainAxisAlignment != null),
assert(mainAxisSize != null), assert(mainAxisSize != null),
assert(crossAxisAlignment != null), assert(crossAxisAlignment != null),
assert(clipBehavior != null),
_direction = direction, _direction = direction,
_mainAxisAlignment = mainAxisAlignment, _mainAxisAlignment = mainAxisAlignment,
_mainAxisSize = mainAxisSize, _mainAxisSize = mainAxisSize,
_crossAxisAlignment = crossAxisAlignment, _crossAxisAlignment = crossAxisAlignment,
_textDirection = textDirection, _textDirection = textDirection,
_verticalDirection = verticalDirection, _verticalDirection = verticalDirection,
_textBaseline = textBaseline, _textBaseline = textBaseline {
_clipBehavior = clipBehavior {
addAll(children); addAll(children);
} }
...@@ -477,20 +474,6 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl ...@@ -477,20 +474,6 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
// are treated as not overflowing. // are treated as not overflowing.
bool get _hasOverflow => _overflow > precisionErrorTolerance; bool get _hasOverflow => _overflow > precisionErrorTolerance;
/// {@macro flutter.widgets.Clip}
///
/// Defaults to [Clip.none], and must not be null.
Clip get clipBehavior => _clipBehavior;
Clip _clipBehavior = Clip.none;
set clipBehavior(Clip value) {
assert(value != null);
if (value != _clipBehavior) {
_clipBehavior = value;
markNeedsPaint();
markNeedsSemanticsUpdate();
}
}
@override @override
void setupParentData(RenderBox child) { void setupParentData(RenderBox child) {
if (child.parentData is! FlexParentData) if (child.parentData is! FlexParentData)
...@@ -972,12 +955,8 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl ...@@ -972,12 +955,8 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
if (size.isEmpty) if (size.isEmpty)
return; return;
if (clipBehavior == Clip.none) { // We have overflow. Clip it.
defaultPaint(context, offset); context.pushClipRect(needsCompositing, offset, Offset.zero & size, defaultPaint);
} else {
// We have overflow and the clipBehavior isn't none. Clip it.
context.pushClipRect(needsCompositing, offset, Offset.zero & size, defaultPaint, clipBehavior: clipBehavior);
}
assert(() { assert(() {
// Only set this if it's null to save work. It gets reset to null if the // Only set this if it's null to save work. It gets reset to null if the
......
...@@ -143,8 +143,8 @@ class RenderListWheelViewport ...@@ -143,8 +143,8 @@ class RenderListWheelViewport
double overAndUnderCenterOpacity = 1, double overAndUnderCenterOpacity = 1,
@required double itemExtent, @required double itemExtent,
double squeeze = 1, double squeeze = 1,
bool clipToSize = true,
bool renderChildrenOutsideViewport = false, bool renderChildrenOutsideViewport = false,
Clip clipBehavior = Clip.none,
List<RenderBox> children, List<RenderBox> children,
}) : assert(childManager != null), }) : assert(childManager != null),
assert(offset != null), assert(offset != null),
...@@ -163,11 +163,11 @@ class RenderListWheelViewport ...@@ -163,11 +163,11 @@ class RenderListWheelViewport
assert(squeeze != null), assert(squeeze != null),
assert(squeeze > 0), assert(squeeze > 0),
assert(itemExtent > 0), assert(itemExtent > 0),
assert(clipToSize != null),
assert(renderChildrenOutsideViewport != null), assert(renderChildrenOutsideViewport != null),
assert(clipBehavior != null),
assert( assert(
!renderChildrenOutsideViewport || clipBehavior == Clip.none, !renderChildrenOutsideViewport || !clipToSize,
clipBehaviorAndRenderChildrenOutsideViewportConflict, clipToSizeAndRenderChildrenOutsideViewportConflict,
), ),
_offset = offset, _offset = offset,
_diameterRatio = diameterRatio, _diameterRatio = diameterRatio,
...@@ -178,8 +178,8 @@ class RenderListWheelViewport ...@@ -178,8 +178,8 @@ class RenderListWheelViewport
_overAndUnderCenterOpacity = overAndUnderCenterOpacity, _overAndUnderCenterOpacity = overAndUnderCenterOpacity,
_itemExtent = itemExtent, _itemExtent = itemExtent,
_squeeze = squeeze, _squeeze = squeeze,
_renderChildrenOutsideViewport = renderChildrenOutsideViewport, _clipToSize = clipToSize,
_clipBehavior = clipBehavior { _renderChildrenOutsideViewport = renderChildrenOutsideViewport {
addAll(children); addAll(children);
} }
...@@ -199,10 +199,10 @@ class RenderListWheelViewport ...@@ -199,10 +199,10 @@ class RenderListWheelViewport
'be clipped in the z-axis and therefore not renderable. Value must be ' 'be clipped in the z-axis and therefore not renderable. Value must be '
'between 0 and 0.01.'; 'between 0 and 0.01.';
/// An error message to show when [clipBehavior] and [renderChildrenOutsideViewport] /// An error message to show when [clipToSize] and [renderChildrenOutsideViewport]
/// are set to conflicting values. /// are set to conflicting values.
static const String clipBehaviorAndRenderChildrenOutsideViewportConflict = static const String clipToSizeAndRenderChildrenOutsideViewportConflict =
'Cannot renderChildrenOutsideViewport and clip since children ' 'Cannot renderChildrenOutsideViewport and clipToSize since children '
'rendered outside will be clipped anyway.'; 'rendered outside will be clipped anyway.';
/// The delegate that manages the children of this object. /// The delegate that manages the children of this object.
...@@ -441,14 +441,37 @@ class RenderListWheelViewport ...@@ -441,14 +441,37 @@ class RenderListWheelViewport
markNeedsSemanticsUpdate(); markNeedsSemanticsUpdate();
} }
/// {@template flutter.rendering.wheelList.clipToSize}
/// Whether to clip painted children to the inside of this viewport.
///
/// Defaults to [true]. Must not be null.
///
/// If this is false and [renderChildrenOutsideViewport] is false, the
/// first and last children may be painted partly outside of this scroll view.
/// {@endtemplate}
bool get clipToSize => _clipToSize;
bool _clipToSize;
set clipToSize(bool value) {
assert(value != null);
assert(
!renderChildrenOutsideViewport || !clipToSize,
clipToSizeAndRenderChildrenOutsideViewportConflict,
);
if (value == _clipToSize)
return;
_clipToSize = value;
markNeedsPaint();
markNeedsSemanticsUpdate();
}
/// {@template flutter.rendering.wheelList.renderChildrenOutsideViewport} /// {@template flutter.rendering.wheelList.renderChildrenOutsideViewport}
/// Whether to paint children inside the viewport only. /// Whether to paint children inside the viewport only.
/// ///
/// If false, every child will be painted. However the [Scrollable] is still /// If false, every child will be painted. However the [Scrollable] is still
/// the size of the viewport and detects gestures inside only. /// the size of the viewport and detects gestures inside only.
/// ///
/// Defaults to [false]. Must not be null. Cannot be true if [clipBehavior] /// Defaults to [false]. Must not be null. Cannot be true if [clipToSize]
/// is not [Clip.none] since children outside the viewport will be clipped, and /// is also true since children outside the viewport will be clipped, and
/// therefore cannot render children outside the viewport. /// therefore cannot render children outside the viewport.
/// {@endtemplate} /// {@endtemplate}
bool get renderChildrenOutsideViewport => _renderChildrenOutsideViewport; bool get renderChildrenOutsideViewport => _renderChildrenOutsideViewport;
...@@ -456,8 +479,8 @@ class RenderListWheelViewport ...@@ -456,8 +479,8 @@ class RenderListWheelViewport
set renderChildrenOutsideViewport(bool value) { set renderChildrenOutsideViewport(bool value) {
assert(value != null); assert(value != null);
assert( assert(
!renderChildrenOutsideViewport || clipBehavior == Clip.none, !renderChildrenOutsideViewport || !clipToSize,
clipBehaviorAndRenderChildrenOutsideViewportConflict, clipToSizeAndRenderChildrenOutsideViewportConflict,
); );
if (value == _renderChildrenOutsideViewport) if (value == _renderChildrenOutsideViewport)
return; return;
...@@ -466,20 +489,6 @@ class RenderListWheelViewport ...@@ -466,20 +489,6 @@ class RenderListWheelViewport
markNeedsSemanticsUpdate(); markNeedsSemanticsUpdate();
} }
/// {@macro flutter.widgets.Clip}
///
/// Defaults to [Clip.hardEdge], and must not be null.
Clip get clipBehavior => _clipBehavior;
Clip _clipBehavior = Clip.hardEdge;
set clipBehavior(Clip value) {
assert(value != null);
if (value != _clipBehavior) {
_clipBehavior = value;
markNeedsPaint();
markNeedsSemanticsUpdate();
}
}
void _hasScrolled() { void _hasScrolled() {
markNeedsLayout(); markNeedsLayout();
markNeedsSemanticsUpdate(); markNeedsSemanticsUpdate();
...@@ -778,13 +787,12 @@ class RenderListWheelViewport ...@@ -778,13 +787,12 @@ class RenderListWheelViewport
@override @override
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
if (childCount > 0) { if (childCount > 0) {
if (_shouldClipAtCurrentOffset() && clipBehavior != Clip.none) { if (_clipToSize && _shouldClipAtCurrentOffset()) {
context.pushClipRect( context.pushClipRect(
needsCompositing, needsCompositing,
offset, offset,
Offset.zero & size, Offset.zero & size,
_paintVisibleChildren, _paintVisibleChildren,
clipBehavior: clipBehavior,
); );
} else { } else {
_paintVisibleChildren(context, offset); _paintVisibleChildren(context, offset);
......
...@@ -2292,14 +2292,11 @@ class RenderFittedBox extends RenderProxyBox { ...@@ -2292,14 +2292,11 @@ class RenderFittedBox extends RenderProxyBox {
AlignmentGeometry alignment = Alignment.center, AlignmentGeometry alignment = Alignment.center,
TextDirection textDirection, TextDirection textDirection,
RenderBox child, RenderBox child,
Clip clipBehavior = Clip.none,
}) : assert(fit != null), }) : assert(fit != null),
assert(alignment != null), assert(alignment != null),
assert(clipBehavior != null),
_fit = fit, _fit = fit,
_alignment = alignment, _alignment = alignment,
_textDirection = textDirection, _textDirection = textDirection,
_clipBehavior = clipBehavior,
super(child); super(child);
Alignment _resolvedAlignment; Alignment _resolvedAlignment;
...@@ -2376,20 +2373,6 @@ class RenderFittedBox extends RenderProxyBox { ...@@ -2376,20 +2373,6 @@ class RenderFittedBox extends RenderProxyBox {
bool _hasVisualOverflow; bool _hasVisualOverflow;
Matrix4 _transform; Matrix4 _transform;
/// {@macro flutter.widgets.Clip}
///
/// Defaults to [Clip.none], and must not be null.
Clip get clipBehavior => _clipBehavior;
Clip _clipBehavior = Clip.none;
set clipBehavior(Clip value) {
assert(value != null);
if (value != _clipBehavior) {
_clipBehavior = value;
markNeedsPaint();
markNeedsSemanticsUpdate();
}
}
void _clearPaintData() { void _clearPaintData() {
_hasVisualOverflow = null; _hasVisualOverflow = null;
_transform = null; _transform = null;
...@@ -2435,9 +2418,9 @@ class RenderFittedBox extends RenderProxyBox { ...@@ -2435,9 +2418,9 @@ class RenderFittedBox extends RenderProxyBox {
return; return;
_updatePaintData(); _updatePaintData();
if (child != null) { if (child != null) {
if (_hasVisualOverflow && clipBehavior != Clip.none) if (_hasVisualOverflow)
layer = context.pushClipRect(needsCompositing, offset, Offset.zero & size, _paintChildWithTransform, layer = context.pushClipRect(needsCompositing, offset, Offset.zero & size, _paintChildWithTransform,
oldLayer: layer is ClipRectLayer ? layer as ClipRectLayer : null, clipBehavior: clipBehavior); oldLayer: layer is ClipRectLayer ? layer as ClipRectLayer : null);
else else
layer = _paintChildWithTransform(context, offset); layer = _paintChildWithTransform(context, offset);
} }
......
...@@ -626,11 +626,8 @@ class RenderUnconstrainedBox extends RenderAligningShiftedBox with DebugOverflow ...@@ -626,11 +626,8 @@ class RenderUnconstrainedBox extends RenderAligningShiftedBox with DebugOverflow
@required TextDirection textDirection, @required TextDirection textDirection,
Axis constrainedAxis, Axis constrainedAxis,
RenderBox child, RenderBox child,
Clip clipBehavior = Clip.none,
}) : assert(alignment != null), }) : assert(alignment != null),
assert(clipBehavior != null),
_constrainedAxis = constrainedAxis, _constrainedAxis = constrainedAxis,
_clipBehavior = clipBehavior,
super.mixin(alignment, textDirection, child); super.mixin(alignment, textDirection, child);
/// The axis to retain constraints on, if any. /// The axis to retain constraints on, if any.
...@@ -652,20 +649,6 @@ class RenderUnconstrainedBox extends RenderAligningShiftedBox with DebugOverflow ...@@ -652,20 +649,6 @@ class RenderUnconstrainedBox extends RenderAligningShiftedBox with DebugOverflow
Rect _overflowChildRect = Rect.zero; Rect _overflowChildRect = Rect.zero;
bool _isOverflowing = false; bool _isOverflowing = false;
/// {@macro flutter.widgets.Clip}
///
/// Defaults to [Clip.none], and must not be null.
Clip get clipBehavior => _clipBehavior;
Clip _clipBehavior = Clip.none;
set clipBehavior(Clip value) {
assert(value != null);
if (value != _clipBehavior) {
_clipBehavior = value;
markNeedsPaint();
markNeedsSemanticsUpdate();
}
}
@override @override
void performLayout() { void performLayout() {
final BoxConstraints constraints = this.constraints; final BoxConstraints constraints = this.constraints;
...@@ -711,12 +694,8 @@ class RenderUnconstrainedBox extends RenderAligningShiftedBox with DebugOverflow ...@@ -711,12 +694,8 @@ class RenderUnconstrainedBox extends RenderAligningShiftedBox with DebugOverflow
return; return;
} }
if (clipBehavior == Clip.none) { // We have overflow. Clip it.
super.paint(context, offset); context.pushClipRect(needsCompositing, offset, Offset.zero & size, super.paint);
} else {
// We have overflow and the clipBehavior isn't none. Clip it.
context.pushClipRect(needsCompositing, offset, Offset.zero & size, super.paint, clipBehavior: clipBehavior);
}
// Display the overflow indicator. // Display the overflow indicator.
assert(() { assert(() {
......
...@@ -268,8 +268,6 @@ enum StackFit { ...@@ -268,8 +268,6 @@ enum StackFit {
passthrough, passthrough,
} }
// TODO(liyuqian): Deprecate and remove `Overflow` once its usages are removed from Google.
/// Whether overflowing children should be clipped, or their overflow be /// Whether overflowing children should be clipped, or their overflow be
/// visible. /// visible.
enum Overflow { enum Overflow {
...@@ -328,14 +326,14 @@ class RenderStack extends RenderBox ...@@ -328,14 +326,14 @@ class RenderStack extends RenderBox
AlignmentGeometry alignment = AlignmentDirectional.topStart, AlignmentGeometry alignment = AlignmentDirectional.topStart,
TextDirection textDirection, TextDirection textDirection,
StackFit fit = StackFit.loose, StackFit fit = StackFit.loose,
Clip clipBehavior = Clip.hardEdge, Overflow overflow = Overflow.clip,
}) : assert(alignment != null), }) : assert(alignment != null),
assert(fit != null), assert(fit != null),
assert(clipBehavior != null), assert(overflow != null),
_alignment = alignment, _alignment = alignment,
_textDirection = textDirection, _textDirection = textDirection,
_fit = fit, _fit = fit,
_clipBehavior = clipBehavior { _overflow = overflow {
addAll(children); addAll(children);
} }
...@@ -413,17 +411,17 @@ class RenderStack extends RenderBox ...@@ -413,17 +411,17 @@ class RenderStack extends RenderBox
} }
} }
/// {@macro flutter.widgets.Clip} /// Whether overflowing children should be clipped. See [Overflow].
/// ///
/// Defaults to [Clip.hardEdge], and must not be null. /// Some children in a stack might overflow its box. When this flag is set to
Clip get clipBehavior => _clipBehavior; /// [Overflow.clip], children cannot paint outside of the stack's box.
Clip _clipBehavior = Clip.hardEdge; Overflow get overflow => _overflow;
set clipBehavior(Clip value) { Overflow _overflow;
set overflow(Overflow value) {
assert(value != null); assert(value != null);
if (value != _clipBehavior) { if (_overflow != value) {
_clipBehavior = value; _overflow = value;
markNeedsPaint(); markNeedsPaint();
markNeedsSemanticsUpdate();
} }
} }
...@@ -606,8 +604,8 @@ class RenderStack extends RenderBox ...@@ -606,8 +604,8 @@ class RenderStack extends RenderBox
@override @override
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
if (clipBehavior != Clip.none && _hasVisualOverflow) { if (_overflow == Overflow.clip && _hasVisualOverflow) {
context.pushClipRect(needsCompositing, offset, Offset.zero & size, paintStack, clipBehavior: clipBehavior); context.pushClipRect(needsCompositing, offset, Offset.zero & size, paintStack);
} else { } else {
paintStack(context, offset); paintStack(context, offset);
} }
...@@ -622,7 +620,7 @@ class RenderStack extends RenderBox ...@@ -622,7 +620,7 @@ class RenderStack extends RenderBox
properties.add(DiagnosticsProperty<AlignmentGeometry>('alignment', alignment)); properties.add(DiagnosticsProperty<AlignmentGeometry>('alignment', alignment));
properties.add(EnumProperty<TextDirection>('textDirection', textDirection)); properties.add(EnumProperty<TextDirection>('textDirection', textDirection));
properties.add(EnumProperty<StackFit>('fit', fit)); properties.add(EnumProperty<StackFit>('fit', fit));
properties.add(EnumProperty<Clip>('clipBehavior', clipBehavior, defaultValue: Clip.hardEdge)); properties.add(EnumProperty<Overflow>('overflow', overflow));
} }
} }
......
...@@ -171,20 +171,17 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix ...@@ -171,20 +171,17 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
@required ViewportOffset offset, @required ViewportOffset offset,
double cacheExtent, double cacheExtent,
CacheExtentStyle cacheExtentStyle = CacheExtentStyle.pixel, CacheExtentStyle cacheExtentStyle = CacheExtentStyle.pixel,
Clip clipBehavior = Clip.hardEdge,
}) : assert(axisDirection != null), }) : assert(axisDirection != null),
assert(crossAxisDirection != null), assert(crossAxisDirection != null),
assert(offset != null), assert(offset != null),
assert(axisDirectionToAxis(axisDirection) != axisDirectionToAxis(crossAxisDirection)), assert(axisDirectionToAxis(axisDirection) != axisDirectionToAxis(crossAxisDirection)),
assert(cacheExtentStyle != null), assert(cacheExtentStyle != null),
assert(cacheExtent != null || cacheExtentStyle == CacheExtentStyle.pixel), assert(cacheExtent != null || cacheExtentStyle == CacheExtentStyle.pixel),
assert(clipBehavior != null),
_axisDirection = axisDirection, _axisDirection = axisDirection,
_crossAxisDirection = crossAxisDirection, _crossAxisDirection = crossAxisDirection,
_offset = offset, _offset = offset,
_cacheExtent = cacheExtent ?? RenderAbstractViewport.defaultCacheExtent, _cacheExtent = cacheExtent ?? RenderAbstractViewport.defaultCacheExtent,
_cacheExtentStyle = cacheExtentStyle, _cacheExtentStyle = cacheExtentStyle;
_clipBehavior = clipBehavior;
@override @override
void describeSemanticsConfiguration(SemanticsConfiguration config) { void describeSemanticsConfiguration(SemanticsConfiguration config) {
...@@ -317,20 +314,6 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix ...@@ -317,20 +314,6 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
markNeedsLayout(); markNeedsLayout();
} }
/// {@macro flutter.widgets.Clip}
///
/// Defaults to [Clip.hardEdge], and must not be null.
Clip get clipBehavior => _clipBehavior;
Clip _clipBehavior = Clip.hardEdge;
set clipBehavior(Clip value) {
assert(value != null);
if (value != _clipBehavior) {
_clipBehavior = value;
markNeedsPaint();
markNeedsSemanticsUpdate();
}
}
@override @override
void attach(PipelineOwner owner) { void attach(PipelineOwner owner) {
super.attach(owner); super.attach(owner);
...@@ -591,8 +574,8 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix ...@@ -591,8 +574,8 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
if (firstChild == null) if (firstChild == null)
return; return;
if (hasVisualOverflow && clipBehavior != Clip.none) { if (hasVisualOverflow) {
context.pushClipRect(needsCompositing, offset, Offset.zero & size, _paintContents, clipBehavior: clipBehavior); context.pushClipRect(needsCompositing, offset, Offset.zero & size, _paintContents);
} else { } else {
_paintContents(context, offset); _paintContents(context, offset);
} }
...@@ -1153,11 +1136,9 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat ...@@ -1153,11 +1136,9 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat
RenderSliver center, RenderSliver center,
double cacheExtent, double cacheExtent,
CacheExtentStyle cacheExtentStyle = CacheExtentStyle.pixel, CacheExtentStyle cacheExtentStyle = CacheExtentStyle.pixel,
Clip clipBehavior = Clip.hardEdge,
}) : assert(anchor != null), }) : assert(anchor != null),
assert(anchor >= 0.0 && anchor <= 1.0), assert(anchor >= 0.0 && anchor <= 1.0),
assert(cacheExtentStyle != CacheExtentStyle.viewport || cacheExtent != null), assert(cacheExtentStyle != CacheExtentStyle.viewport || cacheExtent != null),
assert(clipBehavior != null),
_anchor = anchor, _anchor = anchor,
_center = center, _center = center,
super( super(
...@@ -1166,7 +1147,6 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat ...@@ -1166,7 +1147,6 @@ class RenderViewport extends RenderViewportBase<SliverPhysicalContainerParentDat
offset: offset, offset: offset,
cacheExtent: cacheExtent, cacheExtent: cacheExtent,
cacheExtentStyle: cacheExtentStyle, cacheExtentStyle: cacheExtentStyle,
clipBehavior: clipBehavior,
) { ) {
addAll(children); addAll(children);
if (center == null && firstChild != null) if (center == null && firstChild != null)
...@@ -1678,14 +1658,8 @@ class RenderShrinkWrappingViewport extends RenderViewportBase<SliverLogicalConta ...@@ -1678,14 +1658,8 @@ class RenderShrinkWrappingViewport extends RenderViewportBase<SliverLogicalConta
AxisDirection axisDirection = AxisDirection.down, AxisDirection axisDirection = AxisDirection.down,
@required AxisDirection crossAxisDirection, @required AxisDirection crossAxisDirection,
@required ViewportOffset offset, @required ViewportOffset offset,
Clip clipBehavior = Clip.hardEdge,
List<RenderSliver> children, List<RenderSliver> children,
}) : super( }) : super(axisDirection: axisDirection, crossAxisDirection: crossAxisDirection, offset: offset) {
axisDirection: axisDirection,
crossAxisDirection: crossAxisDirection,
offset: offset,
clipBehavior: clipBehavior,
) {
addAll(children); addAll(children);
} }
......
...@@ -101,9 +101,8 @@ class WrapParentData extends ContainerBoxParentData<RenderBox> { ...@@ -101,9 +101,8 @@ class WrapParentData extends ContainerBoxParentData<RenderBox> {
/// ///
/// The runs themselves are then positioned in the cross axis according to the /// The runs themselves are then positioned in the cross axis according to the
/// [runSpacing] and [runAlignment]. /// [runSpacing] and [runAlignment].
class RenderWrap extends RenderBox class RenderWrap extends RenderBox with ContainerRenderObjectMixin<RenderBox, WrapParentData>,
with ContainerRenderObjectMixin<RenderBox, WrapParentData>, RenderBoxContainerDefaultsMixin<RenderBox, WrapParentData> {
RenderBoxContainerDefaultsMixin<RenderBox, WrapParentData> {
/// Creates a wrap render object. /// Creates a wrap render object.
/// ///
/// By default, the wrap layout is horizontal and both the children and the /// By default, the wrap layout is horizontal and both the children and the
...@@ -118,14 +117,12 @@ class RenderWrap extends RenderBox ...@@ -118,14 +117,12 @@ class RenderWrap extends RenderBox
WrapCrossAlignment crossAxisAlignment = WrapCrossAlignment.start, WrapCrossAlignment crossAxisAlignment = WrapCrossAlignment.start,
TextDirection textDirection, TextDirection textDirection,
VerticalDirection verticalDirection = VerticalDirection.down, VerticalDirection verticalDirection = VerticalDirection.down,
Clip clipBehavior = Clip.none,
}) : assert(direction != null), }) : assert(direction != null),
assert(alignment != null), assert(alignment != null),
assert(spacing != null), assert(spacing != null),
assert(runAlignment != null), assert(runAlignment != null),
assert(runSpacing != null), assert(runSpacing != null),
assert(crossAxisAlignment != null), assert(crossAxisAlignment != null),
assert(clipBehavior != null),
_direction = direction, _direction = direction,
_alignment = alignment, _alignment = alignment,
_spacing = spacing, _spacing = spacing,
...@@ -133,8 +130,7 @@ class RenderWrap extends RenderBox ...@@ -133,8 +130,7 @@ class RenderWrap extends RenderBox
_runSpacing = runSpacing, _runSpacing = runSpacing,
_crossAxisAlignment = crossAxisAlignment, _crossAxisAlignment = crossAxisAlignment,
_textDirection = textDirection, _textDirection = textDirection,
_verticalDirection = verticalDirection, _verticalDirection = verticalDirection {
_clipBehavior = clipBehavior {
addAll(children); addAll(children);
} }
...@@ -330,20 +326,6 @@ class RenderWrap extends RenderBox ...@@ -330,20 +326,6 @@ class RenderWrap extends RenderBox
} }
} }
/// {@macro flutter.widgets.Clip}
///
/// Defaults to [Clip.none], and must not be null.
Clip get clipBehavior => _clipBehavior;
Clip _clipBehavior = Clip.none;
set clipBehavior(Clip value) {
assert(value != null);
if (value != _clipBehavior) {
_clipBehavior = value;
markNeedsPaint();
markNeedsSemanticsUpdate();
}
}
bool get _debugHasNecessaryDirections { bool get _debugHasNecessaryDirections {
assert(direction != null); assert(direction != null);
assert(alignment != null); assert(alignment != null);
...@@ -767,8 +749,8 @@ class RenderWrap extends RenderBox ...@@ -767,8 +749,8 @@ class RenderWrap extends RenderBox
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
// TODO(ianh): move the debug flex overflow paint logic somewhere common so // TODO(ianh): move the debug flex overflow paint logic somewhere common so
// it can be reused here // it can be reused here
if (_hasVisualOverflow && clipBehavior != Clip.none) if (_hasVisualOverflow)
context.pushClipRect(needsCompositing, offset, Offset.zero & size, defaultPaint, clipBehavior: clipBehavior); context.pushClipRect(needsCompositing, offset, Offset.zero & size, defaultPaint);
else else
defaultPaint(context, offset); defaultPaint(context, offset);
} }
......
...@@ -216,7 +216,7 @@ class AnimatedCrossFade extends StatefulWidget { ...@@ -216,7 +216,7 @@ class AnimatedCrossFade extends StatefulWidget {
/// [AnimatedCrossFadeBuilder]. /// [AnimatedCrossFadeBuilder].
static Widget defaultLayoutBuilder(Widget topChild, Key topChildKey, Widget bottomChild, Key bottomChildKey) { static Widget defaultLayoutBuilder(Widget topChild, Key topChildKey, Widget bottomChild, Key bottomChildKey) {
return Stack( return Stack(
clipBehavior: Clip.none, overflow: Overflow.visible,
children: <Widget>[ children: <Widget>[
Positioned( Positioned(
key: bottomChildKey, key: bottomChildKey,
......
...@@ -42,6 +42,7 @@ export 'package:flutter/rendering.dart' show ...@@ -42,6 +42,7 @@ export 'package:flutter/rendering.dart' show
MainAxisAlignment, MainAxisAlignment,
MainAxisSize, MainAxisSize,
MultiChildLayoutDelegate, MultiChildLayoutDelegate,
Overflow,
PaintingContext, PaintingContext,
PointerCancelEvent, PointerCancelEvent,
PointerCancelEventListener, PointerCancelEventListener,
...@@ -1410,11 +1411,9 @@ class FittedBox extends SingleChildRenderObjectWidget { ...@@ -1410,11 +1411,9 @@ class FittedBox extends SingleChildRenderObjectWidget {
Key key, Key key,
this.fit = BoxFit.contain, this.fit = BoxFit.contain,
this.alignment = Alignment.center, this.alignment = Alignment.center,
this.clipBehavior = Clip.hardEdge,
Widget child, Widget child,
}) : assert(fit != null), }) : assert(fit != null),
assert(alignment != null), assert(alignment != null),
assert(clipBehavior != null),
super(key: key, child: child); super(key: key, child: child);
/// How to inscribe the child into the space allocated during layout. /// How to inscribe the child into the space allocated during layout.
...@@ -1436,19 +1435,12 @@ class FittedBox extends SingleChildRenderObjectWidget { ...@@ -1436,19 +1435,12 @@ class FittedBox extends SingleChildRenderObjectWidget {
/// relative to text direction. /// relative to text direction.
final AlignmentGeometry alignment; final AlignmentGeometry alignment;
// TODO(liyuqian): defaults to [Clip.none] once Google references are updated.
/// {@macro flutter.widgets.Clip}
///
/// Defaults to [Clip.hardEdge].
final Clip clipBehavior;
@override @override
RenderFittedBox createRenderObject(BuildContext context) { RenderFittedBox createRenderObject(BuildContext context) {
return RenderFittedBox( return RenderFittedBox(
fit: fit, fit: fit,
alignment: alignment, alignment: alignment,
textDirection: Directionality.of(context), textDirection: Directionality.of(context),
clipBehavior: clipBehavior,
); );
} }
...@@ -1457,8 +1449,7 @@ class FittedBox extends SingleChildRenderObjectWidget { ...@@ -1457,8 +1449,7 @@ class FittedBox extends SingleChildRenderObjectWidget {
renderObject renderObject
..fit = fit ..fit = fit
..alignment = alignment ..alignment = alignment
..textDirection = Directionality.of(context) ..textDirection = Directionality.of(context);
..clipBehavior = clipBehavior;
} }
@override @override
...@@ -2240,9 +2231,7 @@ class UnconstrainedBox extends SingleChildRenderObjectWidget { ...@@ -2240,9 +2231,7 @@ class UnconstrainedBox extends SingleChildRenderObjectWidget {
this.textDirection, this.textDirection,
this.alignment = Alignment.center, this.alignment = Alignment.center,
this.constrainedAxis, this.constrainedAxis,
this.clipBehavior = Clip.hardEdge,
}) : assert(alignment != null), }) : assert(alignment != null),
assert(clipBehavior != null),
super(key: key, child: child); super(key: key, child: child);
/// The text direction to use when interpreting the [alignment] if it is an /// The text direction to use when interpreting the [alignment] if it is an
...@@ -2268,19 +2257,12 @@ class UnconstrainedBox extends SingleChildRenderObjectWidget { ...@@ -2268,19 +2257,12 @@ class UnconstrainedBox extends SingleChildRenderObjectWidget {
/// will be retained. /// will be retained.
final Axis constrainedAxis; final Axis constrainedAxis;
// TODO(liyuqian): defaults to [Clip.none] once Google references are updated.
/// {@macro flutter.widgets.Clip}
///
/// Defaults to [Clip.hardEdge].
final Clip clipBehavior;
@override @override
void updateRenderObject(BuildContext context, covariant RenderUnconstrainedBox renderObject) { void updateRenderObject(BuildContext context, covariant RenderUnconstrainedBox renderObject) {
renderObject renderObject
..textDirection = textDirection ?? Directionality.of(context) ..textDirection = textDirection ?? Directionality.of(context)
..alignment = alignment ..alignment = alignment
..constrainedAxis = constrainedAxis ..constrainedAxis = constrainedAxis;
..clipBehavior = clipBehavior;
} }
@override @override
...@@ -2288,7 +2270,6 @@ class UnconstrainedBox extends SingleChildRenderObjectWidget { ...@@ -2288,7 +2270,6 @@ class UnconstrainedBox extends SingleChildRenderObjectWidget {
textDirection: textDirection ?? Directionality.of(context), textDirection: textDirection ?? Directionality.of(context),
alignment: alignment, alignment: alignment,
constrainedAxis: constrainedAxis, constrainedAxis: constrainedAxis,
clipBehavior: clipBehavior,
); );
@override @override
...@@ -3233,10 +3214,8 @@ class Stack extends MultiChildRenderObjectWidget { ...@@ -3233,10 +3214,8 @@ class Stack extends MultiChildRenderObjectWidget {
this.textDirection, this.textDirection,
this.fit = StackFit.loose, this.fit = StackFit.loose,
this.overflow = Overflow.clip, this.overflow = Overflow.clip,
this.clipBehavior = Clip.hardEdge,
List<Widget> children = const <Widget>[], List<Widget> children = const <Widget>[],
}) : assert(clipBehavior != null), }) : super(key: key, children: children);
super(key: key, children: children);
/// How to align the non-positioned and partially-positioned children in the /// How to align the non-positioned and partially-positioned children in the
/// stack. /// stack.
...@@ -3273,29 +3252,19 @@ class Stack extends MultiChildRenderObjectWidget { ...@@ -3273,29 +3252,19 @@ class Stack extends MultiChildRenderObjectWidget {
/// ([StackFit.expand]). /// ([StackFit.expand]).
final StackFit fit; final StackFit fit;
// TODO(liyuqian): Deprecate and remove [overflow] once its usages are removed from Google.
/// Whether overflowing children should be clipped. See [Overflow]. /// Whether overflowing children should be clipped. See [Overflow].
/// ///
/// Some children in a stack might overflow its box. When this flag is set to /// Some children in a stack might overflow its box. When this flag is set to
/// [Overflow.clip], children cannot paint outside of the stack's box. /// [Overflow.clip], children cannot paint outside of the stack's box.
///
/// This overrides [clipBehavior] for now due to a staged roll out without
/// breaking Google. We will remove it and only use [clipBehavior] soon.
final Overflow overflow; final Overflow overflow;
/// {@macro flutter.widgets.Clip}
///
/// Defaults to [Clip.hardEdge].
final Clip clipBehavior;
@override @override
RenderStack createRenderObject(BuildContext context) { RenderStack createRenderObject(BuildContext context) {
return RenderStack( return RenderStack(
alignment: alignment, alignment: alignment,
textDirection: textDirection ?? Directionality.of(context), textDirection: textDirection ?? Directionality.of(context),
fit: fit, fit: fit,
clipBehavior: overflow == Overflow.clip ? Clip.hardEdge : clipBehavior, overflow: overflow,
); );
} }
...@@ -3305,7 +3274,7 @@ class Stack extends MultiChildRenderObjectWidget { ...@@ -3305,7 +3274,7 @@ class Stack extends MultiChildRenderObjectWidget {
..alignment = alignment ..alignment = alignment
..textDirection = textDirection ?? Directionality.of(context) ..textDirection = textDirection ?? Directionality.of(context)
..fit = fit ..fit = fit
..clipBehavior = overflow == Overflow.clip ? Clip.hardEdge : clipBehavior; ..overflow = overflow;
} }
@override @override
...@@ -3314,7 +3283,7 @@ class Stack extends MultiChildRenderObjectWidget { ...@@ -3314,7 +3283,7 @@ class Stack extends MultiChildRenderObjectWidget {
properties.add(DiagnosticsProperty<AlignmentGeometry>('alignment', alignment)); properties.add(DiagnosticsProperty<AlignmentGeometry>('alignment', alignment));
properties.add(EnumProperty<TextDirection>('textDirection', textDirection, defaultValue: null)); properties.add(EnumProperty<TextDirection>('textDirection', textDirection, defaultValue: null));
properties.add(EnumProperty<StackFit>('fit', fit)); properties.add(EnumProperty<StackFit>('fit', fit));
properties.add(EnumProperty<Clip>('clipBehavior', clipBehavior, defaultValue: Clip.hardEdge)); properties.add(EnumProperty<Overflow>('overflow', overflow));
} }
} }
...@@ -3840,7 +3809,6 @@ class Flex extends MultiChildRenderObjectWidget { ...@@ -3840,7 +3809,6 @@ class Flex extends MultiChildRenderObjectWidget {
this.textDirection, this.textDirection,
this.verticalDirection = VerticalDirection.down, this.verticalDirection = VerticalDirection.down,
this.textBaseline, this.textBaseline,
this.clipBehavior = Clip.hardEdge,
List<Widget> children = const <Widget>[], List<Widget> children = const <Widget>[],
}) : assert(direction != null), }) : assert(direction != null),
assert(mainAxisAlignment != null), assert(mainAxisAlignment != null),
...@@ -3848,7 +3816,6 @@ class Flex extends MultiChildRenderObjectWidget { ...@@ -3848,7 +3816,6 @@ class Flex extends MultiChildRenderObjectWidget {
assert(crossAxisAlignment != null), assert(crossAxisAlignment != null),
assert(verticalDirection != null), assert(verticalDirection != null),
assert(crossAxisAlignment != CrossAxisAlignment.baseline || textBaseline != null), assert(crossAxisAlignment != CrossAxisAlignment.baseline || textBaseline != null),
assert(clipBehavior != null),
super(key: key, children: children); super(key: key, children: children);
/// The direction to use as the main axis. /// The direction to use as the main axis.
...@@ -3933,12 +3900,6 @@ class Flex extends MultiChildRenderObjectWidget { ...@@ -3933,12 +3900,6 @@ class Flex extends MultiChildRenderObjectWidget {
/// If aligning items according to their baseline, which baseline to use. /// If aligning items according to their baseline, which baseline to use.
final TextBaseline textBaseline; final TextBaseline textBaseline;
// TODO(liyuqian): defaults to [Clip.none] once Google references are updated.
/// {@macro flutter.widgets.Clip}
///
/// Defaults to [Clip.hardEdge].
final Clip clipBehavior;
bool get _needTextDirection { bool get _needTextDirection {
assert(direction != null); assert(direction != null);
switch (direction) { switch (direction) {
...@@ -3982,7 +3943,6 @@ class Flex extends MultiChildRenderObjectWidget { ...@@ -3982,7 +3943,6 @@ class Flex extends MultiChildRenderObjectWidget {
textDirection: getEffectiveTextDirection(context), textDirection: getEffectiveTextDirection(context),
verticalDirection: verticalDirection, verticalDirection: verticalDirection,
textBaseline: textBaseline, textBaseline: textBaseline,
clipBehavior: clipBehavior,
); );
} }
...@@ -3995,8 +3955,7 @@ class Flex extends MultiChildRenderObjectWidget { ...@@ -3995,8 +3955,7 @@ class Flex extends MultiChildRenderObjectWidget {
..crossAxisAlignment = crossAxisAlignment ..crossAxisAlignment = crossAxisAlignment
..textDirection = getEffectiveTextDirection(context) ..textDirection = getEffectiveTextDirection(context)
..verticalDirection = verticalDirection ..verticalDirection = verticalDirection
..textBaseline = textBaseline ..textBaseline = textBaseline;
..clipBehavior = clipBehavior;
} }
@override @override
...@@ -4667,9 +4626,8 @@ class Wrap extends MultiChildRenderObjectWidget { ...@@ -4667,9 +4626,8 @@ class Wrap extends MultiChildRenderObjectWidget {
this.crossAxisAlignment = WrapCrossAlignment.start, this.crossAxisAlignment = WrapCrossAlignment.start,
this.textDirection, this.textDirection,
this.verticalDirection = VerticalDirection.down, this.verticalDirection = VerticalDirection.down,
this.clipBehavior = Clip.hardEdge,
List<Widget> children = const <Widget>[], List<Widget> children = const <Widget>[],
}) : assert(clipBehavior != null), super(key: key, children: children); }) : super(key: key, children: children);
/// The direction to use as the main axis. /// The direction to use as the main axis.
/// ///
...@@ -4803,12 +4761,6 @@ class Wrap extends MultiChildRenderObjectWidget { ...@@ -4803,12 +4761,6 @@ class Wrap extends MultiChildRenderObjectWidget {
/// [verticalDirection] must not be null. /// [verticalDirection] must not be null.
final VerticalDirection verticalDirection; final VerticalDirection verticalDirection;
// TODO(liyuqian): defaults to [Clip.none] once Google references are updated.
/// {@macro flutter.widgets.Clip}
///
/// Defaults to [Clip.hardEdge].
final Clip clipBehavior;
@override @override
RenderWrap createRenderObject(BuildContext context) { RenderWrap createRenderObject(BuildContext context) {
return RenderWrap( return RenderWrap(
...@@ -4820,7 +4772,6 @@ class Wrap extends MultiChildRenderObjectWidget { ...@@ -4820,7 +4772,6 @@ class Wrap extends MultiChildRenderObjectWidget {
crossAxisAlignment: crossAxisAlignment, crossAxisAlignment: crossAxisAlignment,
textDirection: textDirection ?? Directionality.of(context), textDirection: textDirection ?? Directionality.of(context),
verticalDirection: verticalDirection, verticalDirection: verticalDirection,
clipBehavior: clipBehavior,
); );
} }
...@@ -4834,8 +4785,7 @@ class Wrap extends MultiChildRenderObjectWidget { ...@@ -4834,8 +4785,7 @@ class Wrap extends MultiChildRenderObjectWidget {
..runSpacing = runSpacing ..runSpacing = runSpacing
..crossAxisAlignment = crossAxisAlignment ..crossAxisAlignment = crossAxisAlignment
..textDirection = textDirection ?? Directionality.of(context) ..textDirection = textDirection ?? Directionality.of(context)
..verticalDirection = verticalDirection ..verticalDirection = verticalDirection;
..clipBehavior = clipBehavior;
} }
@override @override
......
...@@ -413,7 +413,6 @@ class EditableText extends StatefulWidget { ...@@ -413,7 +413,6 @@ class EditableText extends StatefulWidget {
selectAll: true, selectAll: true,
), ),
this.autofillHints, this.autofillHints,
this.clipBehavior = Clip.hardEdge,
}) : assert(controller != null), }) : assert(controller != null),
assert(focusNode != null), assert(focusNode != null),
assert(obscuringCharacter != null && obscuringCharacter.length == 1), assert(obscuringCharacter != null && obscuringCharacter.length == 1),
...@@ -451,7 +450,6 @@ class EditableText extends StatefulWidget { ...@@ -451,7 +450,6 @@ class EditableText extends StatefulWidget {
assert(scrollPadding != null), assert(scrollPadding != null),
assert(dragStartBehavior != null), assert(dragStartBehavior != null),
assert(toolbarOptions != null), assert(toolbarOptions != null),
assert(clipBehavior != null),
_strutStyle = strutStyle, _strutStyle = strutStyle,
keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline), keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline),
inputFormatters = maxLines == 1 inputFormatters = maxLines == 1
...@@ -1122,11 +1120,6 @@ class EditableText extends StatefulWidget { ...@@ -1122,11 +1120,6 @@ class EditableText extends StatefulWidget {
/// {@endtemplate} /// {@endtemplate}
final Iterable<String> autofillHints; final Iterable<String> autofillHints;
/// {@macro flutter.widgets.Clip}
///
/// Defaults to [Clip.hardEdge].
final Clip clipBehavior;
@override @override
EditableTextState createState() => EditableTextState(); EditableTextState createState() => EditableTextState();
...@@ -2096,7 +2089,6 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien ...@@ -2096,7 +2089,6 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
devicePixelRatio: _devicePixelRatio, devicePixelRatio: _devicePixelRatio,
promptRectRange: _currentPromptRectRange, promptRectRange: _currentPromptRectRange,
promptRectColor: widget.autocorrectionTextRectColor, promptRectColor: widget.autocorrectionTextRectColor,
clipBehavior: widget.clipBehavior,
), ),
), ),
); );
...@@ -2171,7 +2163,6 @@ class _Editable extends LeafRenderObjectWidget { ...@@ -2171,7 +2163,6 @@ class _Editable extends LeafRenderObjectWidget {
this.devicePixelRatio, this.devicePixelRatio,
this.promptRectRange, this.promptRectRange,
this.promptRectColor, this.promptRectColor,
this.clipBehavior,
}) : assert(textDirection != null), }) : assert(textDirection != null),
assert(rendererIgnoresPointer != null), assert(rendererIgnoresPointer != null),
super(key: key); super(key: key);
...@@ -2217,7 +2208,6 @@ class _Editable extends LeafRenderObjectWidget { ...@@ -2217,7 +2208,6 @@ class _Editable extends LeafRenderObjectWidget {
final double devicePixelRatio; final double devicePixelRatio;
final TextRange promptRectRange; final TextRange promptRectRange;
final Color promptRectColor; final Color promptRectColor;
final Clip clipBehavior;
@override @override
RenderEditable createRenderObject(BuildContext context) { RenderEditable createRenderObject(BuildContext context) {
...@@ -2259,7 +2249,6 @@ class _Editable extends LeafRenderObjectWidget { ...@@ -2259,7 +2249,6 @@ class _Editable extends LeafRenderObjectWidget {
devicePixelRatio: devicePixelRatio, devicePixelRatio: devicePixelRatio,
promptRectRange: promptRectRange, promptRectRange: promptRectRange,
promptRectColor: promptRectColor, promptRectColor: promptRectColor,
clipBehavior: clipBehavior,
); );
} }
...@@ -2300,7 +2289,6 @@ class _Editable extends LeafRenderObjectWidget { ...@@ -2300,7 +2289,6 @@ class _Editable extends LeafRenderObjectWidget {
..devicePixelRatio = devicePixelRatio ..devicePixelRatio = devicePixelRatio
..paintCursorAboveText = paintCursorAboveText ..paintCursorAboveText = paintCursorAboveText
..promptRectColor = promptRectColor ..promptRectColor = promptRectColor
..clipBehavior = clipBehavior
..setPromptRectRange(promptRectRange); ..setPromptRectRange(promptRectRange);
} }
} }
......
...@@ -579,8 +579,8 @@ class ListWheelScrollView extends StatefulWidget { ...@@ -579,8 +579,8 @@ class ListWheelScrollView extends StatefulWidget {
@required this.itemExtent, @required this.itemExtent,
this.squeeze = 1.0, this.squeeze = 1.0,
this.onSelectedItemChanged, this.onSelectedItemChanged,
this.clipToSize = true,
this.renderChildrenOutsideViewport = false, this.renderChildrenOutsideViewport = false,
this.clipBehavior = Clip.hardEdge,
@required List<Widget> children, @required List<Widget> children,
}) : assert(children != null), }) : assert(children != null),
assert(diameterRatio != null), assert(diameterRatio != null),
...@@ -595,11 +595,11 @@ class ListWheelScrollView extends StatefulWidget { ...@@ -595,11 +595,11 @@ class ListWheelScrollView extends StatefulWidget {
assert(itemExtent > 0), assert(itemExtent > 0),
assert(squeeze != null), assert(squeeze != null),
assert(squeeze > 0), assert(squeeze > 0),
assert(clipToSize != null),
assert(renderChildrenOutsideViewport != null), assert(renderChildrenOutsideViewport != null),
assert(clipBehavior != null),
assert( assert(
!renderChildrenOutsideViewport || clipBehavior == Clip.none, !renderChildrenOutsideViewport || !clipToSize,
RenderListWheelViewport.clipBehaviorAndRenderChildrenOutsideViewportConflict, RenderListWheelViewport.clipToSizeAndRenderChildrenOutsideViewportConflict,
), ),
childDelegate = ListWheelChildListDelegate(children: children), childDelegate = ListWheelChildListDelegate(children: children),
super(key: key); super(key: key);
...@@ -619,8 +619,8 @@ class ListWheelScrollView extends StatefulWidget { ...@@ -619,8 +619,8 @@ class ListWheelScrollView extends StatefulWidget {
@required this.itemExtent, @required this.itemExtent,
this.squeeze = 1.0, this.squeeze = 1.0,
this.onSelectedItemChanged, this.onSelectedItemChanged,
this.clipToSize = true,
this.renderChildrenOutsideViewport = false, this.renderChildrenOutsideViewport = false,
this.clipBehavior = Clip.hardEdge,
@required this.childDelegate, @required this.childDelegate,
}) : assert(childDelegate != null), }) : assert(childDelegate != null),
assert(diameterRatio != null), assert(diameterRatio != null),
...@@ -635,11 +635,11 @@ class ListWheelScrollView extends StatefulWidget { ...@@ -635,11 +635,11 @@ class ListWheelScrollView extends StatefulWidget {
assert(itemExtent > 0), assert(itemExtent > 0),
assert(squeeze != null), assert(squeeze != null),
assert(squeeze > 0), assert(squeeze > 0),
assert(clipToSize != null),
assert(renderChildrenOutsideViewport != null), assert(renderChildrenOutsideViewport != null),
assert(clipBehavior != null),
assert( assert(
!renderChildrenOutsideViewport || clipBehavior == Clip.none, !renderChildrenOutsideViewport || !clipToSize,
RenderListWheelViewport.clipBehaviorAndRenderChildrenOutsideViewportConflict, RenderListWheelViewport.clipToSizeAndRenderChildrenOutsideViewportConflict,
), ),
super(key: key); super(key: key);
...@@ -698,17 +698,15 @@ class ListWheelScrollView extends StatefulWidget { ...@@ -698,17 +698,15 @@ class ListWheelScrollView extends StatefulWidget {
/// On optional listener that's called when the centered item changes. /// On optional listener that's called when the centered item changes.
final ValueChanged<int> onSelectedItemChanged; final ValueChanged<int> onSelectedItemChanged;
/// {@macro flutter.rendering.wheelList.clipToSize}
final bool clipToSize;
/// {@macro flutter.rendering.wheelList.renderChildrenOutsideViewport} /// {@macro flutter.rendering.wheelList.renderChildrenOutsideViewport}
final bool renderChildrenOutsideViewport; final bool renderChildrenOutsideViewport;
/// A delegate that helps lazily instantiating child. /// A delegate that helps lazily instantiating child.
final ListWheelChildDelegate childDelegate; final ListWheelChildDelegate childDelegate;
/// {@macro flutter.widgets.Clip}
///
/// Defaults to [Clip.hardEdge].
final Clip clipBehavior;
@override @override
_ListWheelScrollViewState createState() => _ListWheelScrollViewState(); _ListWheelScrollViewState createState() => _ListWheelScrollViewState();
} }
...@@ -771,10 +769,10 @@ class _ListWheelScrollViewState extends State<ListWheelScrollView> { ...@@ -771,10 +769,10 @@ class _ListWheelScrollViewState extends State<ListWheelScrollView> {
overAndUnderCenterOpacity: widget.overAndUnderCenterOpacity, overAndUnderCenterOpacity: widget.overAndUnderCenterOpacity,
itemExtent: widget.itemExtent, itemExtent: widget.itemExtent,
squeeze: widget.squeeze, squeeze: widget.squeeze,
clipToSize: widget.clipToSize,
renderChildrenOutsideViewport: widget.renderChildrenOutsideViewport, renderChildrenOutsideViewport: widget.renderChildrenOutsideViewport,
offset: offset, offset: offset,
childDelegate: widget.childDelegate, childDelegate: widget.childDelegate,
clipBehavior: widget.clipBehavior,
); );
}, },
), ),
...@@ -952,7 +950,7 @@ class ListWheelViewport extends RenderObjectWidget { ...@@ -952,7 +950,7 @@ class ListWheelViewport extends RenderObjectWidget {
/// ///
/// The [itemExtent] argument in pixels must be provided and must be positive. /// The [itemExtent] argument in pixels must be provided and must be positive.
/// ///
/// The [clipBehavior] argument defaults to [Clip.hardEdge] and must not be null. /// The [clipToSize] argument defaults to true and must not be null.
/// ///
/// The [renderChildrenOutsideViewport] argument defaults to false and must /// The [renderChildrenOutsideViewport] argument defaults to false and must
/// not be null. /// not be null.
...@@ -968,10 +966,10 @@ class ListWheelViewport extends RenderObjectWidget { ...@@ -968,10 +966,10 @@ class ListWheelViewport extends RenderObjectWidget {
this.overAndUnderCenterOpacity = 1.0, this.overAndUnderCenterOpacity = 1.0,
@required this.itemExtent, @required this.itemExtent,
this.squeeze = 1.0, this.squeeze = 1.0,
this.clipToSize = true,
this.renderChildrenOutsideViewport = false, this.renderChildrenOutsideViewport = false,
@required this.offset, @required this.offset,
@required this.childDelegate, @required this.childDelegate,
this.clipBehavior = Clip.hardEdge,
}) : assert(childDelegate != null), }) : assert(childDelegate != null),
assert(offset != null), assert(offset != null),
assert(diameterRatio != null), assert(diameterRatio != null),
...@@ -985,11 +983,11 @@ class ListWheelViewport extends RenderObjectWidget { ...@@ -985,11 +983,11 @@ class ListWheelViewport extends RenderObjectWidget {
assert(itemExtent > 0), assert(itemExtent > 0),
assert(squeeze != null), assert(squeeze != null),
assert(squeeze > 0), assert(squeeze > 0),
assert(clipToSize != null),
assert(renderChildrenOutsideViewport != null), assert(renderChildrenOutsideViewport != null),
assert(clipBehavior != null),
assert( assert(
!renderChildrenOutsideViewport || clipBehavior == Clip.none, !renderChildrenOutsideViewport || !clipToSize,
RenderListWheelViewport.clipBehaviorAndRenderChildrenOutsideViewportConflict, RenderListWheelViewport.clipToSizeAndRenderChildrenOutsideViewportConflict,
), ),
super(key: key); super(key: key);
...@@ -1019,6 +1017,9 @@ class ListWheelViewport extends RenderObjectWidget { ...@@ -1019,6 +1017,9 @@ class ListWheelViewport extends RenderObjectWidget {
/// Defaults to 1. /// Defaults to 1.
final double squeeze; final double squeeze;
/// {@macro flutter.rendering.wheelList.clipToSize}
final bool clipToSize;
/// {@macro flutter.rendering.wheelList.renderChildrenOutsideViewport} /// {@macro flutter.rendering.wheelList.renderChildrenOutsideViewport}
final bool renderChildrenOutsideViewport; final bool renderChildrenOutsideViewport;
...@@ -1029,11 +1030,6 @@ class ListWheelViewport extends RenderObjectWidget { ...@@ -1029,11 +1030,6 @@ class ListWheelViewport extends RenderObjectWidget {
/// A delegate that lazily instantiates children. /// A delegate that lazily instantiates children.
final ListWheelChildDelegate childDelegate; final ListWheelChildDelegate childDelegate;
/// {@macro flutter.widgets.Clip}
///
/// Defaults to [Clip.none].
final Clip clipBehavior;
@override @override
ListWheelElement createElement() => ListWheelElement(this); ListWheelElement createElement() => ListWheelElement(this);
...@@ -1051,8 +1047,8 @@ class ListWheelViewport extends RenderObjectWidget { ...@@ -1051,8 +1047,8 @@ class ListWheelViewport extends RenderObjectWidget {
overAndUnderCenterOpacity: overAndUnderCenterOpacity, overAndUnderCenterOpacity: overAndUnderCenterOpacity,
itemExtent: itemExtent, itemExtent: itemExtent,
squeeze: squeeze, squeeze: squeeze,
clipToSize: clipToSize,
renderChildrenOutsideViewport: renderChildrenOutsideViewport, renderChildrenOutsideViewport: renderChildrenOutsideViewport,
clipBehavior: clipBehavior,
); );
} }
...@@ -1068,7 +1064,7 @@ class ListWheelViewport extends RenderObjectWidget { ...@@ -1068,7 +1064,7 @@ class ListWheelViewport extends RenderObjectWidget {
..overAndUnderCenterOpacity = overAndUnderCenterOpacity ..overAndUnderCenterOpacity = overAndUnderCenterOpacity
..itemExtent = itemExtent ..itemExtent = itemExtent
..squeeze = squeeze ..squeeze = squeeze
..renderChildrenOutsideViewport = renderChildrenOutsideViewport ..clipToSize = clipToSize
..clipBehavior = clipBehavior; ..renderChildrenOutsideViewport = renderChildrenOutsideViewport;
} }
} }
...@@ -193,12 +193,10 @@ class NestedScrollView extends StatefulWidget { ...@@ -193,12 +193,10 @@ class NestedScrollView extends StatefulWidget {
@required this.headerSliverBuilder, @required this.headerSliverBuilder,
@required this.body, @required this.body,
this.dragStartBehavior = DragStartBehavior.start, this.dragStartBehavior = DragStartBehavior.start,
this.clipBehavior = Clip.hardEdge,
}) : assert(scrollDirection != null), }) : assert(scrollDirection != null),
assert(reverse != null), assert(reverse != null),
assert(headerSliverBuilder != null), assert(headerSliverBuilder != null),
assert(body != null), assert(body != null),
assert(clipBehavior != null),
super(key: key); super(key: key);
/// An object that can be used to control the position to which the outer /// An object that can be used to control the position to which the outer
...@@ -262,11 +260,6 @@ class NestedScrollView extends StatefulWidget { ...@@ -262,11 +260,6 @@ class NestedScrollView extends StatefulWidget {
/// {@macro flutter.widgets.scrollable.dragStartBehavior} /// {@macro flutter.widgets.scrollable.dragStartBehavior}
final DragStartBehavior dragStartBehavior; final DragStartBehavior dragStartBehavior;
/// {@macro flutter.widgets.Clip}
///
/// Defaults to [Clip.hardEdge].
final Clip clipBehavior;
/// Returns the [SliverOverlapAbsorberHandle] of the nearest ancestor /// Returns the [SliverOverlapAbsorberHandle] of the nearest ancestor
/// [NestedScrollView]. /// [NestedScrollView].
/// ///
...@@ -444,7 +437,6 @@ class NestedScrollViewState extends State<NestedScrollView> { ...@@ -444,7 +437,6 @@ class NestedScrollViewState extends State<NestedScrollView> {
_lastHasScrolledBody, _lastHasScrolledBody,
), ),
handle: _absorberHandle, handle: _absorberHandle,
clipBehavior: widget.clipBehavior,
); );
}, },
), ),
...@@ -460,7 +452,6 @@ class _NestedScrollViewCustomScrollView extends CustomScrollView { ...@@ -460,7 +452,6 @@ class _NestedScrollViewCustomScrollView extends CustomScrollView {
@required ScrollController controller, @required ScrollController controller,
@required List<Widget> slivers, @required List<Widget> slivers,
@required this.handle, @required this.handle,
@required this.clipBehavior,
DragStartBehavior dragStartBehavior = DragStartBehavior.start, DragStartBehavior dragStartBehavior = DragStartBehavior.start,
}) : super( }) : super(
scrollDirection: scrollDirection, scrollDirection: scrollDirection,
...@@ -472,7 +463,6 @@ class _NestedScrollViewCustomScrollView extends CustomScrollView { ...@@ -472,7 +463,6 @@ class _NestedScrollViewCustomScrollView extends CustomScrollView {
); );
final SliverOverlapAbsorberHandle handle; final SliverOverlapAbsorberHandle handle;
final Clip clipBehavior;
@override @override
Widget buildViewport( Widget buildViewport(
...@@ -487,7 +477,6 @@ class _NestedScrollViewCustomScrollView extends CustomScrollView { ...@@ -487,7 +477,6 @@ class _NestedScrollViewCustomScrollView extends CustomScrollView {
offset: offset, offset: offset,
slivers: slivers, slivers: slivers,
handle: handle, handle: handle,
clipBehavior: clipBehavior,
); );
} }
} }
...@@ -1835,7 +1824,6 @@ class NestedScrollViewViewport extends Viewport { ...@@ -1835,7 +1824,6 @@ class NestedScrollViewViewport extends Viewport {
Key center, Key center,
List<Widget> slivers = const <Widget>[], List<Widget> slivers = const <Widget>[],
@required this.handle, @required this.handle,
Clip clipBehavior = Clip.hardEdge,
}) : assert(handle != null), }) : assert(handle != null),
super( super(
key: key, key: key,
...@@ -1845,7 +1833,6 @@ class NestedScrollViewViewport extends Viewport { ...@@ -1845,7 +1833,6 @@ class NestedScrollViewViewport extends Viewport {
offset: offset, offset: offset,
center: center, center: center,
slivers: slivers, slivers: slivers,
clipBehavior: clipBehavior,
); );
/// The handle to the [SliverOverlapAbsorber] that is feeding this injector. /// The handle to the [SliverOverlapAbsorber] that is feeding this injector.
...@@ -1862,7 +1849,6 @@ class NestedScrollViewViewport extends Viewport { ...@@ -1862,7 +1849,6 @@ class NestedScrollViewViewport extends Viewport {
anchor: anchor, anchor: anchor,
offset: offset, offset: offset,
handle: handle, handle: handle,
clipBehavior: clipBehavior,
); );
} }
...@@ -1876,8 +1862,7 @@ class NestedScrollViewViewport extends Viewport { ...@@ -1876,8 +1862,7 @@ class NestedScrollViewViewport extends Viewport {
) )
..anchor = anchor ..anchor = anchor
..offset = offset ..offset = offset
..handle = handle ..handle = handle;
..clipBehavior = clipBehavior;
} }
@override @override
...@@ -1904,7 +1889,6 @@ class RenderNestedScrollViewViewport extends RenderViewport { ...@@ -1904,7 +1889,6 @@ class RenderNestedScrollViewViewport extends RenderViewport {
List<RenderSliver> children, List<RenderSliver> children,
RenderSliver center, RenderSliver center,
@required SliverOverlapAbsorberHandle handle, @required SliverOverlapAbsorberHandle handle,
Clip clipBehavior = Clip.hardEdge,
}) : assert(handle != null), }) : assert(handle != null),
_handle = handle, _handle = handle,
super( super(
...@@ -1914,7 +1898,6 @@ class RenderNestedScrollViewViewport extends RenderViewport { ...@@ -1914,7 +1898,6 @@ class RenderNestedScrollViewViewport extends RenderViewport {
anchor: anchor, anchor: anchor,
children: children, children: children,
center: center, center: center,
clipBehavior: clipBehavior,
); );
/// The object to notify when [markNeedsLayout] is called. /// The object to notify when [markNeedsLayout] is called.
......
...@@ -219,10 +219,8 @@ class SingleChildScrollView extends StatelessWidget { ...@@ -219,10 +219,8 @@ class SingleChildScrollView extends StatelessWidget {
this.controller, this.controller,
this.child, this.child,
this.dragStartBehavior = DragStartBehavior.start, this.dragStartBehavior = DragStartBehavior.start,
this.clipBehavior = Clip.hardEdge,
}) : assert(scrollDirection != null), }) : assert(scrollDirection != null),
assert(dragStartBehavior != null), assert(dragStartBehavior != null),
assert(clipBehavior != null),
assert(!(controller != null && primary == true), assert(!(controller != null && primary == true),
'Primary ScrollViews obtain their ScrollController via inheritance from a PrimaryScrollController widget. ' 'Primary ScrollViews obtain their ScrollController via inheritance from a PrimaryScrollController widget. '
'You cannot both set primary to true and pass an explicit controller.' 'You cannot both set primary to true and pass an explicit controller.'
...@@ -292,11 +290,6 @@ class SingleChildScrollView extends StatelessWidget { ...@@ -292,11 +290,6 @@ class SingleChildScrollView extends StatelessWidget {
/// {@macro flutter.widgets.scrollable.dragStartBehavior} /// {@macro flutter.widgets.scrollable.dragStartBehavior}
final DragStartBehavior dragStartBehavior; final DragStartBehavior dragStartBehavior;
/// {@macro flutter.widgets.Clip}
///
/// Defaults to [Clip.hardEdge].
final Clip clipBehavior;
AxisDirection _getDirection(BuildContext context) { AxisDirection _getDirection(BuildContext context) {
return getAxisDirectionFromAxisReverseAndDirectionality(context, scrollDirection, reverse); return getAxisDirectionFromAxisReverseAndDirectionality(context, scrollDirection, reverse);
} }
...@@ -320,7 +313,6 @@ class SingleChildScrollView extends StatelessWidget { ...@@ -320,7 +313,6 @@ class SingleChildScrollView extends StatelessWidget {
axisDirection: axisDirection, axisDirection: axisDirection,
offset: offset, offset: offset,
child: contents, child: contents,
clipBehavior: clipBehavior,
); );
}, },
); );
...@@ -336,21 +328,17 @@ class _SingleChildViewport extends SingleChildRenderObjectWidget { ...@@ -336,21 +328,17 @@ class _SingleChildViewport extends SingleChildRenderObjectWidget {
this.axisDirection = AxisDirection.down, this.axisDirection = AxisDirection.down,
this.offset, this.offset,
Widget child, Widget child,
@required this.clipBehavior,
}) : assert(axisDirection != null), }) : assert(axisDirection != null),
assert(clipBehavior != null),
super(key: key, child: child); super(key: key, child: child);
final AxisDirection axisDirection; final AxisDirection axisDirection;
final ViewportOffset offset; final ViewportOffset offset;
final Clip clipBehavior;
@override @override
_RenderSingleChildViewport createRenderObject(BuildContext context) { _RenderSingleChildViewport createRenderObject(BuildContext context) {
return _RenderSingleChildViewport( return _RenderSingleChildViewport(
axisDirection: axisDirection, axisDirection: axisDirection,
offset: offset, offset: offset,
clipBehavior: clipBehavior,
); );
} }
...@@ -359,8 +347,7 @@ class _SingleChildViewport extends SingleChildRenderObjectWidget { ...@@ -359,8 +347,7 @@ class _SingleChildViewport extends SingleChildRenderObjectWidget {
// Order dependency: The offset setter reads the axis direction. // Order dependency: The offset setter reads the axis direction.
renderObject renderObject
..axisDirection = axisDirection ..axisDirection = axisDirection
..offset = offset ..offset = offset;
..clipBehavior = clipBehavior;
} }
} }
...@@ -370,15 +357,12 @@ class _RenderSingleChildViewport extends RenderBox with RenderObjectWithChildMix ...@@ -370,15 +357,12 @@ class _RenderSingleChildViewport extends RenderBox with RenderObjectWithChildMix
@required ViewportOffset offset, @required ViewportOffset offset,
double cacheExtent = RenderAbstractViewport.defaultCacheExtent, double cacheExtent = RenderAbstractViewport.defaultCacheExtent,
RenderBox child, RenderBox child,
@required Clip clipBehavior,
}) : assert(axisDirection != null), }) : assert(axisDirection != null),
assert(offset != null), assert(offset != null),
assert(cacheExtent != null), assert(cacheExtent != null),
assert(clipBehavior != null),
_axisDirection = axisDirection, _axisDirection = axisDirection,
_offset = offset, _offset = offset,
_cacheExtent = cacheExtent, _cacheExtent = cacheExtent {
_clipBehavior = clipBehavior {
this.child = child; this.child = child;
} }
...@@ -419,20 +403,6 @@ class _RenderSingleChildViewport extends RenderBox with RenderObjectWithChildMix ...@@ -419,20 +403,6 @@ class _RenderSingleChildViewport extends RenderBox with RenderObjectWithChildMix
markNeedsLayout(); markNeedsLayout();
} }
/// {@macro flutter.widgets.Clip}
///
/// Defaults to [Clip.none], and must not be null.
Clip get clipBehavior => _clipBehavior;
Clip _clipBehavior = Clip.none;
set clipBehavior(Clip value) {
assert(value != null);
if (value != _clipBehavior) {
_clipBehavior = value;
markNeedsPaint();
markNeedsSemanticsUpdate();
}
}
void _hasScrolled() { void _hasScrolled() {
markNeedsPaint(); markNeedsPaint();
markNeedsSemanticsUpdate(); markNeedsSemanticsUpdate();
...@@ -578,8 +548,8 @@ class _RenderSingleChildViewport extends RenderBox with RenderObjectWithChildMix ...@@ -578,8 +548,8 @@ class _RenderSingleChildViewport extends RenderBox with RenderObjectWithChildMix
context.paintChild(child, offset + paintOffset); context.paintChild(child, offset + paintOffset);
} }
if (_shouldClipAtPaintOffset(paintOffset) && clipBehavior != Clip.none) { if (_shouldClipAtPaintOffset(paintOffset)) {
context.pushClipRect(needsCompositing, offset, Offset.zero & size, paintContents, clipBehavior: clipBehavior); context.pushClipRect(needsCompositing, offset, Offset.zero & size, paintContents);
} else { } else {
paintContents(context, offset); paintContents(context, offset);
} }
......
...@@ -58,14 +58,12 @@ class Viewport extends MultiChildRenderObjectWidget { ...@@ -58,14 +58,12 @@ class Viewport extends MultiChildRenderObjectWidget {
this.center, this.center,
this.cacheExtent, this.cacheExtent,
this.cacheExtentStyle = CacheExtentStyle.pixel, this.cacheExtentStyle = CacheExtentStyle.pixel,
this.clipBehavior = Clip.hardEdge,
List<Widget> slivers = const <Widget>[], List<Widget> slivers = const <Widget>[],
}) : assert(offset != null), }) : assert(offset != null),
assert(slivers != null), assert(slivers != null),
assert(center == null || slivers.where((Widget child) => child.key == center).length == 1), assert(center == null || slivers.where((Widget child) => child.key == center).length == 1),
assert(cacheExtentStyle != null), assert(cacheExtentStyle != null),
assert(cacheExtentStyle != CacheExtentStyle.viewport || cacheExtent != null), assert(cacheExtentStyle != CacheExtentStyle.viewport || cacheExtent != null),
assert(clipBehavior != null),
super(key: key, children: slivers); super(key: key, children: slivers);
/// The direction in which the [offset]'s [ViewportOffset.pixels] increases. /// The direction in which the [offset]'s [ViewportOffset.pixels] increases.
...@@ -120,11 +118,6 @@ class Viewport extends MultiChildRenderObjectWidget { ...@@ -120,11 +118,6 @@ class Viewport extends MultiChildRenderObjectWidget {
/// {@macro flutter.rendering.viewport.cacheExtentStyle} /// {@macro flutter.rendering.viewport.cacheExtentStyle}
final CacheExtentStyle cacheExtentStyle; final CacheExtentStyle cacheExtentStyle;
/// {@macro flutter.widgets.Clip}
///
/// Defaults to [Clip.none].
final Clip clipBehavior;
/// Given a [BuildContext] and an [AxisDirection], determine the correct cross /// Given a [BuildContext] and an [AxisDirection], determine the correct cross
/// axis direction. /// axis direction.
/// ///
...@@ -154,7 +147,6 @@ class Viewport extends MultiChildRenderObjectWidget { ...@@ -154,7 +147,6 @@ class Viewport extends MultiChildRenderObjectWidget {
offset: offset, offset: offset,
cacheExtent: cacheExtent, cacheExtent: cacheExtent,
cacheExtentStyle: cacheExtentStyle, cacheExtentStyle: cacheExtentStyle,
clipBehavior: clipBehavior,
); );
} }
...@@ -166,8 +158,7 @@ class Viewport extends MultiChildRenderObjectWidget { ...@@ -166,8 +158,7 @@ class Viewport extends MultiChildRenderObjectWidget {
..anchor = anchor ..anchor = anchor
..offset = offset ..offset = offset
..cacheExtent = cacheExtent ..cacheExtent = cacheExtent
..cacheExtentStyle = cacheExtentStyle ..cacheExtentStyle = cacheExtentStyle;
..clipBehavior = clipBehavior;
} }
@override @override
...@@ -272,7 +263,6 @@ class ShrinkWrappingViewport extends MultiChildRenderObjectWidget { ...@@ -272,7 +263,6 @@ class ShrinkWrappingViewport extends MultiChildRenderObjectWidget {
this.axisDirection = AxisDirection.down, this.axisDirection = AxisDirection.down,
this.crossAxisDirection, this.crossAxisDirection,
@required this.offset, @required this.offset,
this.clipBehavior = Clip.hardEdge,
List<Widget> slivers = const <Widget>[], List<Widget> slivers = const <Widget>[],
}) : assert(offset != null), }) : assert(offset != null),
super(key: key, children: slivers); super(key: key, children: slivers);
...@@ -305,18 +295,12 @@ class ShrinkWrappingViewport extends MultiChildRenderObjectWidget { ...@@ -305,18 +295,12 @@ class ShrinkWrappingViewport extends MultiChildRenderObjectWidget {
/// Typically a [ScrollPosition]. /// Typically a [ScrollPosition].
final ViewportOffset offset; final ViewportOffset offset;
/// {@macro flutter.widgets.Clip}
///
/// Defaults to [Clip.hardEdge].
final Clip clipBehavior;
@override @override
RenderShrinkWrappingViewport createRenderObject(BuildContext context) { RenderShrinkWrappingViewport createRenderObject(BuildContext context) {
return RenderShrinkWrappingViewport( return RenderShrinkWrappingViewport(
axisDirection: axisDirection, axisDirection: axisDirection,
crossAxisDirection: crossAxisDirection ?? Viewport.getDefaultCrossAxisDirection(context, axisDirection), crossAxisDirection: crossAxisDirection ?? Viewport.getDefaultCrossAxisDirection(context, axisDirection),
offset: offset, offset: offset,
clipBehavior: clipBehavior,
); );
} }
...@@ -325,8 +309,7 @@ class ShrinkWrappingViewport extends MultiChildRenderObjectWidget { ...@@ -325,8 +309,7 @@ class ShrinkWrappingViewport extends MultiChildRenderObjectWidget {
renderObject renderObject
..axisDirection = axisDirection ..axisDirection = axisDirection
..crossAxisDirection = crossAxisDirection ?? Viewport.getDefaultCrossAxisDirection(context, axisDirection) ..crossAxisDirection = crossAxisDirection ?? Viewport.getDefaultCrossAxisDirection(context, axisDirection)
..offset = offset ..offset = offset;
..clipBehavior = clipBehavior;
} }
@override @override
......
...@@ -2143,8 +2143,8 @@ void main() { ...@@ -2143,8 +2143,8 @@ void main() {
// hard coded 16px margin in the dropdown code, so that // hard coded 16px margin in the dropdown code, so that
// this hint aligns "properly" with the menu. // this hint aligns "properly" with the menu.
return Stack( return Stack(
clipBehavior: Clip.none,
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
overflow: Overflow.visible,
children: <Widget>[ children: <Widget>[
PositionedDirectional( PositionedDirectional(
width: constraints.maxWidth + hintPaddingOffset, width: constraints.maxWidth + hintPaddingOffset,
......
...@@ -670,33 +670,6 @@ void main() { ...@@ -670,33 +670,6 @@ void main() {
expect(unconstrained.size.height, equals(100.0), reason: 'constrained height'); expect(unconstrained.size.height, equals(100.0), reason: 'constrained height');
}); });
test('clipBehavior is respected', () {
const BoxConstraints viewport = BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
final TestClipPaintingContext context = TestClipPaintingContext();
// By default, clipBehavior should be Clip.none
final RenderUnconstrainedBox defaultBox = RenderUnconstrainedBox(
alignment: Alignment.center,
textDirection: TextDirection.ltr,
child: box200x200,
);
layout(defaultBox, constraints: viewport, phase: EnginePhase.composite, onErrors: expectOverflowedErrors);
defaultBox.paint(context, Offset.zero);
expect(context.clipBehavior, equals(Clip.none));
for (final Clip clip in Clip.values) {
final RenderUnconstrainedBox box = RenderUnconstrainedBox(
alignment: Alignment.center,
textDirection: TextDirection.ltr,
child: box200x200,
clipBehavior: clip,
);
layout(box, constraints: viewport, phase: EnginePhase.composite, onErrors: expectOverflowedErrors);
box.paint(context, Offset.zero);
expect(context.clipBehavior, equals(clip));
}
});
group('hit testing', () { group('hit testing', () {
test('BoxHitTestResult wrapping HitTestResult', () { test('BoxHitTestResult wrapping HitTestResult', () {
final HitTestEntry entry1 = HitTestEntry(_DummyHitTestTarget()); final HitTestEntry entry1 = HitTestEntry(_DummyHitTestTarget());
......
...@@ -24,44 +24,6 @@ class FakeEditableTextState with TextSelectionDelegate { ...@@ -24,44 +24,6 @@ class FakeEditableTextState with TextSelectionDelegate {
} }
void main() { void main() {
test('RenderEditable respects clipBehavior', () {
const BoxConstraints viewport = BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
final TestClipPaintingContext context = TestClipPaintingContext();
final String longString = 'a' * 10000;
// By default, clipBehavior should be Clip.none
final RenderEditable defaultEditable = RenderEditable(
text: TextSpan(text: longString),
textDirection: TextDirection.ltr,
startHandleLayerLink: LayerLink(),
endHandleLayerLink: LayerLink(),
offset: ViewportOffset.zero(),
textSelectionDelegate: FakeEditableTextState(),
selection: const TextSelection(baseOffset: 0, extentOffset: 0),
);
layout(defaultEditable, constraints: viewport, phase: EnginePhase.composite, onErrors: expectOverflowedErrors);
defaultEditable.paint(context, Offset.zero);
expect(context.clipBehavior, equals(Clip.hardEdge));
context.clipBehavior = Clip.none; // Reset as Clip.none won't write into clipBehavior.
for (final Clip clip in Clip.values) {
final RenderEditable editable = RenderEditable(
text: TextSpan(text: longString),
textDirection: TextDirection.ltr,
startHandleLayerLink: LayerLink(),
endHandleLayerLink: LayerLink(),
offset: ViewportOffset.zero(),
textSelectionDelegate: FakeEditableTextState(),
selection: const TextSelection(baseOffset: 0, extentOffset: 0),
clipBehavior: clip,
);
layout(editable, constraints: viewport, phase: EnginePhase.composite, onErrors: expectOverflowedErrors);
editable.paint(context, Offset.zero);
expect(context.clipBehavior, equals(clip));
}
});
test('editable intrinsics', () { test('editable intrinsics', () {
final TextSelectionDelegate delegate = FakeEditableTextState(); final TextSelectionDelegate delegate = FakeEditableTextState();
final RenderEditable editable = RenderEditable( final RenderEditable editable = RenderEditable(
......
...@@ -52,24 +52,6 @@ void main() { ...@@ -52,24 +52,6 @@ void main() {
FlutterError.onError = oldHandler; FlutterError.onError = oldHandler;
}); });
test('Clip behavior is respected', () {
const BoxConstraints viewport = BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
final TestClipPaintingContext context = TestClipPaintingContext();
// By default, clipBehavior should be Clip.none
final RenderFlex defaultFlex = RenderFlex(direction: Axis.vertical, children: <RenderBox>[box200x200]);
layout(defaultFlex, constraints: viewport, phase: EnginePhase.composite, onErrors: expectOverflowedErrors);
defaultFlex.paint(context, Offset.zero);
expect(context.clipBehavior, equals(Clip.none));
for (final Clip clip in Clip.values) {
final RenderFlex flex = RenderFlex(direction: Axis.vertical, children: <RenderBox>[box200x200], clipBehavior: clip);
layout(flex, constraints: viewport, phase: EnginePhase.composite, onErrors: expectOverflowedErrors);
flex.paint(context, Offset.zero);
expect(context.clipBehavior, equals(clip));
}
});
test('Vertical Overflow', () { test('Vertical Overflow', () {
final RenderConstrainedBox flexible = RenderConstrainedBox( final RenderConstrainedBox flexible = RenderConstrainedBox(
additionalConstraints: const BoxConstraints.expand() additionalConstraints: const BoxConstraints.expand()
......
...@@ -431,7 +431,6 @@ void main() { ...@@ -431,7 +431,6 @@ void main() {
_testLayerReuse<ClipRectLayer>(RenderFittedBox( _testLayerReuse<ClipRectLayer>(RenderFittedBox(
alignment: Alignment.center, alignment: Alignment.center,
fit: BoxFit.cover, fit: BoxFit.cover,
clipBehavior: Clip.hardEdge,
// Inject opacity under the clip to force compositing. // Inject opacity under the clip to force compositing.
child: RenderOpacity( child: RenderOpacity(
opacity: 0.5, opacity: 0.5,
...@@ -469,24 +468,6 @@ void main() { ...@@ -469,24 +468,6 @@ void main() {
_testFittedBoxWithClipRectLayer(); _testFittedBoxWithClipRectLayer();
}); });
test('RenderFittedBox respects clipBehavior', () {
const BoxConstraints viewport = BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
final TestClipPaintingContext context = TestClipPaintingContext();
// By default, clipBehavior should be Clip.none
final RenderFittedBox defaultBox = RenderFittedBox(child: box200x200, fit: BoxFit.none);
layout(defaultBox, constraints: viewport, phase: EnginePhase.composite, onErrors: expectOverflowedErrors);
defaultBox.paint(context, Offset.zero);
expect(context.clipBehavior, equals(Clip.none));
for (final Clip clip in Clip.values) {
final RenderFittedBox box = RenderFittedBox(child: box200x200, fit: BoxFit.none, clipBehavior: clip);
layout(box, constraints: viewport, phase: EnginePhase.composite, onErrors: expectOverflowedErrors);
box.paint(context, Offset.zero);
expect(context.clipBehavior, equals(clip));
}
});
test('RenderMouseRegion can change properties when detached', () { test('RenderMouseRegion can change properties when detached', () {
renderer.initMouseTracker(MouseTracker( renderer.initMouseTracker(MouseTracker(
renderer.pointerRouter, renderer.pointerRouter,
......
...@@ -294,26 +294,3 @@ class FakeTicker implements Ticker { ...@@ -294,26 +294,3 @@ class FakeTicker implements Ticker {
return DiagnosticsProperty<Ticker>(name, this, style: DiagnosticsTreeStyle.errorProperty); return DiagnosticsProperty<Ticker>(name, this, style: DiagnosticsTreeStyle.errorProperty);
} }
} }
class TestClipPaintingContext extends PaintingContext {
TestClipPaintingContext() : super(ContainerLayer(), Rect.zero);
@override
ClipRectLayer pushClipRect(bool needsCompositing, Offset offset, Rect clipRect, PaintingContextCallback painter, {Clip clipBehavior = Clip.hardEdge, ClipRectLayer oldLayer}) {
this.clipBehavior = clipBehavior;
return null;
}
Clip clipBehavior = Clip.none;
}
void expectOverflowedErrors() {
final FlutterErrorDetails errorDetails = renderer.takeFlutterErrorDetails();
final bool overflowed = errorDetails.toString().contains('overflowed');
if (!overflowed) {
FlutterError.reportError(errorDetails);
}
}
RenderConstrainedBox get box200x200 =>
RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(height: 200.0, width: 200.0));
...@@ -61,33 +61,6 @@ void main() { ...@@ -61,33 +61,6 @@ void main() {
expect(stack.size.height, equals(100.0)); expect(stack.size.height, equals(100.0));
}); });
test('Stack respects clipBehavior', () {
const BoxConstraints viewport = BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
final TestClipPaintingContext context = TestClipPaintingContext();
// By default, clipBehavior should be Clip.none
final RenderStack defaultStack = RenderStack(textDirection: TextDirection.ltr, children: <RenderBox>[box200x200]);
layout(defaultStack, constraints: viewport, phase: EnginePhase.composite, onErrors: expectOverflowedErrors);
defaultStack.paint(context, Offset.zero);
expect(context.clipBehavior, equals(Clip.none));
for (final Clip clip in Clip.values) {
final RenderBox child = box200x200;
final RenderStack stack = RenderStack(
textDirection: TextDirection.ltr,
children: <RenderBox>[child],
clipBehavior: clip,
);
{ // Make sure that the child is positioned so the stack will consider it as overflowed.
final StackParentData parentData = child.parentData as StackParentData;
parentData.left = parentData.right = 0;
}
layout(stack, constraints: viewport, phase: EnginePhase.composite, onErrors: expectOverflowedErrors);
stack.paint(context, Offset.zero);
expect(context.clipBehavior, equals(clip));
}
});
group('RenderIndexedStack', () { group('RenderIndexedStack', () {
test('visitChildrenForSemantics only visits displayed child', () { test('visitChildrenForSemantics only visits displayed child', () {
final RenderBox child1 = RenderConstrainedBox( final RenderBox child1 = RenderConstrainedBox(
......
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'rendering_tester.dart';
void main() { void main() {
test('Wrap test; toStringDeep', () { test('Wrap test; toStringDeep', () {
final RenderWrap renderWrap = RenderWrap(); final RenderWrap renderWrap = RenderWrap();
...@@ -153,22 +151,4 @@ void main() { ...@@ -153,22 +151,4 @@ void main() {
expect(renderWrap.computeMinIntrinsicWidth(79), 80); expect(renderWrap.computeMinIntrinsicWidth(79), 80);
expect(renderWrap.computeMinIntrinsicWidth(80), 80); expect(renderWrap.computeMinIntrinsicWidth(80), 80);
}); });
test('Wrap respects clipBehavior', () {
const BoxConstraints viewport = BoxConstraints(maxHeight: 100.0, maxWidth: 100.0);
final TestClipPaintingContext context = TestClipPaintingContext();
// By default, clipBehavior should be Clip.none
final RenderWrap defaultWrap = RenderWrap(textDirection: TextDirection.ltr, children: <RenderBox>[box200x200]);
layout(defaultWrap, constraints: viewport, phase: EnginePhase.composite, onErrors: expectOverflowedErrors);
defaultWrap.paint(context, Offset.zero);
expect(context.clipBehavior, equals(Clip.none));
for (final Clip clip in Clip.values) {
final RenderWrap wrap = RenderWrap(textDirection: TextDirection.ltr, children: <RenderBox>[box200x200], clipBehavior: clip);
layout(wrap, constraints: viewport, phase: EnginePhase.composite, onErrors: expectOverflowedErrors);
wrap.paint(context, Offset.zero);
expect(context.clipBehavior, equals(clip));
}
});
} }
...@@ -280,15 +280,6 @@ void main() { ...@@ -280,15 +280,6 @@ void main() {
); );
}); });
testWidgets('UnconstrainedBox can set and update clipBehavior', (WidgetTester tester) async {
await tester.pumpWidget(const UnconstrainedBox());
final RenderUnconstrainedBox renderObject = tester.allRenderObjects.whereType<RenderUnconstrainedBox>().first;
expect(renderObject.clipBehavior, equals(Clip.hardEdge));
await tester.pumpWidget(const UnconstrainedBox(clipBehavior: Clip.antiAlias));
expect(renderObject.clipBehavior, equals(Clip.antiAlias));
});
group('ColoredBox', () { group('ColoredBox', () {
_MockCanvas mockCanvas; _MockCanvas mockCanvas;
_MockPaintingContext mockContext; _MockPaintingContext mockContext;
......
...@@ -4761,48 +4761,6 @@ void main() { ...@@ -4761,48 +4761,6 @@ void main() {
expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.text); expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.text);
}); });
testWidgets('EditableText can set and update clipBehavior', (WidgetTester tester) async {
await tester.pumpWidget(MediaQuery(
data: const MediaQueryData(devicePixelRatio: 1.0),
child: Directionality(
textDirection: TextDirection.ltr,
child: FocusScope(
node: focusScopeNode,
autofocus: true,
child: EditableText(
backgroundCursorColor: Colors.grey,
controller: controller,
focusNode: focusNode,
style: textStyle,
cursorColor: cursorColor,
),
),
),
));
final RenderEditable renderObject = tester.allRenderObjects.whereType<RenderEditable>().first;
expect(renderObject.clipBehavior, equals(Clip.hardEdge));
await tester.pumpWidget(MediaQuery(
data: const MediaQueryData(devicePixelRatio: 1.0),
child: Directionality(
textDirection: TextDirection.ltr,
child: FocusScope(
node: focusScopeNode,
autofocus: true,
child: EditableText(
backgroundCursorColor: Colors.grey,
controller: controller,
focusNode: focusNode,
style: textStyle,
cursorColor: cursorColor,
clipBehavior: Clip.antiAlias,
),
),
),
));
expect(renderObject.clipBehavior, equals(Clip.antiAlias));
});
} }
class MockTextFormatter extends TextInputFormatter { class MockTextFormatter extends TextInputFormatter {
......
...@@ -369,7 +369,6 @@ void main() { ...@@ -369,7 +369,6 @@ void main() {
height: 10.0, height: 10.0,
child: FittedBox( child: FittedBox(
fit: BoxFit.cover, fit: BoxFit.cover,
clipBehavior: Clip.hardEdge,
child: SizedBox( child: SizedBox(
width: 10.0, width: 10.0,
height: 50.0, height: 50.0,
...@@ -392,7 +391,6 @@ void main() { ...@@ -392,7 +391,6 @@ void main() {
height: 100.0, height: 100.0,
child: FittedBox( child: FittedBox(
fit: BoxFit.cover, fit: BoxFit.cover,
clipBehavior: Clip.hardEdge,
child: SizedBox( child: SizedBox(
width: 50.0, width: 50.0,
height: 10.0, height: 10.0,
...@@ -420,7 +418,6 @@ void main() { ...@@ -420,7 +418,6 @@ void main() {
height: b, height: b,
child: FittedBox( child: FittedBox(
fit: BoxFit.none, fit: BoxFit.none,
clipBehavior: Clip.hardEdge,
child: SizedBox( child: SizedBox(
width: c, width: c,
height: d, height: d,
...@@ -475,15 +472,6 @@ void main() { ...@@ -475,15 +472,6 @@ void main() {
await tester.tap(find.byKey(key1)); await tester.tap(find.byKey(key1));
expect(_pointerDown, isTrue); expect(_pointerDown, isTrue);
}); });
testWidgets('Can set and update clipBehavior', (WidgetTester tester) async {
await tester.pumpWidget(FittedBox(fit: BoxFit.none, child: Container()));
final RenderFittedBox renderObject = tester.allRenderObjects.whereType<RenderFittedBox>().first;
expect(renderObject.clipBehavior, equals(Clip.hardEdge));
await tester.pumpWidget(FittedBox(fit: BoxFit.none, child: Container(), clipBehavior: Clip.antiAlias));
expect(renderObject.clipBehavior, equals(Clip.antiAlias));
});
} }
List<Type> getLayers() { List<Type> getLayers() {
......
...@@ -140,13 +140,4 @@ void main() { ...@@ -140,13 +140,4 @@ void main() {
final String message = tester.takeException().toString(); final String message = tester.takeException().toString();
expect(message, contains('\nSee also:')); expect(message, contains('\nSee also:'));
}); });
testWidgets('Can set and update clipBehavior', (WidgetTester tester) async {
await tester.pumpWidget(Flex(direction: Axis.vertical));
final RenderFlex renderObject = tester.allRenderObjects.whereType<RenderFlex>().first;
expect(renderObject.clipBehavior, equals(Clip.hardEdge));
await tester.pumpWidget(Flex(direction: Axis.vertical, clipBehavior: Clip.antiAlias));
expect(renderObject.clipBehavior, equals(Clip.antiAlias));
});
} }
...@@ -719,7 +719,7 @@ void main() { ...@@ -719,7 +719,7 @@ void main() {
equalsIgnoringHashCodes( equalsIgnoringHashCodes(
'Duplicate keys found.\n' 'Duplicate keys found.\n'
'If multiple keyed nodes exist as children of another node, they must have unique keys.\n' 'If multiple keyed nodes exist as children of another node, they must have unique keys.\n'
'Stack(alignment: AlignmentDirectional.topStart, textDirection: ltr, fit: loose) has multiple children with key [GlobalKey#00000 problematic].' 'Stack(alignment: AlignmentDirectional.topStart, textDirection: ltr, fit: loose, overflow: clip) has multiple children with key [GlobalKey#00000 problematic].'
), ),
); );
}); });
...@@ -889,7 +889,7 @@ void main() { ...@@ -889,7 +889,7 @@ void main() {
'The specific parent that did not update after having one or more children forcibly ' 'The specific parent that did not update after having one or more children forcibly '
'removed due to GlobalKey reparenting is:\n' 'removed due to GlobalKey reparenting is:\n'
'- Stack(alignment: AlignmentDirectional.topStart, textDirection: ltr, fit: loose, ' '- Stack(alignment: AlignmentDirectional.topStart, textDirection: ltr, fit: loose, '
'renderObject: RenderStack#00000)\n' 'overflow: clip, renderObject: RenderStack#00000)\n'
'A GlobalKey can only be specified on one widget at a time in the widget tree.' 'A GlobalKey can only be specified on one widget at a time in the widget tree.'
), ),
); );
......
...@@ -11,44 +11,6 @@ import '../rendering/mock_canvas.dart'; ...@@ -11,44 +11,6 @@ import '../rendering/mock_canvas.dart';
import '../rendering/rendering_tester.dart'; import '../rendering/rendering_tester.dart';
void main() { void main() {
testWidgets('ListWheelScrollView respects clipBehavior', (WidgetTester tester) async {
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
child: ListWheelScrollView(
itemExtent: 2000.0, // huge extent to trigger clip
children: <Widget>[Container()],
),
),
);
// 1st, check that the render object has received the default clip behavior.
final RenderListWheelViewport renderObject = tester.allRenderObjects.whereType<RenderListWheelViewport>().first;
expect(renderObject.clipBehavior, equals(Clip.hardEdge));
// 2nd, check that the painting context has received the default clip behavior.
final TestClipPaintingContext context = TestClipPaintingContext();
renderObject.paint(context, Offset.zero);
expect(context.clipBehavior, equals(Clip.hardEdge));
// 3rd, pump a new widget to check that the render object can update its clip behavior.
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
child: ListWheelScrollView(
itemExtent: 2000.0, // huge extent to trigger clip
children: <Widget>[Container()],
clipBehavior: Clip.antiAlias,
),
),
);
expect(renderObject.clipBehavior, equals(Clip.antiAlias));
// 4th, check that a non-default clip behavior can be sent to the painting context.
renderObject.paint(context, Offset.zero);
expect(context.clipBehavior, equals(Clip.antiAlias));
});
group('construction check', () { group('construction check', () {
testWidgets('ListWheelScrollView needs positive diameter ratio', (WidgetTester tester) async { testWidgets('ListWheelScrollView needs positive diameter ratio', (WidgetTester tester) async {
try { try {
......
...@@ -8,8 +8,6 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -8,8 +8,6 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/gestures.dart' show DragStartBehavior; import 'package:flutter/gestures.dart' show DragStartBehavior;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import '../rendering/rendering_tester.dart';
class _CustomPhysics extends ClampingScrollPhysics { class _CustomPhysics extends ClampingScrollPhysics {
const _CustomPhysics({ ScrollPhysics parent }) : super(parent: parent); const _CustomPhysics({ ScrollPhysics parent }) : super(parent: parent);
...@@ -120,55 +118,6 @@ Widget buildTest({ ...@@ -120,55 +118,6 @@ Widget buildTest({
} }
void main() { void main() {
testWidgets('NestedScrollView respects clipBehavior', (WidgetTester tester) async {
Widget build(NestedScrollView nestedScrollView) {
return Localizations(
locale: const Locale('en', 'US'),
delegates: const <LocalizationsDelegate<dynamic>>[
DefaultMaterialLocalizations.delegate,
DefaultWidgetsLocalizations.delegate,
],
child: Directionality(
textDirection: TextDirection.ltr,
child: MediaQuery(
data: const MediaQueryData(),
child: nestedScrollView,
),
),
);
}
await tester.pumpWidget(build(
NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) => <Widget>[const SliverAppBar()],
body: Container(height: 2000.0),
)
));
// 1st, check that the render object has received the default clip behavior.
final RenderNestedScrollViewViewport renderObject = tester.allRenderObjects.whereType<RenderNestedScrollViewViewport>().first;
expect(renderObject.clipBehavior, equals(Clip.hardEdge));
// 2nd, check that the painting context has received the default clip behavior.
final TestClipPaintingContext context = TestClipPaintingContext();
renderObject.paint(context, Offset.zero);
expect(context.clipBehavior, equals(Clip.hardEdge));
// 3rd, pump a new widget to check that the render object can update its clip behavior.
await tester.pumpWidget(build(
NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) => <Widget>[const SliverAppBar()],
body: Container(height: 2000.0),
clipBehavior: Clip.antiAlias,
)
));
expect(renderObject.clipBehavior, equals(Clip.antiAlias));
// 4th, check that a non-default clip behavior can be sent to the painting context.
renderObject.paint(context, Offset.zero);
expect(context.clipBehavior, equals(Clip.antiAlias));
});
testWidgets('NestedScrollView overscroll and release and hold', (WidgetTester tester) async { testWidgets('NestedScrollView overscroll and release and hold', (WidgetTester tester) async {
await tester.pumpWidget(buildTest()); await tester.pumpWidget(buildTest());
expect(find.text('aaa2'), findsOneWidget); expect(find.text('aaa2'), findsOneWidget);
......
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import '../rendering/rendering_tester.dart';
void main() {
testWidgets('ShrinkWrappingViewport respects clipBehavior', (WidgetTester tester) async {
Widget build(ShrinkWrappingViewport child) {
return Directionality(
textDirection: TextDirection.ltr,
child: child,
);
}
await tester.pumpWidget(build(
ShrinkWrappingViewport(
offset: ViewportOffset.zero(),
slivers: <Widget>[SliverToBoxAdapter(child: Container(height: 2000.0))],
)
));
// 1st, check that the render object has received the default clip behavior.
final RenderShrinkWrappingViewport renderObject = tester.allRenderObjects.whereType<RenderShrinkWrappingViewport>().first;
expect(renderObject.clipBehavior, equals(Clip.hardEdge));
// 2nd, check that the painting context has received the default clip behavior.
final TestClipPaintingContext context = TestClipPaintingContext();
renderObject.paint(context, Offset.zero);
expect(context.clipBehavior, equals(Clip.hardEdge));
// 3rd, pump a new widget to check that the render object can update its clip behavior.
await tester.pumpWidget(build(
ShrinkWrappingViewport(
offset: ViewportOffset.zero(),
slivers: <Widget>[SliverToBoxAdapter(child: Container(height: 2000.0))],
clipBehavior: Clip.antiAlias,
)
));
expect(renderObject.clipBehavior, equals(Clip.antiAlias));
// 4th, check that a non-default clip behavior can be sent to the painting context.
renderObject.paint(context, Offset.zero);
expect(context.clipBehavior, equals(Clip.antiAlias));
});
}
...@@ -8,7 +8,6 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -8,7 +8,6 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import '../rendering/rendering_tester.dart';
import 'semantics_tester.dart'; import 'semantics_tester.dart';
class TestScrollPosition extends ScrollPositionWithSingleContext { class TestScrollPosition extends ScrollPositionWithSingleContext {
...@@ -38,27 +37,6 @@ class TestScrollController extends ScrollController { ...@@ -38,27 +37,6 @@ class TestScrollController extends ScrollController {
} }
void main() { void main() {
testWidgets('SingleChildScrollView respects clipBehavior', (WidgetTester tester) async {
await tester.pumpWidget(SingleChildScrollView(child: Container(height: 2000.0)));
// 1st, check that the render object has received the default clip behavior.
final dynamic renderObject = tester.allRenderObjects.where((RenderObject o) => o.runtimeType.toString() == '_RenderSingleChildViewport').first;
expect(renderObject.clipBehavior, equals(Clip.hardEdge));
// 2nd, check that the painting context has received the default clip behavior.
final TestClipPaintingContext context = TestClipPaintingContext();
renderObject.paint(context, Offset.zero);
expect(context.clipBehavior, equals(Clip.hardEdge));
// 3rd, pump a new widget to check that the render object can update its clip behavior.
await tester.pumpWidget(SingleChildScrollView(clipBehavior: Clip.antiAlias, child: Container(height: 2000.0)));
expect(renderObject.clipBehavior, equals(Clip.antiAlias));
// 4th, check that a non-default clip behavior can be sent to the painting context.
renderObject.paint(context, Offset.zero);
expect(context.clipBehavior, equals(Clip.antiAlias));
});
testWidgets('SingleChildScrollView control test', (WidgetTester tester) async { testWidgets('SingleChildScrollView control test', (WidgetTester tester) async {
await tester.pumpWidget(SingleChildScrollView( await tester.pumpWidget(SingleChildScrollView(
child: Container( child: Container(
......
...@@ -376,15 +376,6 @@ void main() { ...@@ -376,15 +376,6 @@ void main() {
expect(renderBox.size.height, equals(12.0)); expect(renderBox.size.height, equals(12.0));
}); });
testWidgets('Can set and update clipBehavior', (WidgetTester tester) async {
await tester.pumpWidget(Stack(textDirection: TextDirection.ltr));
final RenderStack renderObject = tester.allRenderObjects.whereType<RenderStack>().first;
expect(renderObject.clipBehavior, equals(Clip.hardEdge));
await tester.pumpWidget(Stack(textDirection: TextDirection.ltr, clipBehavior: Clip.hardEdge));
expect(renderObject.clipBehavior, equals(Clip.hardEdge));
});
testWidgets('IndexedStack with null index', (WidgetTester tester) async { testWidgets('IndexedStack with null index', (WidgetTester tester) async {
bool tapped; bool tapped;
...@@ -421,7 +412,6 @@ void main() { ...@@ -421,7 +412,6 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: Center( child: Center(
child: Stack( child: Stack(
clipBehavior: Clip.hardEdge,
children: const <Widget>[ children: const <Widget>[
SizedBox( SizedBox(
width: 100.0, width: 100.0,
...@@ -452,7 +442,6 @@ void main() { ...@@ -452,7 +442,6 @@ void main() {
child: Center( child: Center(
child: Stack( child: Stack(
overflow: Overflow.visible, overflow: Overflow.visible,
clipBehavior: Clip.none,
children: const <Widget>[ children: const <Widget>[
SizedBox( SizedBox(
width: 100.0, width: 100.0,
......
...@@ -733,7 +733,6 @@ void main() { ...@@ -733,7 +733,6 @@ void main() {
await tester.pumpWidget(Wrap( await tester.pumpWidget(Wrap(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
clipBehavior: Clip.hardEdge,
children: const <Widget>[ children: const <Widget>[
SizedBox(width: 500.0, height: 500.0), SizedBox(width: 500.0, height: 500.0),
SizedBox(width: 500.0, height: 500.0), SizedBox(width: 500.0, height: 500.0),
...@@ -896,13 +895,4 @@ void main() { ...@@ -896,13 +895,4 @@ void main() {
const Offset(0.0, 20.0), const Offset(0.0, 20.0),
]); ]);
}); });
testWidgets('Wrap can set and update clipBehavior', (WidgetTester tester) async {
await tester.pumpWidget(Wrap(textDirection: TextDirection.ltr));
final RenderWrap renderObject = tester.allRenderObjects.whereType<RenderWrap>().first;
expect(renderObject.clipBehavior, equals(Clip.hardEdge));
await tester.pumpWidget(Wrap(textDirection: TextDirection.ltr, clipBehavior: Clip.antiAlias));
expect(renderObject.clipBehavior, equals(Clip.antiAlias));
});
} }
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