Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 0f9fc7a

Browse files
authored
Add more dart:ui diagrams (#36209)
1 parent 15438cc commit 0f9fc7a

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

lib/ui/geometry.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,8 @@ class Size extends OffsetBase {
633633
/// ```
634634
class Rect {
635635
/// Construct a rectangle from its left, top, right, and bottom edges.
636+
///
637+
/// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/rect_from_ltrb.png)
636638
@pragma('vm:entry-point')
637639
const Rect.fromLTRB(this.left, this.top, this.right, this.bottom)
638640
: assert(left != null),
@@ -645,11 +647,15 @@ class Rect {
645647
///
646648
/// To construct a [Rect] from an [Offset] and a [Size], you can use the
647649
/// rectangle constructor operator `&`. See [Offset.&].
650+
///
651+
/// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/rect_from_ltwh.png)
648652
const Rect.fromLTWH(double left, double top, double width, double height) : this.fromLTRB(left, top, left + width, top + height);
649653

650654
/// Construct a rectangle that bounds the given circle.
651655
///
652656
/// The `center` argument is assumed to be an offset from the origin.
657+
///
658+
/// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/rect_from_circle.png)
653659
Rect.fromCircle({ required Offset center, required double radius }) : this.fromCenter(
654660
center: center,
655661
width: radius * 2,
@@ -659,6 +665,8 @@ class Rect {
659665
/// Constructs a rectangle from its center point, width, and height.
660666
///
661667
/// The `center` argument is assumed to be an offset from the origin.
668+
///
669+
/// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/rect_from_center.png)
662670
Rect.fromCenter({ required Offset center, required double width, required double height }) : this.fromLTRB(
663671
center.dx - width / 2,
664672
center.dy - height / 2,
@@ -668,6 +676,8 @@ class Rect {
668676

669677
/// Construct the smallest rectangle that encloses the given offsets, treating
670678
/// them as vectors from the origin.
679+
///
680+
/// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/rect_from_points.png)
671681
Rect.fromPoints(Offset a, Offset b) : this.fromLTRB(
672682
math.min(a.dx, b.dx),
673683
math.min(a.dy, b.dy),
@@ -923,9 +933,13 @@ class Rect {
923933
/// A radius for either circular or elliptical shapes.
924934
class Radius {
925935
/// Constructs a circular radius. [x] and [y] will have the same radius value.
936+
///
937+
/// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/radius_circular.png)
926938
const Radius.circular(double radius) : this.elliptical(radius, radius);
927939

928940
/// Constructs an elliptical radius with the given radii.
941+
///
942+
/// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/radius_elliptical.png)
929943
const Radius.elliptical(this.x, this.y);
930944

931945
/// The radius value on the horizontal axis.

lib/ui/painting.dart

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2429,6 +2429,8 @@ class Path extends NativeFieldWrapperClass1 {
24292429
/// Adds a quadratic bezier segment that curves from the current
24302430
/// point to the given point (x2,y2), using the control point
24312431
/// (x1,y1).
2432+
///
2433+
/// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/path_quadratic_to.png)
24322434
@FfiNative<Void Function(Pointer<Void>, Float, Float, Float, Float)>('Path::quadraticBezierTo', isLeaf: true)
24332435
external void quadraticBezierTo(double x1, double y1, double x2, double y2);
24342436

@@ -2443,6 +2445,8 @@ class Path extends NativeFieldWrapperClass1 {
24432445
/// Adds a cubic bezier segment that curves from the current point
24442446
/// to the given point (x3,y3), using the control points (x1,y1) and
24452447
/// (x2,y2).
2448+
///
2449+
/// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/path_cubic_to.png)
24462450
@FfiNative<Void Function(Pointer<Void>, Float, Float, Float, Float, Float, Float)>('Path::cubicTo', isLeaf: true)
24472451
external void cubicTo(double x1, double y1, double x2, double y2, double x3, double y3);
24482452

@@ -2458,6 +2462,8 @@ class Path extends NativeFieldWrapperClass1 {
24582462
/// weight w. If the weight is greater than 1, then the curve is a
24592463
/// hyperbola; if the weight equals 1, it's a parabola; and if it is
24602464
/// less than 1, it is an ellipse.
2465+
///
2466+
/// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/path_conic_to.png)
24612467
@FfiNative<Void Function(Pointer<Void>, Float, Float, Float, Float, Float)>('Path::conicTo', isLeaf: true)
24622468
external void conicTo(double x1, double y1, double x2, double y2, double w);
24632469

@@ -4863,6 +4869,8 @@ class Canvas extends NativeFieldWrapperClass1 {
48634869
/// Reduces the clip region to the intersection of the current clip and the
48644870
/// given rectangle.
48654871
///
4872+
/// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/clip_rect.png)
4873+
///
48664874
/// If [doAntiAlias] is true, then the clip will be anti-aliased.
48674875
///
48684876
/// If multiple draw commands intersect with the clip boundary, this can result
@@ -4884,6 +4892,8 @@ class Canvas extends NativeFieldWrapperClass1 {
48844892
/// Reduces the clip region to the intersection of the current clip and the
48854893
/// given rounded rectangle.
48864894
///
4895+
/// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/clip_rrect.png)
4896+
///
48874897
/// If [doAntiAlias] is true, then the clip will be anti-aliased.
48884898
///
48894899
/// If multiple draw commands intersect with the clip boundary, this can result
@@ -4901,6 +4911,8 @@ class Canvas extends NativeFieldWrapperClass1 {
49014911
/// Reduces the clip region to the intersection of the current clip and the
49024912
/// given [Path].
49034913
///
4914+
/// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/clip_path.png)
4915+
///
49044916
/// If [doAntiAlias] is true, then the clip will be anti-aliased.
49054917
///
49064918
/// If multiple draw commands intersect with the clip boundary, this can result
@@ -5015,6 +5027,8 @@ class Canvas extends NativeFieldWrapperClass1 {
50155027
/// stroked, the value of the [Paint.style] is ignored for this call.
50165028
///
50175029
/// The `p1` and `p2` arguments are interpreted as offsets from the origin.
5030+
///
5031+
/// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/canvas_line.png)
50185032
void drawLine(Offset p1, Offset p2, Paint paint) {
50195033
assert(_offsetIsValid(p1));
50205034
assert(_offsetIsValid(p2));
@@ -5039,6 +5053,8 @@ class Canvas extends NativeFieldWrapperClass1 {
50395053

50405054
/// Draws a rectangle with the given [Paint]. Whether the rectangle is filled
50415055
/// or stroked (or both) is controlled by [Paint.style].
5056+
///
5057+
/// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/canvas_rect.png)
50425058
void drawRect(Rect rect, Paint paint) {
50435059
assert(_rectIsValid(rect));
50445060
assert(paint != null);
@@ -5050,6 +5066,8 @@ class Canvas extends NativeFieldWrapperClass1 {
50505066

50515067
/// Draws a rounded rectangle with the given [Paint]. Whether the rectangle is
50525068
/// filled or stroked (or both) is controlled by [Paint.style].
5069+
///
5070+
/// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/canvas_rrect.png)
50535071
void drawRRect(RRect rrect, Paint paint) {
50545072
assert(_rrectIsValid(rrect));
50555073
assert(paint != null);
@@ -5077,6 +5095,8 @@ class Canvas extends NativeFieldWrapperClass1 {
50775095
/// Draws an axis-aligned oval that fills the given axis-aligned rectangle
50785096
/// with the given [Paint]. Whether the oval is filled or stroked (or both) is
50795097
/// controlled by [Paint.style].
5098+
///
5099+
/// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/canvas_oval.png)
50805100
void drawOval(Rect rect, Paint paint) {
50815101
assert(_rectIsValid(rect));
50825102
assert(paint != null);
@@ -5090,6 +5110,8 @@ class Canvas extends NativeFieldWrapperClass1 {
50905110
/// that has the radius given by the second argument, with the [Paint] given in
50915111
/// the third argument. Whether the circle is filled or stroked (or both) is
50925112
/// controlled by [Paint.style].
5113+
///
5114+
/// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/canvas_circle.png)
50935115
void drawCircle(Offset c, double radius, Paint paint) {
50945116
assert(_offsetIsValid(c));
50955117
assert(paint != null);

0 commit comments

Comments
 (0)