Unverified Commit ffb48c5a authored by MH Johnson's avatar MH Johnson Committed by GitHub

[Documentation] Moved lerp macro definition to painting/ (#22388)

* [Documentation] Moved lerp macro def to painting/
parent 124a636c
...@@ -360,7 +360,7 @@ class ChipThemeData extends Diagnosticable { ...@@ -360,7 +360,7 @@ class ChipThemeData extends Diagnosticable {
/// ///
/// The arguments must not be null. /// The arguments must not be null.
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static ChipThemeData lerp(ChipThemeData a, ChipThemeData b, double t) { static ChipThemeData lerp(ChipThemeData a, ChipThemeData b, double t) {
assert(t != null); assert(t != null);
if (a == null && b == null) if (a == null && b == null)
......
...@@ -391,7 +391,7 @@ class SliderThemeData extends Diagnosticable { ...@@ -391,7 +391,7 @@ class SliderThemeData extends Diagnosticable {
/// ///
/// The arguments must not be null. /// The arguments must not be null.
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static SliderThemeData lerp(SliderThemeData a, SliderThemeData b, double t) { static SliderThemeData lerp(SliderThemeData a, SliderThemeData b, double t) {
assert(a != null); assert(a != null);
assert(b != null); assert(b != null);
......
...@@ -63,7 +63,7 @@ class TabBarTheme extends Diagnosticable { ...@@ -63,7 +63,7 @@ class TabBarTheme extends Diagnosticable {
/// ///
/// The arguments must not be null. /// The arguments must not be null.
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static TabBarTheme lerp(TabBarTheme a, TabBarTheme b, double t) { static TabBarTheme lerp(TabBarTheme a, TabBarTheme b, double t) {
assert(a != null); assert(a != null);
assert(b != null); assert(b != null);
......
...@@ -774,19 +774,9 @@ class ThemeData extends Diagnosticable { ...@@ -774,19 +774,9 @@ class ThemeData extends Diagnosticable {
/// Linearly interpolate between two themes. /// Linearly interpolate between two themes.
/// ///
/// {@template flutter.material.themeData.lerp} /// The arguments must not be null.
/// The `t` argument represents position on the timeline, with 0.0 meaning
/// that the interpolation has not started, returning `a` (or something
/// equivalent to `a`), 1.0 meaning that the interpolation has finished,
/// returning `b` (or something equivalent to `b`), and values in between
/// meaning that the interpolation is at the relevant point on the timeline
/// between `a` and `b`. The interpolation can be extrapolated beyond 0.0 and
/// 1.0, so negative values and values greater than 1.0 are valid (and can
/// easily be generated by curves such as [Curves.elasticInOut]).
/// ///
/// Values for `t` are usually obtained from an [Animation<double>], such as /// {@macro flutter.painting.gradient.lerp}
/// an [AnimationController].
/// {@endtemplate}
static ThemeData lerp(ThemeData a, ThemeData b, double t) { static ThemeData lerp(ThemeData a, ThemeData b, double t) {
assert(a != null); assert(a != null);
assert(b != null); assert(b != null);
......
...@@ -361,7 +361,7 @@ class TextTheme extends Diagnosticable { ...@@ -361,7 +361,7 @@ class TextTheme extends Diagnosticable {
/// ///
/// The arguments must not be null. /// The arguments must not be null.
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static TextTheme lerp(TextTheme a, TextTheme b, double t) { static TextTheme lerp(TextTheme a, TextTheme b, double t) {
assert(a != null); assert(a != null);
assert(b != null); assert(b != null);
......
...@@ -85,7 +85,7 @@ abstract class AlignmentGeometry { ...@@ -85,7 +85,7 @@ abstract class AlignmentGeometry {
/// representing a combination of both is returned. That object can be turned /// representing a combination of both is returned. That object can be turned
/// into a concrete [Alignment] using [resolve]. /// into a concrete [Alignment] using [resolve].
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static AlignmentGeometry lerp(AlignmentGeometry a, AlignmentGeometry b, double t) { static AlignmentGeometry lerp(AlignmentGeometry a, AlignmentGeometry b, double t) {
assert(t != null); assert(t != null);
if (a == null && b == null) if (a == null && b == null)
...@@ -324,7 +324,7 @@ class Alignment extends AlignmentGeometry { ...@@ -324,7 +324,7 @@ class Alignment extends AlignmentGeometry {
/// ///
/// If either is null, this function interpolates from [Alignment.center]. /// If either is null, this function interpolates from [Alignment.center].
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static Alignment lerp(Alignment a, Alignment b, double t) { static Alignment lerp(Alignment a, Alignment b, double t) {
assert(t != null); assert(t != null);
if (a == null && b == null) if (a == null && b == null)
...@@ -505,7 +505,7 @@ class AlignmentDirectional extends AlignmentGeometry { ...@@ -505,7 +505,7 @@ class AlignmentDirectional extends AlignmentGeometry {
/// ///
/// If either is null, this function interpolates from [AlignmentDirectional.center]. /// If either is null, this function interpolates from [AlignmentDirectional.center].
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static AlignmentDirectional lerp(AlignmentDirectional a, AlignmentDirectional b, double t) { static AlignmentDirectional lerp(AlignmentDirectional a, AlignmentDirectional b, double t) {
assert(t != null); assert(t != null);
if (a == null && b == null) if (a == null && b == null)
......
...@@ -127,7 +127,7 @@ abstract class BorderRadiusGeometry { ...@@ -127,7 +127,7 @@ abstract class BorderRadiusGeometry {
/// representing a combination of both is returned. That object can be turned /// representing a combination of both is returned. That object can be turned
/// into a concrete [BorderRadius] using [resolve]. /// into a concrete [BorderRadius] using [resolve].
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static BorderRadiusGeometry lerp(BorderRadiusGeometry a, BorderRadiusGeometry b, double t) { static BorderRadiusGeometry lerp(BorderRadiusGeometry a, BorderRadiusGeometry b, double t) {
assert(t != null); assert(t != null);
if (a == null && b == null) if (a == null && b == null)
...@@ -471,7 +471,7 @@ class BorderRadius extends BorderRadiusGeometry { ...@@ -471,7 +471,7 @@ class BorderRadius extends BorderRadiusGeometry {
/// ///
/// If either is null, this function interpolates from [BorderRadius.zero]. /// If either is null, this function interpolates from [BorderRadius.zero].
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static BorderRadius lerp(BorderRadius a, BorderRadius b, double t) { static BorderRadius lerp(BorderRadius a, BorderRadius b, double t) {
assert(t != null); assert(t != null);
if (a == null && b == null) if (a == null && b == null)
...@@ -688,7 +688,7 @@ class BorderRadiusDirectional extends BorderRadiusGeometry { ...@@ -688,7 +688,7 @@ class BorderRadiusDirectional extends BorderRadiusGeometry {
/// ///
/// If either is null, this function interpolates from [BorderRadiusDirectional.zero]. /// If either is null, this function interpolates from [BorderRadiusDirectional.zero].
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static BorderRadiusDirectional lerp(BorderRadiusDirectional a, BorderRadiusDirectional b, double t) { static BorderRadiusDirectional lerp(BorderRadiusDirectional a, BorderRadiusDirectional b, double t) {
assert(t != null); assert(t != null);
if (a == null && b == null) if (a == null && b == null)
......
...@@ -198,7 +198,7 @@ class BorderSide { ...@@ -198,7 +198,7 @@ class BorderSide {
/// ///
/// The arguments must not be null. /// The arguments must not be null.
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static BorderSide lerp(BorderSide a, BorderSide b, double t) { static BorderSide lerp(BorderSide a, BorderSide b, double t) {
assert(a != null); assert(a != null);
assert(b != null); assert(b != null);
...@@ -404,7 +404,7 @@ abstract class ShapeBorder { ...@@ -404,7 +404,7 @@ abstract class ShapeBorder {
/// function instead. If both return null, it returns `a` before `t=0.5` /// function instead. If both return null, it returns `a` before `t=0.5`
/// and `b` after `t=0.5`. /// and `b` after `t=0.5`.
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static ShapeBorder lerp(ShapeBorder a, ShapeBorder b, double t) { static ShapeBorder lerp(ShapeBorder a, ShapeBorder b, double t) {
assert(t != null); assert(t != null);
ShapeBorder result; ShapeBorder result;
......
...@@ -98,7 +98,7 @@ abstract class BoxBorder extends ShapeBorder { ...@@ -98,7 +98,7 @@ abstract class BoxBorder extends ShapeBorder {
/// For a more flexible approach, consider [ShapeBorder.lerp], which would /// For a more flexible approach, consider [ShapeBorder.lerp], which would
/// instead [add] the two sets of sides and interpolate them simultaneously. /// instead [add] the two sets of sides and interpolate them simultaneously.
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static BoxBorder lerp(BoxBorder a, BoxBorder b, double t) { static BoxBorder lerp(BoxBorder a, BoxBorder b, double t) {
assert(t != null); assert(t != null);
if ((a is Border || a == null) && (b is Border || b == null)) if ((a is Border || a == null) && (b is Border || b == null))
...@@ -421,7 +421,7 @@ class Border extends BoxBorder { ...@@ -421,7 +421,7 @@ class Border extends BoxBorder {
/// If a border is null, it is treated as having four [BorderSide.none] /// If a border is null, it is treated as having four [BorderSide.none]
/// borders. /// borders.
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static Border lerp(Border a, Border b, double t) { static Border lerp(Border a, Border b, double t) {
assert(t != null); assert(t != null);
if (a == null && b == null) if (a == null && b == null)
...@@ -711,7 +711,7 @@ class BorderDirectional extends BoxBorder { ...@@ -711,7 +711,7 @@ class BorderDirectional extends BoxBorder {
/// If a border is null, it is treated as having four [BorderSide.none] /// If a border is null, it is treated as having four [BorderSide.none]
/// borders. /// borders.
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static BorderDirectional lerp(BorderDirectional a, BorderDirectional b, double t) { static BorderDirectional lerp(BorderDirectional a, BorderDirectional b, double t) {
assert(t != null); assert(t != null);
if (a == null && b == null) if (a == null && b == null)
......
...@@ -215,7 +215,7 @@ class BoxDecoration extends Decoration { ...@@ -215,7 +215,7 @@ class BoxDecoration extends Decoration {
/// unmodified. Otherwise, the values are computed by interpolating the /// unmodified. Otherwise, the values are computed by interpolating the
/// properties appropriately. /// properties appropriately.
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
/// ///
/// See also: /// See also:
/// ///
......
...@@ -94,7 +94,7 @@ class BoxShadow { ...@@ -94,7 +94,7 @@ class BoxShadow {
/// a box shadow that matches the other box shadow in color but has a zero /// a box shadow that matches the other box shadow in color but has a zero
/// offset and a zero blurRadius. /// offset and a zero blurRadius.
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static BoxShadow lerp(BoxShadow a, BoxShadow b, double t) { static BoxShadow lerp(BoxShadow a, BoxShadow b, double t) {
assert(t != null); assert(t != null);
if (a == null && b == null) if (a == null && b == null)
...@@ -115,7 +115,7 @@ class BoxShadow { ...@@ -115,7 +115,7 @@ class BoxShadow {
/// ///
/// If the lists differ in length, excess items are lerped with null. /// If the lists differ in length, excess items are lerped with null.
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static List<BoxShadow> lerpList(List<BoxShadow> a, List<BoxShadow> b, double t) { static List<BoxShadow> lerpList(List<BoxShadow> a, List<BoxShadow> b, double t) {
assert(t != null); assert(t != null);
if (a == null && b == null) if (a == null && b == null)
......
...@@ -194,7 +194,7 @@ class HSVColor { ...@@ -194,7 +194,7 @@ class HSVColor {
/// that will interpolate from a transparent red and cycle through the hues to /// that will interpolate from a transparent red and cycle through the hues to
/// match the target color, regardless of what that color's hue is. /// match the target color, regardless of what that color's hue is.
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
/// ///
/// Values outside of the valid range for each channel will be clamped. /// Values outside of the valid range for each channel will be clamped.
static HSVColor lerp(HSVColor a, HSVColor b, double t) { static HSVColor lerp(HSVColor a, HSVColor b, double t) {
......
...@@ -124,7 +124,7 @@ abstract class Decoration extends Diagnosticable { ...@@ -124,7 +124,7 @@ abstract class Decoration extends Diagnosticable {
/// respectively to find a solution. If the two values can't directly be /// respectively to find a solution. If the two values can't directly be
/// interpolated, then the interpolation is done via null (at `t == 0.5`). /// interpolated, then the interpolation is done via null (at `t == 0.5`).
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static Decoration lerp(Decoration a, Decoration b, double t) { static Decoration lerp(Decoration a, Decoration b, double t) {
assert(t != null); assert(t != null);
if (a == null && b == null) if (a == null && b == null)
......
...@@ -190,7 +190,7 @@ abstract class EdgeInsetsGeometry { ...@@ -190,7 +190,7 @@ abstract class EdgeInsetsGeometry {
/// representing a combination of both is returned. That object can be turned /// representing a combination of both is returned. That object can be turned
/// into a concrete [EdgeInsets] using [resolve]. /// into a concrete [EdgeInsets] using [resolve].
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static EdgeInsetsGeometry lerp(EdgeInsetsGeometry a, EdgeInsetsGeometry b, double t) { static EdgeInsetsGeometry lerp(EdgeInsetsGeometry a, EdgeInsetsGeometry b, double t) {
assert(t != null); assert(t != null);
if (a == null && b == null) if (a == null && b == null)
...@@ -546,7 +546,7 @@ class EdgeInsets extends EdgeInsetsGeometry { ...@@ -546,7 +546,7 @@ class EdgeInsets extends EdgeInsetsGeometry {
/// ///
/// If either is null, this function interpolates from [EdgeInsets.zero]. /// If either is null, this function interpolates from [EdgeInsets.zero].
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static EdgeInsets lerp(EdgeInsets a, EdgeInsets b, double t) { static EdgeInsets lerp(EdgeInsets a, EdgeInsets b, double t) {
assert(t != null); assert(t != null);
if (a == null && b == null) if (a == null && b == null)
...@@ -770,7 +770,7 @@ class EdgeInsetsDirectional extends EdgeInsetsGeometry { ...@@ -770,7 +770,7 @@ class EdgeInsetsDirectional extends EdgeInsetsGeometry {
/// (either [EdgeInsets] or [EdgeInsetsDirectional]), consider the /// (either [EdgeInsets] or [EdgeInsetsDirectional]), consider the
/// [EdgeInsetsGeometry.lerp] static method. /// [EdgeInsetsGeometry.lerp] static method.
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static EdgeInsetsDirectional lerp(EdgeInsetsDirectional a, EdgeInsetsDirectional b, double t) { static EdgeInsetsDirectional lerp(EdgeInsetsDirectional a, EdgeInsetsDirectional b, double t) {
assert(t != null); assert(t != null);
if (a == null && b == null) if (a == null && b == null)
......
...@@ -127,7 +127,7 @@ class FlutterLogoDecoration extends Decoration { ...@@ -127,7 +127,7 @@ class FlutterLogoDecoration extends Decoration {
/// non-null value. If one of the values is null, then the result is obtained /// non-null value. If one of the values is null, then the result is obtained
/// by scaling the other value's opacity and [margin]. /// by scaling the other value's opacity and [margin].
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
/// ///
/// See also: /// See also:
/// ///
......
...@@ -178,7 +178,7 @@ class FractionalOffset extends Alignment { ...@@ -178,7 +178,7 @@ class FractionalOffset extends Alignment {
/// ///
/// If either is null, this function interpolates from [FractionalOffset.center]. /// If either is null, this function interpolates from [FractionalOffset.center].
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static FractionalOffset lerp(FractionalOffset a, FractionalOffset b, double t) { static FractionalOffset lerp(FractionalOffset a, FractionalOffset b, double t) {
assert(t != null); assert(t != null);
if (a == null && b == null) if (a == null && b == null)
......
...@@ -185,7 +185,19 @@ abstract class Gradient { ...@@ -185,7 +185,19 @@ abstract class Gradient {
/// function instead. If both return null, it returns `a` before `t == 0.5` /// function instead. If both return null, it returns `a` before `t == 0.5`
/// and `b` after `t == 0.5`. /// and `b` after `t == 0.5`.
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@template flutter.painting.gradient.lerp}
/// The `t` argument represents position on the timeline, with 0.0 meaning
/// that the interpolation has not started, returning `a` (or something
/// equivalent to `a`), 1.0 meaning that the interpolation has finished,
/// returning `b` (or something equivalent to `b`), and values in between
/// meaning that the interpolation is at the relevant point on the timeline
/// between `a` and `b`. The interpolation can be extrapolated beyond 0.0 and
/// 1.0, so negative values and values greater than 1.0 are valid (and can
/// easily be generated by curves such as [Curves.elasticInOut]).
///
/// Values for `t` are usually obtained from an [Animation<double>], such as
/// an [AnimationController].
/// {@endtemplate}
static Gradient lerp(Gradient a, Gradient b, double t) { static Gradient lerp(Gradient a, Gradient b, double t) {
assert(t != null); assert(t != null);
Gradient result; Gradient result;
......
...@@ -204,7 +204,7 @@ class ShapeDecoration extends Decoration { ...@@ -204,7 +204,7 @@ class ShapeDecoration extends Decoration {
/// fields are all null (including the [shape], which cannot normally be /// fields are all null (including the [shape], which cannot normally be
/// null). /// null).
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
/// ///
/// See also: /// See also:
/// ///
......
...@@ -558,7 +558,7 @@ class TextStyle extends Diagnosticable { ...@@ -558,7 +558,7 @@ class TextStyle extends Diagnosticable {
/// ///
/// This will not work well if the styles don't set the same fields. /// This will not work well if the styles don't set the same fields.
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
/// ///
/// If [foreground] is specified on either of `a` or `b`, both will be treated /// If [foreground] is specified on either of `a` or `b`, both will be treated
/// as if they have a [foreground] paint (creating a new [Paint] if necessary /// as if they have a [foreground] paint (creating a new [Paint] if necessary
......
...@@ -449,7 +449,7 @@ class BoxConstraints extends Constraints { ...@@ -449,7 +449,7 @@ class BoxConstraints extends Constraints {
/// If either is null, this function interpolates from a [BoxConstraints] /// If either is null, this function interpolates from a [BoxConstraints]
/// object whose fields are all set to 0.0. /// object whose fields are all set to 0.0.
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static BoxConstraints lerp(BoxConstraints a, BoxConstraints b, double t) { static BoxConstraints lerp(BoxConstraints a, BoxConstraints b, double t) {
assert(t != null); assert(t != null);
if (a == null && b == null) if (a == null && b == null)
......
...@@ -131,7 +131,7 @@ class RelativeRect { ...@@ -131,7 +131,7 @@ class RelativeRect {
/// ///
/// If either rect is null, this function interpolates from [RelativeRect.fill]. /// If either rect is null, this function interpolates from [RelativeRect.fill].
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static RelativeRect lerp(RelativeRect a, RelativeRect b, double t) { static RelativeRect lerp(RelativeRect a, RelativeRect b, double t) {
assert(t != null); assert(t != null);
if (a == null && b == null) if (a == null && b == null)
......
...@@ -147,7 +147,7 @@ class TableBorder { ...@@ -147,7 +147,7 @@ class TableBorder {
/// If a border is null, it is treated as having only [BorderSide.none] /// If a border is null, it is treated as having only [BorderSide.none]
/// borders. /// borders.
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static TableBorder lerp(TableBorder a, TableBorder b, double t) { static TableBorder lerp(TableBorder a, TableBorder b, double t) {
assert(t != null); assert(t != null);
if (a == null && b == null) if (a == null && b == null)
......
...@@ -68,7 +68,7 @@ class IconThemeData extends Diagnosticable { ...@@ -68,7 +68,7 @@ class IconThemeData extends Diagnosticable {
/// Linearly interpolate between two icon theme data objects. /// Linearly interpolate between two icon theme data objects.
/// ///
/// {@macro flutter.material.themeData.lerp} /// {@macro flutter.painting.gradient.lerp}
static IconThemeData lerp(IconThemeData a, IconThemeData b, double t) { static IconThemeData lerp(IconThemeData a, IconThemeData b, double t) {
assert(t != null); assert(t != null);
return IconThemeData( return IconThemeData(
......
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