From d4b871e1a7b4b41c2915a610b541d1f00cb151b4 Mon Sep 17 00:00:00 2001 From: Ian Hickson Date: Fri, 20 Nov 2020 14:28:03 -0800 Subject: [PATCH] Minor documentation fixes (#70501) --- .../flutter/lib/src/rendering/viewport.dart | 5 ++++ .../flutter/lib/src/widgets/framework.dart | 27 ++++++++++++------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/packages/flutter/lib/src/rendering/viewport.dart b/packages/flutter/lib/src/rendering/viewport.dart index b963e8de13..7285560d80 100644 --- a/packages/flutter/lib/src/rendering/viewport.dart +++ b/packages/flutter/lib/src/rendering/viewport.dart @@ -53,6 +53,11 @@ abstract class RenderAbstractViewport extends RenderObject { /// Returns the offset that would be needed to reveal the `target` /// [RenderObject]. /// + /// This is used by [RenderViewportBase.showInViewport], which is + /// itself used by [RenderObject.showOnScreen] for + /// [RenderViewportBase], which is in turn used by the semantics + /// system to implement scrolling for accessibility tools. + /// /// The optional `rect` parameter describes which area of that `target` object /// should be revealed in the viewport. If `rect` is null, the entire /// `target` [RenderObject] (as defined by its [RenderObject.paintBounds]) diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart index 2a1a2e30e3..f6ae779a8f 100644 --- a/packages/flutter/lib/src/widgets/framework.dart +++ b/packages/flutter/lib/src/widgets/framework.dart @@ -3326,6 +3326,15 @@ abstract class Element extends DiagnosticableTree implements BuildContext { /// | :-----------------: | :--------------------- | :---------------------- | /// | **child == null** | Returns null. | Returns new [Element]. | /// | **child != null** | Old child is removed, returns null. | Old child updated if possible, returns child or new [Element]. | + /// + /// The `newSlot` argument is used only if `newWidget` is not null. If `child` + /// is null (or if the old child cannot be updated), then the `newSlot` is + /// given to the new [Element] that is created for the child, via + /// [inflateWidget]. If `child` is not null (and the old child _can_ be + /// updated), then the `newSlot` is given to [updateSlotForChild] to update + /// its slot, in case it has moved around since it was last built. + /// + /// See the [RenderObjectElement] documentation for more information on slots. @protected Element? updateChild(Element? child, Widget? newWidget, dynamic newSlot) { if (newWidget == null) { @@ -5336,10 +5345,10 @@ class InheritedElement extends ProxyElement { /// class FooElement extends RenderObjectElement { /// /// @override -/// Foo get widget => super.widget; +/// Foo get widget => super.widget as Foo; /// /// @override -/// RenderFoo get renderObject => super.renderObject; +/// RenderFoo get renderObject => super.renderObject as RenderFoo; /// /// // ... /// } @@ -5397,13 +5406,13 @@ class InheritedElement extends ProxyElement { /// /// #### Dynamically determining the children during layout /// -/// If the widgets are to be generated at layout time, then generating them when -/// the [update] method won't work: layout of this element's render object -/// hasn't started yet at that point. Instead, the [update] method can mark the -/// render object as needing layout (see [RenderObject.markNeedsLayout]), and -/// then the render object's [RenderObject.performLayout] method can call back -/// to the element to have it generate the widgets and call [updateChild] -/// accordingly. +/// If the widgets are to be generated at layout time, then generating them in +/// the [mount] and [update] methods won't work: layout of this element's render +/// object hasn't started yet at that point. Instead, the [update] method can +/// mark the render object as needing layout (see +/// [RenderObject.markNeedsLayout]), and then the render object's +/// [RenderObject.performLayout] method can call back to the element to have it +/// generate the widgets and call [updateChild] accordingly. /// /// For a render object to call an element during layout, it must use /// [RenderObject.invokeLayoutCallback]. For an element to call [updateChild]