Commit 8224e11b authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Documentation fixes. (#5903)

See #4434.
parent a1afba6b
...@@ -605,3 +605,21 @@ abstract class CompoundAnimation<T> extends Animation<T> ...@@ -605,3 +605,21 @@ abstract class CompoundAnimation<T> extends Animation<T>
} }
} }
} }
/// An animation of [double]s that tracks the mean of two other animations.
///
/// The [status] of this animation is the status of the `right` animation if it is
/// moving, and the `left` animation otherwise.
///
/// The [value] of this animation is the [double] that represents the mean value
/// of the values of the `left` and `right` animations.
class AnimationMean extends CompoundAnimation<double> {
/// Creates an animation that tracks the mean of two other animations.
AnimationMean({
Animation<double> left,
Animation<double> right,
}) : super(first: left, next: right);
@override
double get value => (first.value + next.value) / 2.0;
}
...@@ -239,6 +239,12 @@ class AppBar extends StatelessWidget { ...@@ -239,6 +239,12 @@ class AppBar extends StatelessWidget {
final double _expandedHeight; final double _expandedHeight;
final double _collapsedHeight; final double _collapsedHeight;
/// Returns the [expandedHeight] of the [AppBar] nearest to the given
/// [BuildContext].
///
/// Calling this function sets up an inheritance relationship, so that the
/// widget corresponding to the given [BuildContext] will rebuild whenever
/// that height changes.
static double getExpandedHeightFor(BuildContext context) { static double getExpandedHeightFor(BuildContext context) {
_AppBarExpandedHeight marker = context.inheritFromWidgetOfExactType(_AppBarExpandedHeight); _AppBarExpandedHeight marker = context.inheritFromWidgetOfExactType(_AppBarExpandedHeight);
return marker?.expandedHeight ?? 0.0; return marker?.expandedHeight ?? 0.0;
...@@ -292,6 +298,8 @@ class AppBar extends StatelessWidget { ...@@ -292,6 +298,8 @@ class AppBar extends StatelessWidget {
/// The [Scaffold] gives its app bar this height initially. If a /// The [Scaffold] gives its app bar this height initially. If a
/// [flexibleSpace] widget is specified this height should be big /// [flexibleSpace] widget is specified this height should be big
/// enough to accommodate whatever that widget contains. /// enough to accommodate whatever that widget contains.
///
/// See also [getExpandedHeightFor].
double get expandedHeight => _expandedHeight ?? (_toolBarHeight + bottomHeight); double get expandedHeight => _expandedHeight ?? (_toolBarHeight + bottomHeight);
/// By default, the height of the toolbar and the bottom widget (if any). /// By default, the height of the toolbar and the bottom widget (if any).
......
...@@ -13,7 +13,7 @@ import 'package:meta/meta.dart'; ...@@ -13,7 +13,7 @@ import 'package:meta/meta.dart';
// vertical or horizontal. // vertical or horizontal.
const double _kOnAxisDelta = 2.0; const double _kOnAxisDelta = 2.0;
/// A Tween that animates a point along a circular arc. /// A [Tween] that animates a [Point] along a circular arc.
/// ///
/// The arc's radius is related to the bounding box that contains the [begin] /// The arc's radius is related to the bounding box that contains the [begin]
/// and [end] points. If the bounding box is taller than it is wide, then the /// and [end] points. If the bounding box is taller than it is wide, then the
...@@ -21,14 +21,23 @@ const double _kOnAxisDelta = 2.0; ...@@ -21,14 +21,23 @@ const double _kOnAxisDelta = 2.0;
/// Otherwise the center of the circle will be aligned with the begin point. /// Otherwise the center of the circle will be aligned with the begin point.
/// The arc's sweep is always less than or equal to 90 degrees. /// The arc's sweep is always less than or equal to 90 degrees.
/// ///
/// Unlike those of most Tweens, the [begin] and [end] members of a
/// [MaterialPointArcTween] are immutable.
///
/// See also: /// See also:
/// ///
/// * [MaterialRectArcTween] /// * [MaterialRectArcTween]
class MaterialPointArcTween extends Tween<Point> { class MaterialPointArcTween extends Tween<Point> {
/// Creates a [Tween] for animating [Point]s along a circular arc.
///
/// The [begin] and [end] points are required, cannot be null, and are
/// immutable.
MaterialPointArcTween({ MaterialPointArcTween({
@required Point begin, @required Point begin,
@required Point end @required Point end
}) : super(begin: begin, end: end) { }) : super(begin: begin, end: end) {
assert(begin != null);
assert(end != null);
// An explanation with a diagram can be found at https://goo.gl/vMSdRg // An explanation with a diagram can be found at https://goo.gl/vMSdRg
final Offset delta = end - begin; final Offset delta = end - begin;
final double deltaX = delta.dx.abs(); final double deltaX = delta.dx.abs();
...@@ -151,20 +160,29 @@ const List<_Diagonal> _allDiagonals = const <_Diagonal>[ ...@@ -151,20 +160,29 @@ const List<_Diagonal> _allDiagonals = const <_Diagonal>[
const _Diagonal(_CornerId.bottomLeft, _CornerId.topRight), const _Diagonal(_CornerId.bottomLeft, _CornerId.topRight),
]; ];
/// A Tween that animates a rectangle from [begin] to [end]. /// A [Tween] that animates a [Rect] from [begin] to [end].
/// ///
/// The rectangle corners whose diagonal is closest to the overall direction of /// The rectangle corners whose diagonal is closest to the overall direction of
/// the animation follow arcs defined with [MaterialPointArcTween]. /// the animation follow arcs defined with [MaterialPointArcTween].
/// ///
/// Unlike those of most Tweens, the [begin] and [end] members of a
/// [MaterialPointArcTween] are immutable.
///
/// See also: /// See also:
/// ///
/// * [RectTween] (linear rectangle interpolation) /// * [MaterialPointArcTween]. the analogue for [Point] interporation.
/// * [MaterialPointArcTween] /// * [RectTween], which does a linear rectangle interpolation.
class MaterialRectArcTween extends RectTween { class MaterialRectArcTween extends RectTween {
/// Creates a [Tween] for animating [Rect]s along a circular arc.
///
/// The [begin] and [end] points are required, cannot be null, and are
/// immutable.
MaterialRectArcTween({ MaterialRectArcTween({
@required Rect begin, @required Rect begin,
@required Rect end @required Rect end
}) : super(begin: begin, end: end) { }) : super(begin: begin, end: end) {
assert(begin != null);
assert(end != null);
final Offset centersVector = end.center - begin.center; final Offset centersVector = end.center - begin.center;
_diagonal = maxBy(_allDiagonals, (_Diagonal d) => _diagonalSupport(centersVector, d)); _diagonal = maxBy(_allDiagonals, (_Diagonal d) => _diagonalSupport(centersVector, d));
_beginArc = new MaterialPointArcTween( _beginArc = new MaterialPointArcTween(
......
...@@ -12,10 +12,17 @@ import 'dart:ui' show lerpDouble; ...@@ -12,10 +12,17 @@ import 'dart:ui' show lerpDouble;
/// ///
/// All [MergeableMaterialItem] objects need a [LocalKey]. /// All [MergeableMaterialItem] objects need a [LocalKey].
abstract class MergeableMaterialItem { abstract class MergeableMaterialItem {
MergeableMaterialItem(this.key) { /// Abstract const constructor. This constructor enables subclasses to provide
assert(key != null); /// const constructors so that they can be used in const expressions.
} ///
/// The argument is the [key], which must not be null.
const MergeableMaterialItem(this.key);
/// The key for this item of the list.
///
/// The key is used to match parts of the mergeable material from frame to
/// frame so that state is maintained appropriately even as slices are added
/// or removed.
final LocalKey key; final LocalKey key;
} }
...@@ -29,7 +36,9 @@ class MaterialSlice extends MergeableMaterialItem { ...@@ -29,7 +36,9 @@ class MaterialSlice extends MergeableMaterialItem {
MaterialSlice({ MaterialSlice({
@required LocalKey key, @required LocalKey key,
this.child this.child
}) : super(key); }) : super(key) {
assert(key != null);
}
/// The contents of this slice. /// The contents of this slice.
final Widget child; final Widget child;
...@@ -48,7 +57,9 @@ class MaterialGap extends MergeableMaterialItem { ...@@ -48,7 +57,9 @@ class MaterialGap extends MergeableMaterialItem {
MaterialGap({ MaterialGap({
@required LocalKey key, @required LocalKey key,
this.size: 16.0 this.size: 16.0
}) : super(key); }) : super(key) {
assert(key != null);
}
/// The main axis extent of this gap. For example, if the [MergableMaterial] /// The main axis extent of this gap. For example, if the [MergableMaterial]
/// is vertical, then this is the height of the gap. /// is vertical, then this is the height of the gap.
...@@ -128,7 +139,7 @@ class _AnimationTuple { ...@@ -128,7 +139,7 @@ class _AnimationTuple {
class _MergeableMaterialState extends State<MergeableMaterial> { class _MergeableMaterialState extends State<MergeableMaterial> {
List<MergeableMaterialItem> _children; List<MergeableMaterialItem> _children;
final Map<LocalKey, _AnimationTuple> _animationTuples = final Map<LocalKey, _AnimationTuple> _animationTuples =
new Map<LocalKey, _AnimationTuple>(); <LocalKey, _AnimationTuple>{};
@override @override
void initState() { void initState() {
......
...@@ -76,16 +76,6 @@ class _CupertinoPageTransition extends AnimatedWidget { ...@@ -76,16 +76,6 @@ class _CupertinoPageTransition extends AnimatedWidget {
} }
} }
class AnimationMean extends CompoundAnimation<double> {
AnimationMean({
Animation<double> left,
Animation<double> right,
}) : super(first: left, next: right);
@override
double get value => (first.value + next.value) / 2.0;
}
// Custom curve for iOS page transitions. // Custom curve for iOS page transitions.
class _CupertinoTransitionCurve extends Curve { class _CupertinoTransitionCurve extends Curve {
_CupertinoTransitionCurve(this.curve); _CupertinoTransitionCurve(this.curve);
...@@ -204,21 +194,21 @@ class MaterialPageRoute<T> extends PageRoute<T> { ...@@ -204,21 +194,21 @@ class MaterialPageRoute<T> extends PageRoute<T> {
@override @override
void dispose() { void dispose() {
_backGestureController?.dispose();
super.dispose(); super.dispose();
backGestureController?.dispose();
} }
_CupertinoBackGestureController backGestureController; _CupertinoBackGestureController _backGestureController;
@override @override
NavigationGestureController startPopGesture(NavigatorState navigator) { NavigationGestureController startPopGesture(NavigatorState navigator) {
assert(backGestureController == null); assert(_backGestureController == null);
backGestureController = new _CupertinoBackGestureController( _backGestureController = new _CupertinoBackGestureController(
navigator: navigator, navigator: navigator,
controller: controller, controller: controller,
onDisposed: () { backGestureController = null; } onDisposed: () { _backGestureController = null; }
); );
return backGestureController; return _backGestureController;
} }
@override @override
......
...@@ -80,8 +80,8 @@ enum _DismissTransition { ...@@ -80,8 +80,8 @@ enum _DismissTransition {
/// See also: /// See also:
/// ///
/// * <https://www.google.com/design/spec/patterns/swipe-to-refresh.html> /// * <https://www.google.com/design/spec/patterns/swipe-to-refresh.html>
/// * [RefreshIndicatorState] (can be used to programatically show the refresh indicator) /// * [RefreshIndicatorState], can be used to programatically show the refresh indicator.
/// * [RefreshProgressIndicator] /// * [RefreshProgressIndicator].
class RefreshIndicator extends StatefulWidget { class RefreshIndicator extends StatefulWidget {
/// Creates a refresh indicator. /// Creates a refresh indicator.
/// ///
...@@ -319,10 +319,8 @@ class RefreshIndicatorState extends State<RefreshIndicator> { ...@@ -319,10 +319,8 @@ class RefreshIndicatorState extends State<RefreshIndicator> {
/// been started interactively. If this method is called while the refresh /// been started interactively. If this method is called while the refresh
/// callback is running, it quietly does nothing. /// callback is running, it quietly does nothing.
/// ///
/// See also: /// Creating the RefreshIndicator with a [GlobalKey<RefreshIndicatorState>]
/// /// makes it possible to refer to the [RefreshIndicatorState].
/// * [GlobalKey] (creating the RefreshIndicator with a [GlobalKey<RefreshIndicatorState>]
/// will make it possible to refer to the [RefreshIndicatorState] later)
Future<Null> show() async { Future<Null> show() async {
if (_mode != _RefreshIndicatorMode.refresh) { if (_mode != _RefreshIndicatorMode.refresh) {
_sizeController.value = 0.0; _sizeController.value = 0.0;
......
...@@ -128,7 +128,7 @@ class BannerPainter extends CustomPainter { ...@@ -128,7 +128,7 @@ class BannerPainter extends CustomPainter {
/// ///
/// See also: /// See also:
/// ///
/// * [CheckedModeBanner] /// * [CheckedModeBanner].
class Banner extends StatelessWidget { class Banner extends StatelessWidget {
/// Creates a banner. /// Creates a banner.
/// ///
......
...@@ -205,8 +205,8 @@ class BackdropFilter extends SingleChildRenderObjectWidget { ...@@ -205,8 +205,8 @@ class BackdropFilter extends SingleChildRenderObjectWidget {
/// ///
/// See also: /// See also:
/// ///
/// * [CustomPainter] /// * [CustomPainter].
/// * [Canvas] /// * [Canvas].
class CustomPaint extends SingleChildRenderObjectWidget { class CustomPaint extends SingleChildRenderObjectWidget {
/// Creates a widget that delegates its painting. /// Creates a widget that delegates its painting.
CustomPaint({ Key key, this.painter, this.foregroundPainter, Widget child }) CustomPaint({ Key key, this.painter, this.foregroundPainter, Widget child })
...@@ -540,11 +540,11 @@ class Padding extends SingleChildRenderObjectWidget { ...@@ -540,11 +540,11 @@ class Padding extends SingleChildRenderObjectWidget {
/// ///
/// See also: /// See also:
/// ///
/// * [CustomSingleChildLayout] /// * [CustomSingleChildLayout].
/// * [Center] (which is the same as [Align] but with the [alignment] always /// * [Center], which is the same as [Align] but with the [alignment] always
/// set to [FractionalOffset.center]) /// set to [FractionalOffset.center].
/// * [FractionallySizedBox] (which sizes its child based on a fraction of its own /// * [FractionallySizedBox], which sizes its child based on a fraction of its own
/// size and positions the child according to a [FractionalOffset] value) /// size and positions the child according to a [FractionalOffset] value.
class Align extends SingleChildRenderObjectWidget { class Align extends SingleChildRenderObjectWidget {
/// Creates an alignment widget. /// Creates an alignment widget.
/// ///
......
...@@ -349,9 +349,9 @@ class TypeMatcher<T> { ...@@ -349,9 +349,9 @@ class TypeMatcher<T> {
/// ///
/// See also: /// See also:
/// ///
/// * [StatelessWidget] /// * [StatelessWidget].
/// * [StatefulWidget] /// * [StatefulWidget].
/// * [InheritedWidget] /// * [InheritedWidget].
abstract class Widget { abstract class Widget {
/// Initializes [key] for subclasses. /// Initializes [key] for subclasses.
const Widget({ this.key }); const Widget({ this.key });
...@@ -429,7 +429,7 @@ abstract class Widget { ...@@ -429,7 +429,7 @@ abstract class Widget {
/// ///
/// See also: /// See also:
/// ///
/// * [StatefulWidget] /// * [StatefulWidget].
abstract class StatelessWidget extends Widget { abstract class StatelessWidget extends Widget {
/// Initializes [key] for subclasses. /// Initializes [key] for subclasses.
const StatelessWidget({ Key key }) : super(key: key); const StatelessWidget({ Key key }) : super(key: key);
...@@ -510,8 +510,8 @@ abstract class StatelessWidget extends Widget { ...@@ -510,8 +510,8 @@ abstract class StatelessWidget extends Widget {
/// ///
/// See also: /// See also:
/// ///
/// * [State] /// * [State].
/// * [StatelessWidget] /// * [StatelessWidget].
abstract class StatefulWidget extends Widget { abstract class StatefulWidget extends Widget {
/// Initializes [key] for subclasses. /// Initializes [key] for subclasses.
const StatefulWidget({ Key key }) : super(key: key); const StatefulWidget({ Key key }) : super(key: key);
...@@ -641,8 +641,8 @@ typedef void StateSetter(VoidCallback fn); ...@@ -641,8 +641,8 @@ typedef void StateSetter(VoidCallback fn);
/// ///
/// See also: /// See also:
/// ///
/// * [StatefulWidget] /// * [StatefulWidget].
/// * [StatelessWidget] /// * [StatelessWidget].
@optionalTypeArgs @optionalTypeArgs
abstract class State<T extends StatefulWidget> { abstract class State<T extends StatefulWidget> {
/// The current configuration. /// The current configuration.
...@@ -758,8 +758,8 @@ abstract class State<T extends StatefulWidget> { ...@@ -758,8 +758,8 @@ abstract class State<T extends StatefulWidget> {
/// ///
/// See also: /// See also:
/// ///
/// * [BindingBase.reassembleApplication] /// * [BindingBase.reassembleApplication].
/// * [Image], which uses this to reload images /// * [Image], which uses this to reload images.
@protected @protected
@mustCallSuper @mustCallSuper
void reassemble() { } void reassemble() { }
......
...@@ -45,10 +45,10 @@ import 'framework.dart'; ...@@ -45,10 +45,10 @@ import 'framework.dart';
/// ///
/// See also: /// See also:
/// ///
/// * [Overlay] /// * [Overlay].
/// * [OverlayState] /// * [OverlayState].
/// * [WidgetsApp] /// * [WidgetsApp].
/// * [MaterialApp] /// * [MaterialApp].
class OverlayEntry { class OverlayEntry {
/// Creates an overlay entry. /// Creates an overlay entry.
/// ///
...@@ -167,10 +167,10 @@ class _OverlayEntryState extends State<_OverlayEntry> { ...@@ -167,10 +167,10 @@ class _OverlayEntryState extends State<_OverlayEntry> {
/// ///
/// See also: /// See also:
/// ///
/// * [OverlayEntry] /// * [OverlayEntry].
/// * [OverlayState] /// * [OverlayState].
/// * [WidgetsApp] /// * [WidgetsApp].
/// * [MaterialApp] /// * [MaterialApp].
class Overlay extends StatefulWidget { class Overlay extends StatefulWidget {
/// Creates an overlay. /// Creates an overlay.
/// ///
......
...@@ -797,7 +797,7 @@ enum ScrollNotificationKind { ...@@ -797,7 +797,7 @@ enum ScrollNotificationKind {
/// ///
/// See also: /// See also:
/// ///
/// * [NotificationListener] /// * [NotificationListener].
class ScrollNotification extends Notification { class ScrollNotification extends Notification {
/// Creates a notification about scrolling. /// Creates a notification about scrolling.
ScrollNotification({ this.scrollable, this.kind, dynamic details }) : _details = details { ScrollNotification({ this.scrollable, this.kind, dynamic details }) : _details = details {
...@@ -991,9 +991,9 @@ class ScrollableViewport extends StatelessWidget { ...@@ -991,9 +991,9 @@ class ScrollableViewport extends StatelessWidget {
/// ///
/// See also: /// See also:
/// ///
/// * [ScrollableViewport], if you only have one child /// * [ScrollableViewport], if you only have one child.
/// * [ScrollableList], if all your children are the same height /// * [ScrollableList], if all your children are the same height.
/// * [LazyBlock], if you have children with varying heights /// * [LazyBlock], if you have children with varying heights.
class Block extends StatelessWidget { class Block extends StatelessWidget {
/// Creates a scrollable array of children. /// Creates a scrollable array of children.
Block({ Block({
......
...@@ -20,9 +20,9 @@ import 'virtual_viewport.dart'; ...@@ -20,9 +20,9 @@ import 'virtual_viewport.dart';
/// ///
/// See also: /// See also:
/// ///
/// * [CustomGrid] /// * [CustomGrid].
/// * [ScrollableList] /// * [ScrollableList].
/// * [ScrollableViewport] /// * [ScrollableViewport].
class ScrollableGrid extends StatelessWidget { class ScrollableGrid extends StatelessWidget {
/// Creates a vertically scrollable grid. /// Creates a vertically scrollable grid.
/// ///
...@@ -119,8 +119,8 @@ class ScrollableGrid extends StatelessWidget { ...@@ -119,8 +119,8 @@ class ScrollableGrid extends StatelessWidget {
/// ///
/// See also: /// See also:
/// ///
/// * [ListViewport] /// * [ListViewport].
/// * [LazyListViewport] /// * [LazyListViewport].
class GridViewport extends VirtualViewportFromIterable { class GridViewport extends VirtualViewportFromIterable {
/// Creates a virtual viewport onto a grid of widgets. /// Creates a virtual viewport onto a grid of widgets.
/// ///
......
...@@ -27,9 +27,9 @@ import 'virtual_viewport.dart'; ...@@ -27,9 +27,9 @@ import 'virtual_viewport.dart';
/// ///
/// See also: /// See also:
/// ///
/// * [ScrollableLazyList] /// * [ScrollableLazyList].
/// * [LazyBlock] /// * [LazyBlock].
/// * [ScrollableViewport] /// * [ScrollableViewport].
class ScrollableList extends StatelessWidget { class ScrollableList extends StatelessWidget {
/// Creats a scrollable list of children that have equal size. /// Creats a scrollable list of children that have equal size.
/// ///
...@@ -377,9 +377,9 @@ class _VirtualListViewportElement extends VirtualViewportElement { ...@@ -377,9 +377,9 @@ class _VirtualListViewportElement extends VirtualViewportElement {
/// ///
/// See also: /// See also:
/// ///
/// * [LazyListViewport] /// * [LazyListViewport].
/// * [LazyBlockViewport] /// * [LazyBlockViewport].
/// * [GridViewport] /// * [GridViewport].
class ListViewport extends _VirtualListViewport with VirtualViewportFromIterable { class ListViewport extends _VirtualListViewport with VirtualViewportFromIterable {
/// Creates a virtual viewport onto a list of equally sized children. /// Creates a virtual viewport onto a list of equally sized children.
/// ///
...@@ -420,8 +420,8 @@ class ListViewport extends _VirtualListViewport with VirtualViewportFromIterable ...@@ -420,8 +420,8 @@ class ListViewport extends _VirtualListViewport with VirtualViewportFromIterable
/// ///
/// See also: /// See also:
/// ///
/// * [ScrollableList] /// * [ScrollableList].
/// * [LazyBlock] /// * [LazyBlock].
class ScrollableLazyList extends StatelessWidget { class ScrollableLazyList extends StatelessWidget {
/// Creates an infinite scrollable list of children that have equal size. /// Creates an infinite scrollable list of children that have equal size.
/// ///
...@@ -579,8 +579,8 @@ class ScrollableLazyList extends StatelessWidget { ...@@ -579,8 +579,8 @@ class ScrollableLazyList extends StatelessWidget {
/// ///
/// See also: /// See also:
/// ///
/// * [ListViewport] /// * [ListViewport].
/// * [LazyBlockViewport] /// * [LazyBlockViewport].
class LazyListViewport extends _VirtualListViewport with VirtualViewportFromBuilder { class LazyListViewport extends _VirtualListViewport with VirtualViewportFromBuilder {
/// Creates a virtual viewport onto an extremely large or infinite list of equally sized children. /// Creates a virtual viewport onto an extremely large or infinite list of equally sized children.
/// ///
......
...@@ -295,7 +295,7 @@ class RelativeRectTween extends Tween<RelativeRect> { ...@@ -295,7 +295,7 @@ class RelativeRectTween extends Tween<RelativeRect> {
/// ///
/// See also: /// See also:
/// ///
/// * [RelativePositionedTransition] /// * [RelativePositionedTransition].
class PositionedTransition extends AnimatedWidget { class PositionedTransition extends AnimatedWidget {
/// Creates a transition for [Positioned]. /// Creates a transition for [Positioned].
/// ///
...@@ -332,7 +332,7 @@ class PositionedTransition extends AnimatedWidget { ...@@ -332,7 +332,7 @@ class PositionedTransition extends AnimatedWidget {
/// ///
/// See also: /// See also:
/// ///
/// * [PositionedTransition] /// * [PositionedTransition].
class RelativePositionedTransition extends AnimatedWidget { class RelativePositionedTransition extends AnimatedWidget {
/// Create an animated version of [Positioned]. /// Create an animated version of [Positioned].
/// ///
......
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