diff --git a/bin/internal/engine.version b/bin/internal/engine.version index b0bb6c1901..34c132c41b 100644 --- a/bin/internal/engine.version +++ b/bin/internal/engine.version @@ -1 +1 @@ -50c2e69daff4e207c54e463d2304139985c7511c +32f417db0d566d354605305cb29c251276fa65ee diff --git a/bin/internal/goldens.version b/bin/internal/goldens.version index bed3406676..d016c8d618 100644 --- a/bin/internal/goldens.version +++ b/bin/internal/goldens.version @@ -1 +1 @@ -fcb6a6cad08bd4a7d5c0157b9f83acadfa9be7e3 +bf46dc6b05154649926392e0fc042289e6172ca7 diff --git a/packages/flutter/lib/painting.dart b/packages/flutter/lib/painting.dart index 7ca486a619..55894da6ca 100644 --- a/packages/flutter/lib/painting.dart +++ b/packages/flutter/lib/painting.dart @@ -17,6 +17,8 @@ /// painting boxes. library painting; +export 'dart:ui' show Shadow; + export 'src/painting/alignment.dart'; export 'src/painting/basic_types.dart'; export 'src/painting/beveled_rectangle_border.dart'; diff --git a/packages/flutter/lib/src/material/chip_theme.dart b/packages/flutter/lib/src/material/chip_theme.dart index 71d9ab7297..f530dc655d 100644 --- a/packages/flutter/lib/src/material/chip_theme.dart +++ b/packages/flutter/lib/src/material/chip_theme.dart @@ -360,7 +360,7 @@ class ChipThemeData extends Diagnosticable { /// /// The arguments must not be null. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static ChipThemeData lerp(ChipThemeData a, ChipThemeData b, double t) { assert(t != null); if (a == null && b == null) diff --git a/packages/flutter/lib/src/material/slider_theme.dart b/packages/flutter/lib/src/material/slider_theme.dart index 44d8c1df45..73bcfe600c 100644 --- a/packages/flutter/lib/src/material/slider_theme.dart +++ b/packages/flutter/lib/src/material/slider_theme.dart @@ -391,7 +391,7 @@ class SliderThemeData extends Diagnosticable { /// /// The arguments must not be null. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static SliderThemeData lerp(SliderThemeData a, SliderThemeData b, double t) { assert(a != null); assert(b != null); diff --git a/packages/flutter/lib/src/material/tab_bar_theme.dart b/packages/flutter/lib/src/material/tab_bar_theme.dart index f9be2c7b11..08414bfd2d 100644 --- a/packages/flutter/lib/src/material/tab_bar_theme.dart +++ b/packages/flutter/lib/src/material/tab_bar_theme.dart @@ -63,7 +63,7 @@ class TabBarTheme extends Diagnosticable { /// /// The arguments must not be null. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static TabBarTheme lerp(TabBarTheme a, TabBarTheme b, double t) { assert(a != null); assert(b != null); diff --git a/packages/flutter/lib/src/material/theme_data.dart b/packages/flutter/lib/src/material/theme_data.dart index e6639e2912..ef011666bf 100644 --- a/packages/flutter/lib/src/material/theme_data.dart +++ b/packages/flutter/lib/src/material/theme_data.dart @@ -787,7 +787,7 @@ class ThemeData extends Diagnosticable { /// /// The arguments must not be null. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static ThemeData lerp(ThemeData a, ThemeData b, double t) { assert(a != null); assert(b != null); diff --git a/packages/flutter/lib/src/material/typography.dart b/packages/flutter/lib/src/material/typography.dart index baa49d9229..bf867b64b5 100644 --- a/packages/flutter/lib/src/material/typography.dart +++ b/packages/flutter/lib/src/material/typography.dart @@ -212,7 +212,7 @@ class Typography extends Diagnosticable { /// Linearly interpolate between two [Typography] objects. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static Typography lerp(Typography a, Typography b, double t) { return Typography( black: TextTheme.lerp(a.black, b.black, t), diff --git a/packages/flutter/lib/src/painting/alignment.dart b/packages/flutter/lib/src/painting/alignment.dart index 007348edc6..21ffcd608b 100644 --- a/packages/flutter/lib/src/painting/alignment.dart +++ b/packages/flutter/lib/src/painting/alignment.dart @@ -85,7 +85,7 @@ abstract class AlignmentGeometry { /// representing a combination of both is returned. That object can be turned /// into a concrete [Alignment] using [resolve]. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static AlignmentGeometry lerp(AlignmentGeometry a, AlignmentGeometry b, double t) { assert(t != null); if (a == null && b == null) @@ -324,7 +324,7 @@ class Alignment extends AlignmentGeometry { /// /// If either is null, this function interpolates from [Alignment.center]. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static Alignment lerp(Alignment a, Alignment b, double t) { assert(t != null); if (a == null && b == null) @@ -505,7 +505,7 @@ class AlignmentDirectional extends AlignmentGeometry { /// /// If either is null, this function interpolates from [AlignmentDirectional.center]. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static AlignmentDirectional lerp(AlignmentDirectional a, AlignmentDirectional b, double t) { assert(t != null); if (a == null && b == null) diff --git a/packages/flutter/lib/src/painting/border_radius.dart b/packages/flutter/lib/src/painting/border_radius.dart index 8ee074ffb0..a64fd7dbd4 100644 --- a/packages/flutter/lib/src/painting/border_radius.dart +++ b/packages/flutter/lib/src/painting/border_radius.dart @@ -127,7 +127,7 @@ abstract class BorderRadiusGeometry { /// representing a combination of both is returned. That object can be turned /// into a concrete [BorderRadius] using [resolve]. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static BorderRadiusGeometry lerp(BorderRadiusGeometry a, BorderRadiusGeometry b, double t) { assert(t != null); if (a == null && b == null) @@ -471,7 +471,7 @@ class BorderRadius extends BorderRadiusGeometry { /// /// If either is null, this function interpolates from [BorderRadius.zero]. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static BorderRadius lerp(BorderRadius a, BorderRadius b, double t) { assert(t != null); if (a == null && b == null) @@ -688,7 +688,7 @@ class BorderRadiusDirectional extends BorderRadiusGeometry { /// /// If either is null, this function interpolates from [BorderRadiusDirectional.zero]. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static BorderRadiusDirectional lerp(BorderRadiusDirectional a, BorderRadiusDirectional b, double t) { assert(t != null); if (a == null && b == null) diff --git a/packages/flutter/lib/src/painting/borders.dart b/packages/flutter/lib/src/painting/borders.dart index 9e9f309eb9..c3eff32920 100644 --- a/packages/flutter/lib/src/painting/borders.dart +++ b/packages/flutter/lib/src/painting/borders.dart @@ -198,7 +198,7 @@ class BorderSide { /// /// The arguments must not be null. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static BorderSide lerp(BorderSide a, BorderSide b, double t) { assert(a != null); assert(b != null); @@ -404,7 +404,7 @@ abstract class ShapeBorder { /// function instead. If both return null, it returns `a` before `t=0.5` /// and `b` after `t=0.5`. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static ShapeBorder lerp(ShapeBorder a, ShapeBorder b, double t) { assert(t != null); ShapeBorder result; diff --git a/packages/flutter/lib/src/painting/box_border.dart b/packages/flutter/lib/src/painting/box_border.dart index aeaeb57910..fea4765764 100644 --- a/packages/flutter/lib/src/painting/box_border.dart +++ b/packages/flutter/lib/src/painting/box_border.dart @@ -98,7 +98,7 @@ abstract class BoxBorder extends ShapeBorder { /// For a more flexible approach, consider [ShapeBorder.lerp], which would /// instead [add] the two sets of sides and interpolate them simultaneously. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static BoxBorder lerp(BoxBorder a, BoxBorder b, double t) { assert(t != null); if ((a is Border || a == null) && (b is Border || b == null)) @@ -421,7 +421,7 @@ class Border extends BoxBorder { /// If a border is null, it is treated as having four [BorderSide.none] /// borders. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static Border lerp(Border a, Border b, double t) { assert(t != null); if (a == null && b == null) @@ -711,7 +711,7 @@ class BorderDirectional extends BoxBorder { /// If a border is null, it is treated as having four [BorderSide.none] /// borders. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static BorderDirectional lerp(BorderDirectional a, BorderDirectional b, double t) { assert(t != null); if (a == null && b == null) diff --git a/packages/flutter/lib/src/painting/box_decoration.dart b/packages/flutter/lib/src/painting/box_decoration.dart index 90a7e374b9..daf80b2ec0 100644 --- a/packages/flutter/lib/src/painting/box_decoration.dart +++ b/packages/flutter/lib/src/painting/box_decoration.dart @@ -215,7 +215,7 @@ class BoxDecoration extends Decoration { /// unmodified. Otherwise, the values are computed by interpolating the /// properties appropriately. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} /// /// See also: /// diff --git a/packages/flutter/lib/src/painting/box_shadow.dart b/packages/flutter/lib/src/painting/box_shadow.dart index e707b7ecaa..f0cb446728 100644 --- a/packages/flutter/lib/src/painting/box_shadow.dart +++ b/packages/flutter/lib/src/painting/box_shadow.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'dart:math' as math; -import 'dart:ui' as ui show lerpDouble; +import 'dart:ui' as ui show Shadow, lerpDouble; import 'package:flutter/foundation.dart'; @@ -12,6 +12,8 @@ import 'debug.dart'; /// A shadow cast by a box. /// +/// Inherits from [Shadow] +/// /// [BoxShadow] can cast non-rectangular shadows if the box is non-rectangular /// (e.g., has a border radius or a circular shape). /// @@ -20,52 +22,30 @@ import 'debug.dart'; /// See also: /// /// * [Canvas.drawShadow], which is a more efficient way to draw shadows. +/// * [Shadow], which is the parent class that lacks [spreadRadius]. @immutable -class BoxShadow { +class BoxShadow extends ui.Shadow { /// Creates a box shadow. /// /// By default, the shadow is solid black with zero [offset], [blurRadius], /// and [spreadRadius]. const BoxShadow({ - this.color = const Color(0xFF000000), - this.offset = Offset.zero, - this.blurRadius = 0.0, + Color color = const Color(0xFF000000), + Offset offset = Offset.zero, + double blurRadius = 0.0, this.spreadRadius = 0.0 - }); - - /// The color of the shadow. - final Color color; - - /// The displacement of the shadow from the box. - final Offset offset; - - /// The standard deviation of the Gaussian to convolve with the box's shape. - final double blurRadius; + }) : super(color: color, offset: offset, blurRadius: blurRadius); /// The amount the box should be inflated prior to applying the blur. final double spreadRadius; - /// Converts a blur radius in pixels to sigmas. - /// - /// See the sigma argument to [MaskFilter.blur]. - // - // See SkBlurMask::ConvertRadiusToSigma(). - // - static double convertRadiusToSigma(double radius) { - return radius * 0.57735 + 0.5; - } - - /// The [blurRadius] in sigmas instead of logical pixels. - /// - /// See the sigma argument to [MaskFilter.blur]. - double get blurSigma => convertRadiusToSigma(blurRadius); - /// Create the [Paint] object that corresponds to this shadow description. /// /// The [offset] and [spreadRadius] are not represented in the [Paint] object. /// To honor those as well, the shape should be inflated by [spreadRadius] pixels /// in every direction and then translated by [offset] before being filled using /// this [Paint]. + @override Paint toPaint() { final Paint result = Paint() ..color = color @@ -79,6 +59,7 @@ class BoxShadow { } /// Returns a new box shadow with its offset, blurRadius, and spreadRadius scaled by the given factor. + @override BoxShadow scale(double factor) { return BoxShadow( color: color, @@ -94,7 +75,7 @@ class BoxShadow { /// a box shadow that matches the other box shadow in color but has a zero /// offset and a zero blurRadius. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static BoxShadow lerp(BoxShadow a, BoxShadow b, double t) { assert(t != null); if (a == null && b == null) @@ -115,7 +96,7 @@ class BoxShadow { /// /// If the lists differ in length, excess items are lerped with null. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static List lerpList(List a, List b, double t) { assert(t != null); if (a == null && b == null) diff --git a/packages/flutter/lib/src/painting/colors.dart b/packages/flutter/lib/src/painting/colors.dart index 39928f6098..a090400d99 100644 --- a/packages/flutter/lib/src/painting/colors.dart +++ b/packages/flutter/lib/src/painting/colors.dart @@ -194,7 +194,7 @@ class HSVColor { /// 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. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} /// /// Values outside of the valid range for each channel will be clamped. static HSVColor lerp(HSVColor a, HSVColor b, double t) { diff --git a/packages/flutter/lib/src/painting/decoration.dart b/packages/flutter/lib/src/painting/decoration.dart index 4141870cd1..4c5cc2dff5 100644 --- a/packages/flutter/lib/src/painting/decoration.dart +++ b/packages/flutter/lib/src/painting/decoration.dart @@ -124,7 +124,7 @@ abstract class Decoration extends Diagnosticable { /// 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`). /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static Decoration lerp(Decoration a, Decoration b, double t) { assert(t != null); if (a == null && b == null) diff --git a/packages/flutter/lib/src/painting/edge_insets.dart b/packages/flutter/lib/src/painting/edge_insets.dart index f0347b1c00..896361917c 100644 --- a/packages/flutter/lib/src/painting/edge_insets.dart +++ b/packages/flutter/lib/src/painting/edge_insets.dart @@ -190,7 +190,7 @@ abstract class EdgeInsetsGeometry { /// representing a combination of both is returned. That object can be turned /// into a concrete [EdgeInsets] using [resolve]. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static EdgeInsetsGeometry lerp(EdgeInsetsGeometry a, EdgeInsetsGeometry b, double t) { assert(t != null); if (a == null && b == null) @@ -546,7 +546,7 @@ class EdgeInsets extends EdgeInsetsGeometry { /// /// If either is null, this function interpolates from [EdgeInsets.zero]. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static EdgeInsets lerp(EdgeInsets a, EdgeInsets b, double t) { assert(t != null); if (a == null && b == null) @@ -770,7 +770,7 @@ class EdgeInsetsDirectional extends EdgeInsetsGeometry { /// (either [EdgeInsets] or [EdgeInsetsDirectional]), consider the /// [EdgeInsetsGeometry.lerp] static method. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static EdgeInsetsDirectional lerp(EdgeInsetsDirectional a, EdgeInsetsDirectional b, double t) { assert(t != null); if (a == null && b == null) diff --git a/packages/flutter/lib/src/painting/flutter_logo.dart b/packages/flutter/lib/src/painting/flutter_logo.dart index 8ec0627a63..44a67b66b4 100644 --- a/packages/flutter/lib/src/painting/flutter_logo.dart +++ b/packages/flutter/lib/src/painting/flutter_logo.dart @@ -127,7 +127,7 @@ class FlutterLogoDecoration extends Decoration { /// non-null value. If one of the values is null, then the result is obtained /// by scaling the other value's opacity and [margin]. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} /// /// See also: /// diff --git a/packages/flutter/lib/src/painting/fractional_offset.dart b/packages/flutter/lib/src/painting/fractional_offset.dart index c957085035..247b5d265b 100644 --- a/packages/flutter/lib/src/painting/fractional_offset.dart +++ b/packages/flutter/lib/src/painting/fractional_offset.dart @@ -178,7 +178,7 @@ class FractionalOffset extends Alignment { /// /// If either is null, this function interpolates from [FractionalOffset.center]. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static FractionalOffset lerp(FractionalOffset a, FractionalOffset b, double t) { assert(t != null); if (a == null && b == null) diff --git a/packages/flutter/lib/src/painting/gradient.dart b/packages/flutter/lib/src/painting/gradient.dart index 18b2185ca9..d765f54636 100644 --- a/packages/flutter/lib/src/painting/gradient.dart +++ b/packages/flutter/lib/src/painting/gradient.dart @@ -185,19 +185,7 @@ abstract class Gradient { /// function instead. If both return null, it returns `a` before `t == 0.5` /// and `b` after `t == 0.5`. /// - /// {@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], such as - /// an [AnimationController]. - /// {@endtemplate} + /// {@macro dart.ui.shadow.lerp} static Gradient lerp(Gradient a, Gradient b, double t) { assert(t != null); Gradient result; diff --git a/packages/flutter/lib/src/painting/shape_decoration.dart b/packages/flutter/lib/src/painting/shape_decoration.dart index 880dac84f8..76a2a7018e 100644 --- a/packages/flutter/lib/src/painting/shape_decoration.dart +++ b/packages/flutter/lib/src/painting/shape_decoration.dart @@ -204,7 +204,7 @@ class ShapeDecoration extends Decoration { /// fields are all null (including the [shape], which cannot normally be /// null). /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} /// /// See also: /// diff --git a/packages/flutter/lib/src/painting/text_style.dart b/packages/flutter/lib/src/painting/text_style.dart index a8748e10b2..6b27a01ae0 100644 --- a/packages/flutter/lib/src/painting/text_style.dart +++ b/packages/flutter/lib/src/painting/text_style.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' as ui show ParagraphStyle, TextStyle, lerpDouble; +import 'dart:ui' as ui show ParagraphStyle, TextStyle, lerpDouble, Shadow; import 'package:flutter/foundation.dart'; @@ -238,6 +238,7 @@ class TextStyle extends Diagnosticable { this.locale, this.foreground, this.background, + this.shadows, this.decoration, this.decorationColor, this.decorationStyle, @@ -368,6 +369,15 @@ class TextStyle extends Diagnosticable { /// [compareTo], and it does not affect [hashCode]. final String debugLabel; + /// A list of [Shadow]s that will be painted underneath the text. + /// + /// Multiple shadows are supported to replicate lighting from multiple light + /// sources. + /// + /// Shadows must be in the same order for [TextStyle] to be considered as + /// equivalent as order produces differing transparency. + final List shadows; + /// Creates a copy of this text style but with the given fields replaced with /// the new values. /// @@ -386,6 +396,7 @@ class TextStyle extends Diagnosticable { Locale locale, Paint foreground, Paint background, + List shadows, TextDecoration decoration, Color decorationColor, TextDecorationStyle decorationStyle, @@ -412,6 +423,7 @@ class TextStyle extends Diagnosticable { locale: locale ?? this.locale, foreground: foreground ?? this.foreground, background: background ?? this.background, + shadows: shadows ?? this.shadows, decoration: decoration ?? this.decoration, decorationColor: decorationColor ?? this.decorationColor, decorationStyle: decorationStyle ?? this.decorationStyle, @@ -497,6 +509,7 @@ class TextStyle extends Diagnosticable { locale: locale, foreground: foreground != null ? foreground : null, background: background, + shadows: shadows, decoration: decoration ?? this.decoration, decorationColor: decorationColor ?? this.decorationColor, decorationStyle: decorationStyle ?? this.decorationStyle, @@ -547,6 +560,7 @@ class TextStyle extends Diagnosticable { locale: other.locale, foreground: other.foreground, background: other.background, + shadows: other.shadows, decoration: other.decoration, decorationColor: other.decorationColor, decorationStyle: other.decorationStyle, @@ -558,7 +572,7 @@ class TextStyle extends Diagnosticable { /// /// This will not work well if the styles don't set the same fields. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} /// /// 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 @@ -592,6 +606,7 @@ class TextStyle extends Diagnosticable { foreground: t < 0.5 ? null : b.foreground, background: t < 0.5 ? null : b.background, decoration: t < 0.5 ? null : b.decoration, + shadows: t < 0.5 ? null : b.shadows, decorationColor: Color.lerp(null, b.decorationColor, t), decorationStyle: t < 0.5 ? null : b.decorationStyle, debugLabel: lerpDebugLabel, @@ -613,6 +628,7 @@ class TextStyle extends Diagnosticable { locale: t < 0.5 ? a.locale : null, foreground: t < 0.5 ? a.foreground : null, background: t < 0.5 ? a.background : null, + shadows: t < 0.5 ? a.shadows : null, decoration: t < 0.5 ? a.decoration : null, decorationColor: Color.lerp(a.decorationColor, null, t), decorationStyle: t < 0.5 ? a.decorationStyle : null, @@ -638,6 +654,7 @@ class TextStyle extends Diagnosticable { : b.foreground ?? (Paint()..color = b.color) : null, background: t < 0.5 ? a.background : b.background, + shadows: t < 0.5 ? a.shadows : b.shadows, decoration: t < 0.5 ? a.decoration : b.decoration, decorationColor: Color.lerp(a.decorationColor, b.decorationColor, t), decorationStyle: t < 0.5 ? a.decorationStyle : b.decorationStyle, @@ -663,6 +680,7 @@ class TextStyle extends Diagnosticable { locale: locale, foreground: foreground, background: background, + shadows: shadows, ); } @@ -718,7 +736,8 @@ class TextStyle extends Diagnosticable { height != other.height || locale != other.locale || foreground != other.foreground || - background != other.background) + background != other.background || + !listEquals(shadows, other.shadows)) return RenderComparison.layout; if (color != other.color || decoration != other.decoration || @@ -750,7 +769,8 @@ class TextStyle extends Diagnosticable { background == typedOther.background && decoration == typedOther.decoration && decorationColor == typedOther.decorationColor && - decorationStyle == typedOther.decorationStyle; + decorationStyle == typedOther.decorationStyle && + listEquals(shadows, typedOther.shadows); } @override @@ -771,7 +791,8 @@ class TextStyle extends Diagnosticable { background, decoration, decorationColor, - decorationStyle + decorationStyle, + shadows ); } diff --git a/packages/flutter/lib/src/rendering/box.dart b/packages/flutter/lib/src/rendering/box.dart index ad4ecee389..0614c7312d 100644 --- a/packages/flutter/lib/src/rendering/box.dart +++ b/packages/flutter/lib/src/rendering/box.dart @@ -449,7 +449,7 @@ class BoxConstraints extends Constraints { /// If either is null, this function interpolates from a [BoxConstraints] /// object whose fields are all set to 0.0. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static BoxConstraints lerp(BoxConstraints a, BoxConstraints b, double t) { assert(t != null); if (a == null && b == null) diff --git a/packages/flutter/lib/src/rendering/stack.dart b/packages/flutter/lib/src/rendering/stack.dart index 9712d1593c..c039eee8ad 100644 --- a/packages/flutter/lib/src/rendering/stack.dart +++ b/packages/flutter/lib/src/rendering/stack.dart @@ -131,7 +131,7 @@ class RelativeRect { /// /// If either rect is null, this function interpolates from [RelativeRect.fill]. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static RelativeRect lerp(RelativeRect a, RelativeRect b, double t) { assert(t != null); if (a == null && b == null) diff --git a/packages/flutter/lib/src/rendering/table_border.dart b/packages/flutter/lib/src/rendering/table_border.dart index 5c471a7860..5913025b0d 100644 --- a/packages/flutter/lib/src/rendering/table_border.dart +++ b/packages/flutter/lib/src/rendering/table_border.dart @@ -147,7 +147,7 @@ class TableBorder { /// If a border is null, it is treated as having only [BorderSide.none] /// borders. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static TableBorder lerp(TableBorder a, TableBorder b, double t) { assert(t != null); if (a == null && b == null) diff --git a/packages/flutter/lib/src/widgets/icon_theme_data.dart b/packages/flutter/lib/src/widgets/icon_theme_data.dart index 7df1d4f3cc..676b422738 100644 --- a/packages/flutter/lib/src/widgets/icon_theme_data.dart +++ b/packages/flutter/lib/src/widgets/icon_theme_data.dart @@ -68,7 +68,7 @@ class IconThemeData extends Diagnosticable { /// Linearly interpolate between two icon theme data objects. /// - /// {@macro flutter.painting.gradient.lerp} + /// {@macro dart.ui.shadow.lerp} static IconThemeData lerp(IconThemeData a, IconThemeData b, double t) { assert(t != null); return IconThemeData( diff --git a/packages/flutter/test/material/theme_test.dart b/packages/flutter/test/material/theme_test.dart index b4a2872b7d..be9ec5b646 100644 --- a/packages/flutter/test/material/theme_test.dart +++ b/packages/flutter/test/material/theme_test.dart @@ -460,6 +460,7 @@ class _TextStyleProxy implements TextStyle { @override double get letterSpacing => _delegate.letterSpacing; @override TextBaseline get textBaseline => _delegate.textBaseline; @override double get wordSpacing => _delegate.wordSpacing; + @override List get shadows => _delegate.shadows; @override String toString({DiagnosticLevel minLevel = DiagnosticLevel.debug}) => @@ -486,7 +487,7 @@ class _TextStyleProxy implements TextStyle { } @override - TextStyle copyWith({Color color, String fontFamily, double fontSize, FontWeight fontWeight, FontStyle fontStyle, double letterSpacing, double wordSpacing, TextBaseline textBaseline, double height, Locale locale, ui.Paint foreground, ui.Paint background, TextDecoration decoration, Color decorationColor, TextDecorationStyle decorationStyle, String debugLabel}) { + TextStyle copyWith({Color color, String fontFamily, double fontSize, FontWeight fontWeight, FontStyle fontStyle, double letterSpacing, double wordSpacing, TextBaseline textBaseline, double height, Locale locale, ui.Paint foreground, ui.Paint background, List shadows, TextDecoration decoration, Color decorationColor, TextDecorationStyle decorationStyle, String debugLabel}) { throw UnimplementedError(); } diff --git a/packages/flutter/test/painting/text_style_test.dart b/packages/flutter/test/painting/text_style_test.dart index 61e4433414..b26064452d 100644 --- a/packages/flutter/test/painting/text_style_test.dart +++ b/packages/flutter/test/painting/text_style_test.dart @@ -163,10 +163,10 @@ void main() { final ui.TextStyle ts5 = s5.getTextStyle(); expect(ts5, equals(ui.TextStyle(fontWeight: FontWeight.w700, fontSize: 12.0, height: 123.0))); - expect(ts5.toString(), 'TextStyle(color: unspecified, decoration: unspecified, decorationColor: unspecified, decorationStyle: unspecified, fontWeight: FontWeight.w700, fontStyle: unspecified, textBaseline: unspecified, fontFamily: unspecified, fontSize: 12.0, letterSpacing: unspecified, wordSpacing: unspecified, height: 123.0x, locale: unspecified, background: unspecified, foreground: unspecified)'); + expect(ts5.toString(), 'TextStyle(color: unspecified, decoration: unspecified, decorationColor: unspecified, decorationStyle: unspecified, fontWeight: FontWeight.w700, fontStyle: unspecified, textBaseline: unspecified, fontFamily: unspecified, fontSize: 12.0, letterSpacing: unspecified, wordSpacing: unspecified, height: 123.0x, locale: unspecified, background: unspecified, foreground: unspecified, shadows: unspecified)'); final ui.TextStyle ts2 = s2.getTextStyle(); expect(ts2, equals(ui.TextStyle(color: const Color(0xFF00FF00), fontWeight: FontWeight.w800, fontSize: 10.0, height: 100.0))); - expect(ts2.toString(), 'TextStyle(color: Color(0xff00ff00), decoration: unspecified, decorationColor: unspecified, decorationStyle: unspecified, fontWeight: FontWeight.w800, fontStyle: unspecified, textBaseline: unspecified, fontFamily: unspecified, fontSize: 10.0, letterSpacing: unspecified, wordSpacing: unspecified, height: 100.0x, locale: unspecified, background: unspecified, foreground: unspecified)'); + expect(ts2.toString(), 'TextStyle(color: Color(0xff00ff00), decoration: unspecified, decorationColor: unspecified, decorationStyle: unspecified, fontWeight: FontWeight.w800, fontStyle: unspecified, textBaseline: unspecified, fontFamily: unspecified, fontSize: 10.0, letterSpacing: unspecified, wordSpacing: unspecified, height: 100.0x, locale: unspecified, background: unspecified, foreground: unspecified, shadows: unspecified)'); final ui.ParagraphStyle ps2 = s2.getParagraphStyle(textAlign: TextAlign.center); expect(ps2, equals(ui.ParagraphStyle(textAlign: TextAlign.center, fontWeight: FontWeight.w800, fontSize: 10.0, lineHeight: 100.0))); @@ -189,11 +189,11 @@ void main() { test('TextStyle using package font', () { const TextStyle s6 = TextStyle(fontFamily: 'test'); expect(s6.fontFamily, 'test'); - expect(s6.getTextStyle().toString(), 'TextStyle(color: unspecified, decoration: unspecified, decorationColor: unspecified, decorationStyle: unspecified, fontWeight: unspecified, fontStyle: unspecified, textBaseline: unspecified, fontFamily: test, fontSize: unspecified, letterSpacing: unspecified, wordSpacing: unspecified, height: unspecified, locale: unspecified, background: unspecified, foreground: unspecified)'); + expect(s6.getTextStyle().toString(), 'TextStyle(color: unspecified, decoration: unspecified, decorationColor: unspecified, decorationStyle: unspecified, fontWeight: unspecified, fontStyle: unspecified, textBaseline: unspecified, fontFamily: test, fontSize: unspecified, letterSpacing: unspecified, wordSpacing: unspecified, height: unspecified, locale: unspecified, background: unspecified, foreground: unspecified, shadows: unspecified)'); const TextStyle s7 = TextStyle(fontFamily: 'test', package: 'p'); expect(s7.fontFamily, 'packages/p/test'); - expect(s7.getTextStyle().toString(), 'TextStyle(color: unspecified, decoration: unspecified, decorationColor: unspecified, decorationStyle: unspecified, fontWeight: unspecified, fontStyle: unspecified, textBaseline: unspecified, fontFamily: packages/p/test, fontSize: unspecified, letterSpacing: unspecified, wordSpacing: unspecified, height: unspecified, locale: unspecified, background: unspecified, foreground: unspecified)'); + expect(s7.getTextStyle().toString(), 'TextStyle(color: unspecified, decoration: unspecified, decorationColor: unspecified, decorationStyle: unspecified, fontWeight: unspecified, fontStyle: unspecified, textBaseline: unspecified, fontFamily: packages/p/test, fontSize: unspecified, letterSpacing: unspecified, wordSpacing: unspecified, height: unspecified, locale: unspecified, background: unspecified, foreground: unspecified, shadows: unspecified)'); }); test('TextStyle.debugLabel', () { diff --git a/packages/flutter_test/test/reference_image_test.dart b/packages/flutter_test/test/reference_image_test.dart index 5e97180e85..9322164be9 100644 --- a/packages/flutter_test/test/reference_image_test.dart +++ b/packages/flutter_test/test/reference_image_test.dart @@ -57,7 +57,7 @@ void main() { testWidgets('when image pixels do not match', (WidgetTester tester) async { expect( await matchesReferenceImage(createTestImage(100, 100, red)).matchAsync(createTestImage(100, 100, transparentRed)), - equals('does not match on 53 pixels'), + equals('does not match on 57 pixels'), ); expect( await matchesReferenceImage(createTestImage(100, 100, red)).matchAsync(createTestImage(100, 100, green)),