Commit 830d163c authored by Adam Barth's avatar Adam Barth Committed by GitHub

Add more dartdocs for slivers (#9164)

This patch adds docs for many of the sliver widgets.
parent 5d8bad74
...@@ -211,8 +211,8 @@ abstract class RenderSliverFixedExtentBoxAdaptor extends RenderSliverMultiBoxAda ...@@ -211,8 +211,8 @@ abstract class RenderSliverFixedExtentBoxAdaptor extends RenderSliverMultiBoxAda
} }
} }
/// A sliver that contains multiple box children that have a given extent in the /// A sliver that places multiple box children with the same main axis extent in
/// main axis. /// a linear array.
/// ///
/// [RenderSliverFixedExtentList] places its children in a linear array along /// [RenderSliverFixedExtentList] places its children in a linear array along
/// the main axis starting at offset zero and without gaps. Each child is forced /// the main axis starting at offset zero and without gaps. Each child is forced
......
...@@ -424,8 +424,7 @@ class SliverGridParentData extends SliverMultiBoxAdaptorParentData { ...@@ -424,8 +424,7 @@ class SliverGridParentData extends SliverMultiBoxAdaptorParentData {
String toString() => 'crossAxisOffset=$crossAxisOffset; ${super.toString()}'; String toString() => 'crossAxisOffset=$crossAxisOffset; ${super.toString()}';
} }
/// A sliver that contains multiple box children that whose size and position /// A sliver that places multiple box children in a two dimensional arrangement.
/// are determined by a delegate.
/// ///
/// [RenderSliverGrid] places its children in arbitrary positions determined by /// [RenderSliverGrid] places its children in arbitrary positions determined by
/// [gridDelegate]. Each child is forced to have the size specified by the /// [gridDelegate]. Each child is forced to have the size specified by the
......
...@@ -24,8 +24,9 @@ import 'sliver_multi_box_adaptor.dart'; ...@@ -24,8 +24,9 @@ import 'sliver_multi_box_adaptor.dart';
/// ///
/// If the children have a fixed extent in the main axis, consider using /// If the children have a fixed extent in the main axis, consider using
/// [RenderSliverFixedExtentList] rather than [RenderSliverList] because /// [RenderSliverFixedExtentList] rather than [RenderSliverList] because
/// does not need to perform layout on its children to obtain their extent in /// [RenderSliverFixedExtentList] does not need to perform layout on its
/// the main axis and is therefore more efficient. /// children to obtain their extent in the main axis and is therefore more
/// efficient.
/// ///
/// See also: /// See also:
/// ///
......
...@@ -68,8 +68,7 @@ abstract class ScrollView extends StatelessWidget { ...@@ -68,8 +68,7 @@ abstract class ScrollView extends StatelessWidget {
/// Defaults to [Axis.vertical]. /// Defaults to [Axis.vertical].
final Axis scrollDirection; final Axis scrollDirection;
/// Whether the scroll view scrolls in the reading direction in the /// Whether the scroll view scrolls in the reading direction.
/// [scrollDirection].
/// ///
/// For example, if the reading direction is left-to-right and /// For example, if the reading direction is left-to-right and
/// [scrollDirection] is [Axis.horizontal], then the scroll view scrolls from /// [scrollDirection] is [Axis.horizontal], then the scroll view scrolls from
......
...@@ -38,6 +38,7 @@ import 'scrollable.dart'; ...@@ -38,6 +38,7 @@ import 'scrollable.dart';
/// * [PageView], for a scrollable that works page by page. /// * [PageView], for a scrollable that works page by page.
/// * [Scrollable], which handles arbitrary scrolling effects. /// * [Scrollable], which handles arbitrary scrolling effects.
class SingleChildScrollView extends StatelessWidget { class SingleChildScrollView extends StatelessWidget {
/// Creates a box in which a single widget can be scrolled.
SingleChildScrollView({ SingleChildScrollView({
Key key, Key key,
this.scrollDirection: Axis.vertical, this.scrollDirection: Axis.vertical,
...@@ -57,12 +58,32 @@ class SingleChildScrollView extends StatelessWidget { ...@@ -57,12 +58,32 @@ class SingleChildScrollView extends StatelessWidget {
); );
} }
/// The axis along which the scroll view scrolls.
///
/// Defaults to [Axis.vertical].
final Axis scrollDirection; final Axis scrollDirection;
/// Whether the scroll view scrolls in the reading direction.
///
/// For example, if the reading direction is left-to-right and
/// [scrollDirection] is [Axis.horizontal], then the scroll view scrolls from
/// left to right when [reverse] is false and from right to left when
/// [reverse] is true.
///
/// Similarly, if [scrollDirection] is [Axis.vertical], then scroll view
/// scrolls from top to bottom when [reverse] is false and from bottom to top
/// when [reverse] is true.
///
/// Defaults to false.
final bool reverse; final bool reverse;
/// The amount of space by which to inset the child.
final EdgeInsets padding; final EdgeInsets padding;
/// An object that can be used to control the position to which this scroll
/// view is scrolled.
///
/// Must be null if [primary] is true.
final ScrollController controller; final ScrollController controller;
/// Whether this is the primary scroll view associated with the parent /// Whether this is the primary scroll view associated with the parent
...@@ -75,8 +96,15 @@ class SingleChildScrollView extends StatelessWidget { ...@@ -75,8 +96,15 @@ class SingleChildScrollView extends StatelessWidget {
/// not specified. /// not specified.
final bool primary; final bool primary;
/// How the scroll view should respond to user input.
///
/// For example, determines how the scroll view continues to animate after the
/// user stops dragging the scroll view.
///
/// Defaults to matching platform conventions.
final ScrollPhysics physics; final ScrollPhysics physics;
/// The widget that scrolls.
final Widget child; final Widget child;
AxisDirection _getDirection(BuildContext context) { AxisDirection _getDirection(BuildContext context) {
......
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