@@ -21,7 +21,7 @@ export 'package:flutter/gestures.dart' show
21
21
PointerUpEvent,
22
22
PointerCancelEvent;
23
23
24
- /// A base class for render objects that resemble their children
24
+ /// A base class for render objects that resemble their children.
25
25
///
26
26
/// A proxy box has a single child and simply mimics all the properties of that
27
27
/// child by calling through to the child for each function in the render box
@@ -87,15 +87,16 @@ class RenderProxyBox extends RenderBox with RenderObjectWithChildMixin<RenderBox
87
87
}
88
88
}
89
89
90
- /// A render object that imposes additional constraints on its child
90
+ /// Imposes additional constraints on its child.
91
91
///
92
92
/// A render constrained box proxies most functions in the render box protocol
93
93
/// to its child, except that when laying out its child, it tightens the
94
94
/// constraints provided by its parent by enforcing the [additionalConstraints]
95
95
/// as well.
96
96
///
97
- /// For example, if you wanted [child] to have a minimum height, you could use
98
- /// `const BoxConstraints(minHeight: 50.0)` ` as the [additionalConstraints] .
97
+ /// For example, if you wanted [child] to have a minimum height of 50.0 logical
98
+ /// pixels, you could use `const BoxConstraints(minHeight: 50.0)` ` as the
99
+ /// [additionalConstraints] .
99
100
class RenderConstrainedBox extends RenderProxyBox {
100
101
RenderConstrainedBox ({
101
102
RenderBox child,
@@ -260,7 +261,7 @@ class RenderFractionallySizedBox extends RenderProxyBox {
260
261
}
261
262
}
262
263
263
- /// Forces child to layout at a specific aspect ratio
264
+ /// Forces child to layout at a specific aspect ratio.
264
265
///
265
266
/// The width of this render object is the largest width permited by the layout
266
267
/// constraints. The height of the render object is determined by applying the
@@ -284,7 +285,7 @@ class RenderAspectRatio extends RenderProxyBox {
284
285
assert (_aspectRatio != null );
285
286
}
286
287
287
- /// The aspect ratio to use when computing the height from the width
288
+ /// The aspect ratio to use when computing the height from the width.
288
289
///
289
290
/// The aspect ratio is expressed as a ratio of width to height. For example,
290
291
/// a 16:9 width:height aspect ratio would have a value of 16.0/9.0.
@@ -329,18 +330,18 @@ class RenderAspectRatio extends RenderProxyBox {
329
330
}
330
331
}
331
332
332
- /// Sizes its child to the child's intrinsic width
333
+ /// Sizes its child to the child's intrinsic width.
333
334
///
334
- /// This class will size its child's width to the child's maximum intrinsic
335
- /// width. If [stepWidth] is non-null, the child's width will be snapped to a
336
- /// multiple of the [stepWidth] . Similarly, if [stepHeight] is non-null, the
337
- /// child's height will be snapped to a multiple of the [stepHeight] .
335
+ /// Sizes its child's width to the child's maximum intrinsic width. If
336
+ /// [stepWidth] is non-null, the child's width will be snapped to a multiple of
337
+ /// the [stepWidth] . Similarly, if [stepHeight] is non-null, the child's height
338
+ /// will be snapped to a multiple of the [stepHeight] .
338
339
///
339
340
/// This class is useful, for example, when unlimited width is available and
340
341
/// you would like a child that would otherwise attempt to expand infinitely to
341
342
/// instead size itself to a more reasonable width.
342
343
///
343
- /// Note: This class is relatively expensive. Avoid using it where possible.
344
+ /// This class is relatively expensive. Avoid using it where possible.
344
345
class RenderIntrinsicWidth extends RenderProxyBox {
345
346
346
347
RenderIntrinsicWidth ({
@@ -349,7 +350,7 @@ class RenderIntrinsicWidth extends RenderProxyBox {
349
350
RenderBox child
350
351
}) : _stepWidth = stepWidth, _stepHeight = stepHeight, super (child);
351
352
352
- /// If non-null, force the child's width to be a multiple of this value
353
+ /// If non-null, force the child's width to be a multiple of this value.
353
354
double get stepWidth => _stepWidth;
354
355
double _stepWidth;
355
356
void set stepWidth (double newStepWidth) {
@@ -359,7 +360,7 @@ class RenderIntrinsicWidth extends RenderProxyBox {
359
360
markNeedsLayout ();
360
361
}
361
362
362
- /// If non-null, force the child's height to be a multiple of this value
363
+ /// If non-null, force the child's height to be a multiple of this value.
363
364
double get stepHeight => _stepHeight;
364
365
double _stepHeight;
365
366
void set stepHeight (double newStepHeight) {
@@ -428,16 +429,13 @@ class RenderIntrinsicWidth extends RenderProxyBox {
428
429
}
429
430
}
430
431
431
- /// Sizes its child to the child's intrinsic height
432
- ///
433
- /// This class will size its child's height to the child's maximum intrinsic
434
- /// height.
432
+ /// Sizes its child to the child's intrinsic height.
435
433
///
436
434
/// This class is useful, for example, when unlimited height is available and
437
435
/// you would like a child that would otherwise attempt to expand infinitely to
438
436
/// instead size itself to a more reasonable height.
439
437
///
440
- /// Note: This class is relatively expensive. Avoid using it where possible.
438
+ /// This class is relatively expensive. Avoid using it where possible.
441
439
class RenderIntrinsicHeight extends RenderProxyBox {
442
440
443
441
RenderIntrinsicHeight ({
@@ -486,20 +484,20 @@ class RenderIntrinsicHeight extends RenderProxyBox {
486
484
487
485
}
488
486
489
- /// Makes its child partially transparent
487
+ /// Makes its child partially transparent.
490
488
///
491
489
/// This class paints its child into an intermediate buffer and then blends the
492
490
/// child back into the scene partially transparent.
493
491
///
494
- /// Note: This class is relatively expensive because it requires painting the
495
- /// child into an intermediate buffer.
492
+ /// This class is relatively expensive because it requires painting the child
493
+ /// into an intermediate buffer.
496
494
class RenderOpacity extends RenderProxyBox {
497
495
RenderOpacity ({ RenderBox child, double opacity })
498
496
: this ._opacity = opacity, super (child) {
499
497
assert (opacity >= 0.0 && opacity <= 1.0 );
500
498
}
501
499
502
- /// The fraction to scale the child's alpha value
500
+ /// The fraction to scale the child's alpha value.
503
501
///
504
502
/// An opacity of 1.0 is fully opaque. An opacity of 0.0 is fully transparent
505
503
/// (i.e., invisible).
@@ -566,7 +564,10 @@ class RenderShaderMask extends RenderProxyBox {
566
564
}
567
565
}
568
566
567
+ /// A class that provides custom clips.
569
568
abstract class CustomClipper <T > {
569
+ /// Returns a description of the clip given that the render object being
570
+ /// clipped is of the given size.
570
571
T getClip (Size size);
571
572
bool shouldRepaint (CustomClipper oldClipper);
572
573
}
@@ -577,6 +578,7 @@ abstract class _RenderCustomClip<T> extends RenderProxyBox {
577
578
CustomClipper <T > clipper
578
579
}) : _clipper = clipper, super (child);
579
580
581
+ /// If non-null, determines which clip to use on the child.
580
582
CustomClipper <T > get clipper => _clipper;
581
583
CustomClipper <T > _clipper;
582
584
void set clipper (CustomClipper <T > newClipper) {
@@ -598,7 +600,7 @@ abstract class _RenderCustomClip<T> extends RenderProxyBox {
598
600
T get _clip => _clipper? .getClip (size) ?? _defaultClip;
599
601
}
600
602
601
- /// Clips its child using a rectangle
603
+ /// Clips its child using a rectangle.
602
604
///
603
605
/// Prevents its child from painting outside its bounds.
604
606
class RenderClipRect extends _RenderCustomClip <Rect > {
@@ -624,7 +626,7 @@ class RenderClipRect extends _RenderCustomClip<Rect> {
624
626
}
625
627
}
626
628
627
- /// Clips its child using a rounded rectangle
629
+ /// Clips its child using a rounded rectangle.
628
630
///
629
631
/// Creates a rounded rectangle from its layout dimensions and the given x and
630
632
/// y radius values and prevents its child from painting outside that rounded
@@ -639,7 +641,7 @@ class RenderClipRRect extends RenderProxyBox {
639
641
assert (_yRadius != null );
640
642
}
641
643
642
- /// The radius of the rounded corners in the horizontal direction in logical pixels
644
+ /// The radius of the rounded corners in the horizontal direction in logical pixels.
643
645
///
644
646
/// Values are clamped to be between zero and half the width of the render
645
647
/// object.
@@ -653,7 +655,7 @@ class RenderClipRRect extends RenderProxyBox {
653
655
markNeedsPaint ();
654
656
}
655
657
656
- /// The radius of the rounded corners in the vertical direction in logical pixels
658
+ /// The radius of the rounded corners in the vertical direction in logical pixels.
657
659
///
658
660
/// Values are clamped to be between zero and half the height of the render
659
661
/// object.
@@ -676,7 +678,7 @@ class RenderClipRRect extends RenderProxyBox {
676
678
}
677
679
}
678
680
679
- /// Clips its child using an oval
681
+ /// Clips its child using an oval.
680
682
///
681
683
/// Inscribes an oval into its layout dimensions and prevents its child from
682
684
/// painting outside that oval.
@@ -717,16 +719,16 @@ class RenderClipOval extends _RenderCustomClip<Rect> {
717
719
}
718
720
}
719
721
720
- /// Where to paint a box decoration
722
+ /// Where to paint a box decoration.
721
723
enum BoxDecorationPosition {
722
- /// Paint the box decoration behind the children
724
+ /// Paint the box decoration behind the children.
723
725
background,
724
726
725
- /// Paint the box decoration in front of the children
727
+ /// Paint the box decoration in front of the children.
726
728
foreground,
727
729
}
728
730
729
- /// Paints a [BoxDecoration] either before or after its child paints
731
+ /// Paints a [BoxDecoration] either before or after its child paints.
730
732
class RenderDecoratedBox extends RenderProxyBox {
731
733
732
734
RenderDecoratedBox ({
@@ -740,7 +742,7 @@ class RenderDecoratedBox extends RenderProxyBox {
740
742
assert (position != null );
741
743
}
742
744
743
- /// Where to paint the box decoration
745
+ /// Where to paint the box decoration.
744
746
BoxDecorationPosition get position => _position;
745
747
BoxDecorationPosition _position;
746
748
void set position (BoxDecorationPosition newPosition) {
@@ -750,7 +752,7 @@ class RenderDecoratedBox extends RenderProxyBox {
750
752
markNeedsPaint ();
751
753
}
752
754
753
- /// What decoration to paint
755
+ /// What decoration to paint.
754
756
BoxDecoration get decoration => _painter.decoration;
755
757
void set decoration (BoxDecoration newDecoration) {
756
758
assert (newDecoration != null );
@@ -820,7 +822,7 @@ class RenderDecoratedBox extends RenderProxyBox {
820
822
}
821
823
}
822
824
823
- /// Applies a transformation before painting its child
825
+ /// Applies a transformation before painting its child.
824
826
class RenderTransform extends RenderProxyBox {
825
827
RenderTransform ({
826
828
Matrix4 transform,
@@ -836,7 +838,7 @@ class RenderTransform extends RenderProxyBox {
836
838
}
837
839
838
840
/// The origin of the coordinate system (relative to the upper left corder of
839
- /// this render object) in which to apply the matrix
841
+ /// this render object) in which to apply the matrix.
840
842
///
841
843
/// Setting an origin is equivalent to conjugating the transform matrix by a
842
844
/// translation. This property is provided just for convenience.
@@ -866,7 +868,7 @@ class RenderTransform extends RenderProxyBox {
866
868
// Note the lack of a getter for transform because Matrix4 is not immutable
867
869
Matrix4 _transform;
868
870
869
- /// The matrix to transform the child by during painting
871
+ /// The matrix to transform the child by during painting.
870
872
void set transform (Matrix4 newTransform) {
871
873
assert (newTransform != null );
872
874
if (_transform == newTransform)
@@ -875,37 +877,37 @@ class RenderTransform extends RenderProxyBox {
875
877
markNeedsPaint ();
876
878
}
877
879
878
- /// Sets the transform to the identity matrix
880
+ /// Sets the transform to the identity matrix.
879
881
void setIdentity () {
880
882
_transform.setIdentity ();
881
883
markNeedsPaint ();
882
884
}
883
885
884
- /// Concatenates a rotation about the x axis into the transform
886
+ /// Concatenates a rotation about the x axis into the transform.
885
887
void rotateX (double radians) {
886
888
_transform.rotateX (radians);
887
889
markNeedsPaint ();
888
890
}
889
891
890
- /// Concatenates a rotation about the y axis into the transform
892
+ /// Concatenates a rotation about the y axis into the transform.
891
893
void rotateY (double radians) {
892
894
_transform.rotateY (radians);
893
895
markNeedsPaint ();
894
896
}
895
897
896
- /// Concatenates a rotation about the z axis into the transform
898
+ /// Concatenates a rotation about the z axis into the transform.
897
899
void rotateZ (double radians) {
898
900
_transform.rotateZ (radians);
899
901
markNeedsPaint ();
900
902
}
901
903
902
- /// Concatenates a translation by (x, y, z) into the transform
904
+ /// Concatenates a translation by (x, y, z) into the transform.
903
905
void translate (x, [double y = 0.0 , double z = 0.0 ]) {
904
906
_transform.translate (x, y, z);
905
907
markNeedsPaint ();
906
908
}
907
909
908
- /// Concatenates a scale into the transform
910
+ /// Concatenates a scale into the transform.
909
911
void scale (x, [double y, double z]) {
910
912
_transform.scale (x, y, z);
911
913
markNeedsPaint ();
@@ -963,13 +965,13 @@ class RenderTransform extends RenderProxyBox {
963
965
}
964
966
}
965
967
966
- /// Called when a size changes
968
+ /// Called when a size changes.
967
969
typedef void SizeChangedCallback (Size newSize);
968
970
969
971
/// Calls [onSizeChanged] whenever the child's layout size changes
970
972
///
971
- /// Note: Size observer calls its callback during layout, which means you cannot
972
- /// dirty layout information during the callback.
973
+ /// Because size observer calls its callback during layout, you cannot modify
974
+ /// layout information during the callback.
973
975
class RenderSizeObserver extends RenderProxyBox {
974
976
RenderSizeObserver ({
975
977
this .onSizeChanged,
@@ -1007,13 +1009,13 @@ abstract class CustomPainter {
1007
1009
/// current canvas and then paints its children. After painting its children,
1008
1010
/// custom paint asks foregroundPainter to paint. The coodinate system of the
1009
1011
/// canvas matches the coordinate system of the custom paint object. The
1010
- /// painters are expected to paint with in a rectangle starting at the origin
1012
+ /// painters are expected to paint within a rectangle starting at the origin
1011
1013
/// and encompassing a region of the given size. If the painters paints outside
1012
1014
/// those bounds, there might be insufficient memory allocated to rasterize the
1013
1015
/// painting commands and the resulting behavior is undefined.
1014
1016
///
1015
- /// Note: Custom paint calls its painters during paint, which means you cannot
1016
- /// dirty layout or paint information during the callback.
1017
+ /// Because custom paint calls its painters during paint, you cannot dirty
1018
+ /// layout or paint information during the callback.
1017
1019
class RenderCustomPaint extends RenderProxyBox {
1018
1020
RenderCustomPaint ({
1019
1021
CustomPainter painter,
0 commit comments