@@ -229,6 +229,9 @@ abstract class RenderAligningShiftedBox extends RenderShiftedBox {
229
229
/// Initializes member variables for subclasses.
230
230
///
231
231
/// The [alignment] argument must not be null.
232
+ ///
233
+ /// The [textDirection] must be non-null if the [alignment] is
234
+ /// direction-sensitive.
232
235
RenderAligningShiftedBox ({
233
236
AlignmentGeometry alignment = Alignment .center,
234
237
@required TextDirection textDirection,
@@ -303,6 +306,7 @@ abstract class RenderAligningShiftedBox extends RenderShiftedBox {
303
306
///
304
307
/// This method must be called after the child has been laid out and
305
308
/// this object's own size has been set.
309
+ @protected
306
310
void alignChild () {
307
311
_resolve ();
308
312
assert (child != null );
@@ -707,6 +711,9 @@ class RenderUnconstrainedBox extends RenderAligningShiftedBox with DebugOverflow
707
711
/// A render object that is a specific size but passes its original constraints
708
712
/// through to its child, which it allows to overflow.
709
713
///
714
+ /// If the child's resulting size differs from this render object's size, then
715
+ /// the child is aligned according to the [alignment] property.
716
+ ///
710
717
/// See also:
711
718
/// * [RenderUnconstrainedBox] for a render object that allows its children
712
719
/// to render themselves unconstrained, expands to fit them, and considers
@@ -717,11 +724,14 @@ class RenderUnconstrainedBox extends RenderAligningShiftedBox with DebugOverflow
717
724
class RenderSizedOverflowBox extends RenderAligningShiftedBox {
718
725
/// Creates a render box of a given size that lets its child overflow.
719
726
///
720
- /// The [requestedSize] argument must not be null.
727
+ /// The [requestedSize] and [alignment] arguments must not be null.
728
+ ///
729
+ /// The [textDirection] argument must not be null if the [alignment] is
730
+ /// direction-sensitive.
721
731
RenderSizedOverflowBox ({
722
732
RenderBox child,
723
733
@required Size requestedSize,
724
- Alignment alignment = Alignment .center,
734
+ AlignmentGeometry alignment = Alignment .center,
725
735
TextDirection textDirection,
726
736
}) : assert (requestedSize != null ),
727
737
_requestedSize = requestedSize,
@@ -769,7 +779,7 @@ class RenderSizedOverflowBox extends RenderAligningShiftedBox {
769
779
void performLayout () {
770
780
size = constraints.constrain (_requestedSize);
771
781
if (child != null ) {
772
- child.layout (constraints);
782
+ child.layout (constraints, parentUsesSize : true );
773
783
alignChild ();
774
784
}
775
785
}
@@ -783,17 +793,24 @@ class RenderSizedOverflowBox extends RenderAligningShiftedBox {
783
793
/// for a given axis is null, then the constraints from the parent are just
784
794
/// passed through instead.
785
795
///
786
- /// It then tries to size itself to the size of its child.
796
+ /// It then tries to size itself to the size of its child. Where this is not
797
+ /// possible (e.g. if the constraints from the parent are themselves tight), the
798
+ /// child is aligned according to [alignment] .
787
799
class RenderFractionallySizedOverflowBox extends RenderAligningShiftedBox {
788
800
/// Creates a render box that sizes its child to a fraction of the total available space.
789
801
///
790
802
/// If non-null, the [widthFactor] and [heightFactor] arguments must be
791
803
/// non-negative.
804
+ ///
805
+ /// The [alignment] must not be null.
806
+ ///
807
+ /// The [textDirection] must be non-null if the [alignment] is
808
+ /// direction-sensitive.
792
809
RenderFractionallySizedOverflowBox ({
793
810
RenderBox child,
794
811
double widthFactor,
795
812
double heightFactor,
796
- Alignment alignment = Alignment .center,
813
+ AlignmentGeometry alignment = Alignment .center,
797
814
TextDirection textDirection,
798
815
}) : _widthFactor = widthFactor,
799
816
_heightFactor = heightFactor,
0 commit comments