diff --git a/examples/api/lib/ui/text/font_feature.0.dart b/examples/api/lib/ui/text/font_feature.0.dart index 5ef2f863a9..cc657cf128 100644 --- a/examples/api/lib/ui/text/font_feature.0.dart +++ b/examples/api/lib/ui/text/font_feature.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/material.dart'; /// Flutter code sample for [FontFeature]. diff --git a/examples/api/lib/ui/text/font_feature.font_feature_alternative.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_alternative.0.dart index 5207173d79..95491a10a9 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_alternative.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_alternative.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/widgets.dart'; /// Flutter code sample for [FontFeature.FontFeature.alternative]. diff --git a/examples/api/lib/ui/text/font_feature.font_feature_alternative_fractions.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_alternative_fractions.0.dart index 2ca48e219f..62e3659705 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_alternative_fractions.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_alternative_fractions.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/widgets.dart'; /// Flutter code sample for [FontFeature.FontFeature.alternativeFractions]. diff --git a/examples/api/lib/ui/text/font_feature.font_feature_case_sensitive_forms.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_case_sensitive_forms.0.dart index 52df814417..8ad787769d 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_case_sensitive_forms.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_case_sensitive_forms.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/widgets.dart'; /// Flutter code sample for [FontFeature.FontFeature.caseSensitiveForms]. diff --git a/examples/api/lib/ui/text/font_feature.font_feature_character_variant.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_character_variant.0.dart index f746d50b32..0acf1621fa 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_character_variant.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_character_variant.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/widgets.dart'; /// Flutter code sample for [FontFeature.FontFeature.characterVariant]. diff --git a/examples/api/lib/ui/text/font_feature.font_feature_contextual_alternates.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_contextual_alternates.0.dart index cd3654b10a..f71d8f3b18 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_contextual_alternates.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_contextual_alternates.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/widgets.dart'; /// Flutter code sample for [FontFeature.FontFeature.contextualAlternates]. diff --git a/examples/api/lib/ui/text/font_feature.font_feature_denominator.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_denominator.0.dart index 9097b25949..e62a9dd267 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_denominator.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_denominator.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/widgets.dart'; /// Flutter code sample for [FontFeature.FontFeature.denominator]. diff --git a/examples/api/lib/ui/text/font_feature.font_feature_fractions.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_fractions.0.dart index 01433db86a..c77c679dc6 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_fractions.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_fractions.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/widgets.dart'; /// Flutter code sample for [FontFeature.FontFeature.fractions]. diff --git a/examples/api/lib/ui/text/font_feature.font_feature_historical_forms.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_historical_forms.0.dart index a821dcce95..3de92ab698 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_historical_forms.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_historical_forms.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/widgets.dart'; /// Flutter code sample for [FontFeature.FontFeature.historicalForms]. diff --git a/examples/api/lib/ui/text/font_feature.font_feature_historical_ligatures.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_historical_ligatures.0.dart index 039dbca3bd..9418c31d21 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_historical_ligatures.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_historical_ligatures.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/widgets.dart'; /// Flutter code sample for [FontFeature.FontFeature.historicalLigatures]. diff --git a/examples/api/lib/ui/text/font_feature.font_feature_lining_figures.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_lining_figures.0.dart index 88515101e1..3a82a31533 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_lining_figures.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_lining_figures.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/widgets.dart'; /// Flutter code sample for [FontFeature.FontFeature.liningFigures]. diff --git a/examples/api/lib/ui/text/font_feature.font_feature_notational_forms.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_notational_forms.0.dart index 562e5e0bb4..42e1354d8f 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_notational_forms.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_notational_forms.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/widgets.dart'; /// Flutter code sample for [FontFeature.FontFeature.notationalForms]. diff --git a/examples/api/lib/ui/text/font_feature.font_feature_numerators.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_numerators.0.dart index 213bf8e9cf..c16efd0b1b 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_numerators.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_numerators.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/widgets.dart'; /// Flutter code sample for [FontFeature.FontFeature.numerators]. diff --git a/examples/api/lib/ui/text/font_feature.font_feature_oldstyle_figures.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_oldstyle_figures.0.dart index 7de9126044..9649d0f2b2 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_oldstyle_figures.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_oldstyle_figures.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/widgets.dart'; /// Flutter code sample for [FontFeature.FontFeature.oldstyleFigures]. diff --git a/examples/api/lib/ui/text/font_feature.font_feature_ordinal_forms.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_ordinal_forms.0.dart index 20b6720c93..dbec73a097 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_ordinal_forms.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_ordinal_forms.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/widgets.dart'; /// Flutter code sample for [FontFeature.FontFeature.ordinalForms]. diff --git a/examples/api/lib/ui/text/font_feature.font_feature_proportional_figures.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_proportional_figures.0.dart index aaa15f5524..283f747f79 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_proportional_figures.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_proportional_figures.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/widgets.dart'; /// Flutter code sample for [FontFeature.FontFeature.proportionalFigures]. diff --git a/examples/api/lib/ui/text/font_feature.font_feature_scientific_inferiors.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_scientific_inferiors.0.dart index b17115dfe8..a9f63f14d9 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_scientific_inferiors.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_scientific_inferiors.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/widgets.dart'; /// Flutter code sample for [FontFeature.FontFeature.scientificInferiors]. diff --git a/examples/api/lib/ui/text/font_feature.font_feature_slashed_zero.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_slashed_zero.0.dart index 105a1f494c..44bcbfa4df 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_slashed_zero.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_slashed_zero.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/widgets.dart'; /// Flutter code sample for [FontFeature.FontFeature.slashedZero]. diff --git a/examples/api/lib/ui/text/font_feature.font_feature_stylistic_alternates.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_stylistic_alternates.0.dart index b9f5e67e86..021320b806 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_stylistic_alternates.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_stylistic_alternates.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/widgets.dart'; /// Flutter code sample for [FontFeature.FontFeature.stylisticAlternates]. diff --git a/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.0.dart index 812c55900d..23699b963b 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/widgets.dart'; /// Flutter code sample for [FontFeature.FontFeature.stylisticSet]. diff --git a/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.1.dart b/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.1.dart index a419bf3b03..b4c64e4986 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.1.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.1.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/widgets.dart'; /// Flutter code sample for [FontFeature.FontFeature.stylisticSet]. diff --git a/examples/api/lib/ui/text/font_feature.font_feature_subscripts.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_subscripts.0.dart index ab1b6121ae..0151b88b56 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_subscripts.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_subscripts.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/widgets.dart'; /// Flutter code sample for [FontFeature.FontFeature.subscripts]. diff --git a/examples/api/lib/ui/text/font_feature.font_feature_superscripts.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_superscripts.0.dart index 490955d18b..8eef9141b6 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_superscripts.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_superscripts.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/widgets.dart'; /// Flutter code sample for [FontFeature.FontFeature.superscripts]. diff --git a/examples/api/lib/ui/text/font_feature.font_feature_swash.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_swash.0.dart index 986981a709..d47c031257 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_swash.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_swash.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/widgets.dart'; /// Flutter code sample for [FontFeature.FontFeature.swash]. diff --git a/examples/api/lib/ui/text/font_feature.font_feature_tabular_figures.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_tabular_figures.0.dart index c2055ca366..db7cc09940 100644 --- a/examples/api/lib/ui/text/font_feature.font_feature_tabular_figures.0.dart +++ b/examples/api/lib/ui/text/font_feature.font_feature_tabular_figures.0.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/widgets.dart'; /// Flutter code sample for [dart]:ui FontFeature.FontFeature.tabularFigures. diff --git a/examples/api/test/ui/text/font_feature.0_test.dart b/examples/api/test/ui/text/font_feature.0_test.dart index 45bccfef8d..519bf188bb 100644 --- a/examples/api/test/ui/text/font_feature.0_test.dart +++ b/examples/api/test/ui/text/font_feature.0_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/examples/api/test/ui/text/font_feature.font_feature_alternative.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_alternative.0_test.dart index 0d4a9fb712..7560913358 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_alternative.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_alternative.0_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.font_feature_alternative.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/examples/api/test/ui/text/font_feature.font_feature_alternative_fractions.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_alternative_fractions.0_test.dart index cc949af685..c8229eeacf 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_alternative_fractions.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_alternative_fractions.0_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.font_feature_alternative_fractions.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/examples/api/test/ui/text/font_feature.font_feature_case_sensitive_forms.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_case_sensitive_forms.0_test.dart index 23a56ed8b3..fe10c4414f 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_case_sensitive_forms.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_case_sensitive_forms.0_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.font_feature_case_sensitive_forms.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/examples/api/test/ui/text/font_feature.font_feature_character_variant.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_character_variant.0_test.dart index bd5259d9e4..3e1bb6ac85 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_character_variant.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_character_variant.0_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.font_feature_character_variant.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/examples/api/test/ui/text/font_feature.font_feature_contextual_alternates.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_contextual_alternates.0_test.dart index 1981ff6c90..59ae39e852 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_contextual_alternates.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_contextual_alternates.0_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.font_feature_contextual_alternates.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/examples/api/test/ui/text/font_feature.font_feature_denominator.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_denominator.0_test.dart index ec43ecfd9c..d2995bd5c0 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_denominator.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_denominator.0_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.font_feature_denominator.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/examples/api/test/ui/text/font_feature.font_feature_fractions.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_fractions.0_test.dart index 05bc5b9f21..1592373198 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_fractions.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_fractions.0_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.font_feature_fractions.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/examples/api/test/ui/text/font_feature.font_feature_historical_forms.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_historical_forms.0_test.dart index 240ab348b5..e945151772 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_historical_forms.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_historical_forms.0_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.font_feature_historical_forms.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/examples/api/test/ui/text/font_feature.font_feature_historical_ligatures.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_historical_ligatures.0_test.dart index 7133684d73..babd68fa1b 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_historical_ligatures.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_historical_ligatures.0_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.font_feature_historical_ligatures.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/examples/api/test/ui/text/font_feature.font_feature_lining_figures.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_lining_figures.0_test.dart index 80672aadec..94e7c6f67a 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_lining_figures.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_lining_figures.0_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.font_feature_lining_figures.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/examples/api/test/ui/text/font_feature.font_feature_notational_forms.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_notational_forms.0_test.dart index 18b5e20f13..124d3aa70f 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_notational_forms.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_notational_forms.0_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.font_feature_notational_forms.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/examples/api/test/ui/text/font_feature.font_feature_numerators.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_numerators.0_test.dart index 5cd59a1306..a9dbd1935f 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_numerators.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_numerators.0_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.font_feature_numerators.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/examples/api/test/ui/text/font_feature.font_feature_oldstyle_figures.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_oldstyle_figures.0_test.dart index 5d0fcf87b3..9210c0b8dd 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_oldstyle_figures.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_oldstyle_figures.0_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.font_feature_oldstyle_figures.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/examples/api/test/ui/text/font_feature.font_feature_ordinal_forms.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_ordinal_forms.0_test.dart index c5ae315cbe..c26f8c213b 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_ordinal_forms.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_ordinal_forms.0_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.font_feature_ordinal_forms.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/examples/api/test/ui/text/font_feature.font_feature_proportional_figures.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_proportional_figures.0_test.dart index 7fe8c04cd9..af1d880e21 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_proportional_figures.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_proportional_figures.0_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.font_feature_proportional_figures.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/examples/api/test/ui/text/font_feature.font_feature_scientific_inferiors.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_scientific_inferiors.0_test.dart index cdfce67d68..c1f7aa8679 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_scientific_inferiors.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_scientific_inferiors.0_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.font_feature_scientific_inferiors.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/examples/api/test/ui/text/font_feature.font_feature_slashed_zero.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_slashed_zero.0_test.dart index 9481c57a35..bf9f3b4ac4 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_slashed_zero.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_slashed_zero.0_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.font_feature_slashed_zero.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/examples/api/test/ui/text/font_feature.font_feature_stylistic_alternates.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_stylistic_alternates.0_test.dart index 638a01ec5e..8db703c83b 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_stylistic_alternates.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_stylistic_alternates.0_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.font_feature_stylistic_alternates.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/examples/api/test/ui/text/font_feature.font_feature_stylistic_set.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_stylistic_set.0_test.dart index 023e9ebbde..1be7b35a7b 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_stylistic_set.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_stylistic_set.0_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.font_feature_stylistic_set.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/examples/api/test/ui/text/font_feature.font_feature_stylistic_set.1_test.dart b/examples/api/test/ui/text/font_feature.font_feature_stylistic_set.1_test.dart index 4e6ce35e27..16fb436f19 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_stylistic_set.1_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_stylistic_set.1_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.font_feature_stylistic_set.1.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/examples/api/test/ui/text/font_feature.font_feature_subscripts.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_subscripts.0_test.dart index 17d2b27082..9cab008237 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_subscripts.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_subscripts.0_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.font_feature_subscripts.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/examples/api/test/ui/text/font_feature.font_feature_superscripts.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_superscripts.0_test.dart index f3a01ffe0f..a940b93df7 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_superscripts.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_superscripts.0_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.font_feature_superscripts.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/examples/api/test/ui/text/font_feature.font_feature_swash.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_swash.0_test.dart index 4fcaf437f6..ca5a68d086 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_swash.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_swash.0_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.font_feature_swash.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/examples/api/test/ui/text/font_feature.font_feature_tabular_figures.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_tabular_figures.0_test.dart index b2a3d505c4..9cfef91334 100644 --- a/examples/api/test/ui/text/font_feature.font_feature_tabular_figures.0_test.dart +++ b/examples/api/test/ui/text/font_feature.font_feature_tabular_figures.0_test.dart @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_api_samples/ui/text/font_feature.font_feature_tabular_figures.0.dart' as example; import 'package:flutter_test/flutter_test.dart'; diff --git a/packages/flutter/lib/src/painting/basic_types.dart b/packages/flutter/lib/src/painting/basic_types.dart index 6107e10b2c..f07db133cf 100644 --- a/packages/flutter/lib/src/painting/basic_types.dart +++ b/packages/flutter/lib/src/painting/basic_types.dart @@ -12,7 +12,9 @@ export 'dart:ui' show Color, ColorFilter, FilterQuality, + FontFeature, FontStyle, + FontVariation, FontWeight, ImageShader, Locale, @@ -28,6 +30,7 @@ export 'dart:ui' show Radius, Rect, Shader, + Shadow, Size, StrokeCap, StrokeJoin, @@ -38,6 +41,8 @@ export 'dart:ui' show TextDecoration, TextDecorationStyle, TextDirection, + TextHeightBehavior, + TextLeadingDistribution, TextPosition, TileMode, VertexMode, diff --git a/packages/flutter/lib/src/painting/strut_style.dart b/packages/flutter/lib/src/painting/strut_style.dart index 432a835950..4f80fbef76 100644 --- a/packages/flutter/lib/src/painting/strut_style.dart +++ b/packages/flutter/lib/src/painting/strut_style.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui' show TextLeadingDistribution; - import 'package:flutter/foundation.dart'; import 'basic_types.dart'; diff --git a/packages/flutter/lib/src/painting/text_painter.dart b/packages/flutter/lib/src/painting/text_painter.dart index 4991c32501..e9992155bb 100644 --- a/packages/flutter/lib/src/painting/text_painter.dart +++ b/packages/flutter/lib/src/painting/text_painter.dart @@ -12,7 +12,6 @@ import 'dart:ui' as ui show ParagraphConstraints, ParagraphStyle, PlaceholderAlignment, - TextHeightBehavior, TextStyle; import 'package:flutter/foundation.dart'; @@ -488,7 +487,7 @@ class TextPainter { Locale? locale, StrutStyle? strutStyle, TextWidthBasis textWidthBasis = TextWidthBasis.parent, - ui.TextHeightBehavior? textHeightBehavior, + TextHeightBehavior? textHeightBehavior, }) : assert(text == null || text.debugAssertIsValid()), assert(maxLines == null || maxLines > 0), assert(textScaleFactor == 1.0 || identical(textScaler, TextScaler.noScaling), 'Use textScaler instead.'), @@ -537,7 +536,7 @@ class TextPainter { Locale? locale, StrutStyle? strutStyle, TextWidthBasis textWidthBasis = TextWidthBasis.parent, - ui.TextHeightBehavior? textHeightBehavior, + TextHeightBehavior? textHeightBehavior, double minWidth = 0.0, double maxWidth = double.infinity, }) { @@ -589,7 +588,7 @@ class TextPainter { Locale? locale, StrutStyle? strutStyle, TextWidthBasis textWidthBasis = TextWidthBasis.parent, - ui.TextHeightBehavior? textHeightBehavior, + TextHeightBehavior? textHeightBehavior, double minWidth = 0.0, double maxWidth = double.infinity, }) { @@ -894,9 +893,9 @@ class TextPainter { } /// {@macro dart.ui.textHeightBehavior} - ui.TextHeightBehavior? get textHeightBehavior => _textHeightBehavior; - ui.TextHeightBehavior? _textHeightBehavior; - set textHeightBehavior(ui.TextHeightBehavior? value) { + TextHeightBehavior? get textHeightBehavior => _textHeightBehavior; + TextHeightBehavior? _textHeightBehavior; + set textHeightBehavior(TextHeightBehavior? value) { if (_textHeightBehavior == value) { return; } diff --git a/packages/flutter/lib/src/painting/text_style.dart b/packages/flutter/lib/src/painting/text_style.dart index 6c2d583bc8..625e102b36 100644 --- a/packages/flutter/lib/src/painting/text_style.dart +++ b/packages/flutter/lib/src/painting/text_style.dart @@ -2,14 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:collection'; import 'dart:ui' as ui show - FontFeature, - FontVariation, ParagraphStyle, - Shadow, StrutStyle, - TextHeightBehavior, - TextLeadingDistribution, TextStyle, lerpDouble; @@ -680,7 +676,7 @@ class TextStyle with Diagnosticable { /// /// Defaults to null, which defers to the paragraph's /// `ParagraphStyle.textHeightBehavior`'s [leadingDistribution]. - final ui.TextLeadingDistribution? leadingDistribution; + final TextLeadingDistribution? leadingDistribution; /// The locale used to select region-specific glyphs. /// @@ -800,7 +796,7 @@ class TextStyle with Diagnosticable { /// /// Shadows must be in the same order for [TextStyle] to be considered as /// equivalent as order produces differing transparency. - final List? shadows; + final List? shadows; /// A list of [FontFeature]s that affect how the font selects glyphs. /// @@ -809,7 +805,13 @@ class TextStyle with Diagnosticable { /// tabular numbers, or it might offer versions of the zero digit with /// and without slashes. [FontFeature]s can be used to select which of /// these variants will be used for rendering. - final List? fontFeatures; + /// + /// Font features are not interpolated by [lerp]. + /// + /// See also: + /// + /// * [fontVariations], for font features that have continuous parameters. + final List? fontFeatures; /// A list of [FontVariation]s that affect how a variable font is rendered. /// @@ -823,10 +825,18 @@ class TextStyle with Diagnosticable { /// ```dart /// const TextStyle( /// fontFamily: 'RobotoSlab', - /// fontVariations: [ui.FontVariation('wght', 900.0)] + /// fontVariations: [FontVariation('wght', 900.0)] /// ) /// ``` - final List? fontVariations; + /// + /// Font variations can be interpolated via [lerp]. This is fastest when the + /// same font variation axes are specified, in the same order, in both + /// [TextStyle] objects. See [lerpFontVariations]. + /// + /// See also: + /// + /// * [fontFeatures], for font variations that have discrete values. + final List? fontVariations; /// How visual text overflow should be handled. final TextOverflow? overflow; @@ -862,13 +872,13 @@ class TextStyle with Diagnosticable { double? wordSpacing, TextBaseline? textBaseline, double? height, - ui.TextLeadingDistribution? leadingDistribution, + TextLeadingDistribution? leadingDistribution, Locale? locale, Paint? foreground, Paint? background, - List? shadows, - List? fontFeatures, - List? fontVariations, + List? shadows, + List? fontFeatures, + List? fontVariations, TextDecoration? decoration, Color? decorationColor, TextDecorationStyle? decorationStyle, @@ -967,11 +977,11 @@ class TextStyle with Diagnosticable { double heightFactor = 1.0, double heightDelta = 0.0, TextBaseline? textBaseline, - ui.TextLeadingDistribution? leadingDistribution, + TextLeadingDistribution? leadingDistribution, Locale? locale, - List? shadows, - List? fontFeatures, - List? fontVariations, + List? shadows, + List? fontFeatures, + List? fontVariations, String? package, TextOverflow? overflow, }) { @@ -1136,7 +1146,7 @@ class TextStyle with Diagnosticable { background: t < 0.5 ? null : b.background, shadows: t < 0.5 ? null : b.shadows, fontFeatures: t < 0.5 ? null : b.fontFeatures, - fontVariations: t < 0.5 ? null : b.fontVariations, + fontVariations: lerpFontVariations(null, b.fontVariations, t), decoration: t < 0.5 ? null : b.decoration, decorationColor: Color.lerp(null, b.decorationColor, t), decorationStyle: t < 0.5 ? null : b.decorationStyle, @@ -1167,7 +1177,7 @@ class TextStyle with Diagnosticable { background: t < 0.5 ? a.background : null, shadows: t < 0.5 ? a.shadows : null, fontFeatures: t < 0.5 ? a.fontFeatures : null, - fontVariations: t < 0.5 ? a.fontVariations : null, + fontVariations: lerpFontVariations(a.fontVariations, null, t), decoration: t < 0.5 ? a.decoration : null, decorationColor: Color.lerp(a.decorationColor, null, t), decorationStyle: t < 0.5 ? a.decorationStyle : null, @@ -1267,7 +1277,7 @@ class TextStyle with Diagnosticable { : null, shadows: t < 0.5 ? a.shadows : b.shadows, fontFeatures: t < 0.5 ? a.fontFeatures : b.fontFeatures, - fontVariations: t < 0.5 ? a.fontVariations : b.fontVariations, + fontVariations: lerpFontVariations(a.fontVariations, b.fontVariations, t), decoration: t < 0.5 ? a.decoration : b.decoration, decorationColor: Color.lerp(a.decorationColor, b.decorationColor, t), decorationStyle: t < 0.5 ? a.decorationStyle : b.decorationStyle, @@ -1342,7 +1352,7 @@ class TextStyle with Diagnosticable { TextScaler textScaler = TextScaler.noScaling, String? ellipsis, int? maxLines, - ui.TextHeightBehavior? textHeightBehavior, + TextHeightBehavior? textHeightBehavior, Locale? locale, String? fontFamily, double? fontSize, @@ -1352,9 +1362,9 @@ class TextStyle with Diagnosticable { StrutStyle? strutStyle, }) { assert(maxLines == null || maxLines > 0); - final ui.TextLeadingDistribution? leadingDistribution = this.leadingDistribution; - final ui.TextHeightBehavior? effectiveTextHeightBehavior = textHeightBehavior - ?? (leadingDistribution == null ? null : ui.TextHeightBehavior(leadingDistribution: leadingDistribution)); + final TextLeadingDistribution? leadingDistribution = this.leadingDistribution; + final TextHeightBehavior? effectiveTextHeightBehavior = textHeightBehavior + ?? (leadingDistribution == null ? null : TextHeightBehavior(leadingDistribution: leadingDistribution)); return ui.ParagraphStyle( textAlign: textAlign, @@ -1475,9 +1485,9 @@ class TextStyle with Diagnosticable { overflow, ); - final List? shadows = this.shadows; - final List? fontFeatures = this.fontFeatures; - final List? fontVariations = this.fontVariations; + final List? shadows = this.shadows; + final List? fontFeatures = this.fontFeatures; + final List? fontVariations = this.fontVariations; return Object.hash( inherit, color, @@ -1537,7 +1547,7 @@ class TextStyle with Diagnosticable { styles.add(DoubleProperty('${prefix}wordSpacing', wordSpacing, defaultValue: null)); styles.add(EnumProperty('${prefix}baseline', textBaseline, defaultValue: null)); styles.add(DoubleProperty('${prefix}height', height, unit: 'x', defaultValue: null)); - styles.add(EnumProperty('${prefix}leadingDistribution', leadingDistribution, defaultValue: null)); + styles.add(EnumProperty('${prefix}leadingDistribution', leadingDistribution, defaultValue: null)); styles.add(DiagnosticsProperty('${prefix}locale', locale, defaultValue: null)); styles.add(DiagnosticsProperty('${prefix}foreground', foreground, defaultValue: null)); styles.add(DiagnosticsProperty('${prefix}background', background, defaultValue: null)); @@ -1578,3 +1588,95 @@ class TextStyle with Diagnosticable { styles.add(EnumProperty('${prefix}overflow', overflow, defaultValue: null)); } } + +/// Interpolate between two lists of [FontVariation] objects. +/// +/// Variations are paired by axis, and interpolated using [FontVariation.lerp]. +/// +/// Entries that are only present in one list are animated using a step-function +/// at t=0.5 that enables or disables the variation. This can be jarring and +/// largely defeats the point of animating font variations. For best results, +/// specify the same axes in both lists, and for best performance, specify them +/// in the same order. +/// +/// ## Performance details +/// +/// This algorithm is O(N), but the constant factor varies based on the input, +/// and that is probably more important (because typically N is going to be +/// tiny, like 1 or 2; at the time of writing, there are only about five defined +/// axes that fonts typically use!). +/// +/// It is fastest when the lists contain the same axes ([FontVariation.axis]) in +/// the same order. The result is again in the same order, and no attempt is +/// made to detect or remove duplicates in this process. This is, by far, the +/// recommended way to use this algorithm. +/// +/// When the order of items in the two input lists vary, the constant factor +/// increases substantially, as it involves creating two maps and a set, +/// inserting every variation in both lists into the maps and the set, and then +/// iterating over them to recreate the list. +/// +/// In this case, the resulting order is arbitrary. Duplicates are dropped; in +/// each list, the last [FontVariation] for any particular axis is the one used +/// to compute the value for that axis. Values that only appear on one side are +/// interpolated using [FontVariation.lerp] against a null value, and resulting +/// null values are omitted from the resulting list. +/// +/// When the lists begin with matching pairs of axes, the fast algorithm is used +/// up to the point where the lists diverge, and the more expensive algorithm +/// is used on the remaining entries. +/// +/// See also: +/// +/// * [TextStyle.lerp], which uses this function to handle +/// [TextStyle.fontVariations]. +List? lerpFontVariations(List? a, List? b, double t) { + if (t == 0.0) { + return a; + } + if (t == 1.0) { + return b; + } + if (a == null || a.isEmpty || b == null || b.isEmpty) { + // If one side is empty, that means anything on the other + // side will use the null-to-something lerp, which is to + // say, a step function at t=0.5. + return t < 0.5 ? a : b; + } + assert(a.isNotEmpty && b.isNotEmpty); + final List result = []; + // First, try the efficient O(N) solution in the event that + // the lists are compatible. + int index = 0; + final int minLength = a.length < b.length ? a.length : b.length; + for (; index < minLength; index += 1) { + if (a[index].axis != b[index].axis) { + // The lists aren't compatible. + break; + } + result.add(FontVariation.lerp(a[index], b[index], t)!); + } + final int maxLength = a.length > b.length ? a.length : b.length; + if (index < maxLength) { + // If we get here, we have found some case where we cannot + // use the efficient approach. + final Set axes = HashSet(); + final Map aVariations = HashMap(); + for (int indexA = index; indexA < a.length; indexA += 1) { + aVariations[a[indexA].axis] = a[indexA]; + axes.add(a[indexA].axis); + } + final Map bVariations = HashMap(); + for (int indexB = index; indexB < b.length; indexB += 1) { + bVariations[b[indexB].axis] = b[indexB]; + axes.add(b[indexB].axis); + } + for (final String axis in axes) { + final FontVariation? variation = FontVariation.lerp(aVariations[axis], bVariations[axis], t); + if (variation != null) { + result.add(variation); + } + } + } + return result; +} diff --git a/packages/flutter/lib/src/widgets/icon.dart b/packages/flutter/lib/src/widgets/icon.dart index dbd27cf786..b6944fb5e9 100644 --- a/packages/flutter/lib/src/widgets/icon.dart +++ b/packages/flutter/lib/src/widgets/icon.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/foundation.dart'; import 'package:flutter/rendering.dart'; diff --git a/packages/flutter/test/painting/text_style_test.dart b/packages/flutter/test/painting/text_style_test.dart index ca2330e413..ffad8a3d66 100644 --- a/packages/flutter/test/painting/text_style_test.dart +++ b/packages/flutter/test/painting/text_style_test.dart @@ -595,4 +595,63 @@ void main() { expect(TextStyle.lerp(fromStyle, toStyle, 1), toStyle); }); + test('lerpFontVariations', () { + // nil cases + expect(lerpFontVariations(const [], const [], 0.0), const []); + expect(lerpFontVariations(const [], const [], 0.5), const []); + expect(lerpFontVariations(const [], const [], 1.0), const []); + expect(lerpFontVariations(null, const [], 0.0), null); + expect(lerpFontVariations(const [], null, 0.0), const []); + expect(lerpFontVariations(null, null, 0.0), null); + expect(lerpFontVariations(null, const [], 0.5), const []); + expect(lerpFontVariations(const [], null, 0.5), null); + expect(lerpFontVariations(null, null, 0.5), null); + expect(lerpFontVariations(null, const [], 1.0), const []); + expect(lerpFontVariations(const [], null, 1.0), null); + expect(lerpFontVariations(null, null, 1.0), null); + + const FontVariation w100 = FontVariation.weight(100.0); + const FontVariation w120 = FontVariation.weight(120.0); + const FontVariation w150 = FontVariation.weight(150.0); + const FontVariation w200 = FontVariation.weight(200.0); + const FontVariation w300 = FontVariation.weight(300.0); + const FontVariation w1000 = FontVariation.weight(1000.0); + + // one axis + expect(lerpFontVariations(const [w100], const [w200], 0.0), const [w100]); + expect(lerpFontVariations(const [w100], const [w200], 0.2), const [w120]); + expect(lerpFontVariations(const [w100], const [w200], 0.5), const [w150]); + expect(lerpFontVariations(const [w100], const [w200], 2.0), const [w300]); + + // weird one axis cases + expect(lerpFontVariations(const [w100, w1000], const [w300], 0.0), const [w100, w1000]); + expect(lerpFontVariations(const [w100, w1000], const [w300], 0.5), const [w200]); + expect(lerpFontVariations(const [w100, w1000], const [w300], 1.0), const [w300]); + expect(lerpFontVariations(const [w100, w1000], const [], 0.5), const []); + + const FontVariation sn80 = FontVariation.slant(-80.0); + const FontVariation sn40 = FontVariation.slant(-40.0); + const FontVariation s0 = FontVariation.slant(0.0); + const FontVariation sp40 = FontVariation.slant(40.0); + const FontVariation sp80 = FontVariation.slant(80.0); + + // two axis matched order + expect(lerpFontVariations(const [w100, sn80], const [w300, sp80], 0.5), const [w200, s0]); + + // two axis unmatched order + expect(lerpFontVariations(const [sn80, w100], const [w300, sp80], 0.0), const [sn80, w100]); + expect(lerpFontVariations(const [sn80, w100], const [w300, sp80], 0.5), unorderedMatches(const [s0, w200])); + expect(lerpFontVariations(const [sn80, w100], const [w300, sp80], 1.0), const [w300, sp80]); + + // two axis with duplicates + expect(lerpFontVariations(const [sn80, w100, sp80], const [w300, sp80], 0.5), unorderedMatches(const [sp80, w200])); + + // mixed axis counts + expect(lerpFontVariations(const [sn80, w100], const [w300], 0.5), const [w200]); + expect(lerpFontVariations(const [sn80], const [w300], 0.0), const [sn80]); + expect(lerpFontVariations(const [sn80], const [w300], 0.1), const [sn80]); + expect(lerpFontVariations(const [sn80], const [w300], 0.9), const [w300]); + expect(lerpFontVariations(const [sn80], const [w300], 1.0), const [w300]); + expect(lerpFontVariations(const [sn40, s0, w100], const [sp40, w300, sp80], 0.5), anyOf(equals(const [s0, w200, sp40]), equals(const [s0, sp40, w200]))); + }); } diff --git a/packages/flutter/test/widgets/icon_test.dart b/packages/flutter/test/widgets/icon_test.dart index 8a7eed76d8..d9e140996a 100644 --- a/packages/flutter/test/widgets/icon_test.dart +++ b/packages/flutter/test/widgets/icon_test.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; - import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';