Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit cf3fc01

Browse files
Renzo-OlivaresRenzo Olivares
andauthored
remove deprecated accentTextTheme and accentIconTheme from ThemeData (#119360)
Co-authored-by: Renzo Olivares <roliv@google.com>
1 parent 845f7bb commit cf3fc01

File tree

3 files changed

+1
-117
lines changed

3 files changed

+1
-117
lines changed

packages/flutter/lib/src/material/theme_data.dart

Lines changed: 0 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -395,20 +395,6 @@ class ThemeData with Diagnosticable {
395395
'This feature was deprecated after v2.3.0-0.1.pre.',
396396
)
397397
Brightness? accentColorBrightness,
398-
@Deprecated(
399-
'No longer used by the framework, please remove any reference to it. '
400-
'For more information, consult the migration guide at '
401-
'https://flutter.dev/docs/release/breaking-changes/theme-data-accent-properties#migration-guide. '
402-
'This feature was deprecated after v2.3.0-0.1.pre.',
403-
)
404-
TextTheme? accentTextTheme,
405-
@Deprecated(
406-
'No longer used by the framework, please remove any reference to it. '
407-
'For more information, consult the migration guide at '
408-
'https://flutter.dev/docs/release/breaking-changes/theme-data-accent-properties#migration-guide. '
409-
'This feature was deprecated after v2.3.0-0.1.pre.',
410-
)
411-
IconThemeData? accentIconTheme,
412398
@Deprecated(
413399
'This "fix" is now enabled by default. '
414400
'This feature was deprecated after v2.5.0-1.0.pre.',
@@ -521,7 +507,6 @@ class ThemeData with Diagnosticable {
521507
toggleableActiveColor ??= isDark ? Colors.tealAccent[200]! : (accentColor ?? primarySwatch[600]!);
522508
accentColor ??= isDark ? Colors.tealAccent[200]! : primarySwatch[500]!;
523509
accentColorBrightness ??= estimateBrightnessForColor(accentColor);
524-
final bool accentIsDark = accentColorBrightness == Brightness.dark;
525510
focusColor ??= isDark ? Colors.white.withOpacity(0.12) : Colors.black.withOpacity(0.12);
526511
hoverColor ??= isDark ? Colors.white.withOpacity(0.04) : Colors.black.withOpacity(0.04);
527512
shadowColor ??= Colors.black;
@@ -569,21 +554,17 @@ class ThemeData with Diagnosticable {
569554
: Typography.material2014(platform: platform);
570555
TextTheme defaultTextTheme = isDark ? typography.white : typography.black;
571556
TextTheme defaultPrimaryTextTheme = primaryIsDark ? typography.white : typography.black;
572-
TextTheme defaultAccentTextTheme = accentIsDark ? typography.white : typography.black;
573557
if (fontFamily != null) {
574558
defaultTextTheme = defaultTextTheme.apply(fontFamily: fontFamily);
575559
defaultPrimaryTextTheme = defaultPrimaryTextTheme.apply(fontFamily: fontFamily);
576-
defaultAccentTextTheme = defaultAccentTextTheme.apply(fontFamily: fontFamily);
577560
}
578561
if (fontFamilyFallback != null) {
579562
defaultTextTheme = defaultTextTheme.apply(fontFamilyFallback: fontFamilyFallback);
580563
defaultPrimaryTextTheme = defaultPrimaryTextTheme.apply(fontFamilyFallback: fontFamilyFallback);
581-
defaultAccentTextTheme = defaultAccentTextTheme.apply(fontFamilyFallback: fontFamilyFallback);
582564
}
583565
if (package != null) {
584566
defaultTextTheme = defaultTextTheme.apply(package: package);
585567
defaultPrimaryTextTheme = defaultPrimaryTextTheme.apply(package: package);
586-
defaultAccentTextTheme = defaultAccentTextTheme.apply(package: package);
587568
}
588569
textTheme = defaultTextTheme.merge(textTheme);
589570
primaryTextTheme = defaultPrimaryTextTheme.merge(primaryTextTheme);
@@ -635,8 +616,6 @@ class ThemeData with Diagnosticable {
635616
tooltipTheme ??= const TooltipThemeData();
636617

637618
// DEPRECATED (newest deprecations at the bottom)
638-
accentTextTheme = defaultAccentTextTheme.merge(accentTextTheme);
639-
accentIconTheme ??= accentIsDark ? const IconThemeData(color: Colors.white) : const IconThemeData(color: Colors.black);
640619
fixTextFieldOutlineLabel ??= true;
641620
primaryColorBrightness = estimatedPrimaryColorBrightness;
642621
errorColor ??= Colors.red[700]!;
@@ -734,8 +713,6 @@ class ThemeData with Diagnosticable {
734713
// DEPRECATED (newest deprecations at the bottom)
735714
accentColor: accentColor,
736715
accentColorBrightness: accentColorBrightness,
737-
accentTextTheme: accentTextTheme,
738-
accentIconTheme: accentIconTheme,
739716
fixTextFieldOutlineLabel: fixTextFieldOutlineLabel,
740717
primaryColorBrightness: primaryColorBrightness,
741718
androidOverscrollIndicator: androidOverscrollIndicator,
@@ -860,20 +837,6 @@ class ThemeData with Diagnosticable {
860837
'This feature was deprecated after v2.3.0-0.1.pre.',
861838
)
862839
Brightness? accentColorBrightness,
863-
@Deprecated(
864-
'No longer used by the framework, please remove any reference to it. '
865-
'For more information, consult the migration guide at '
866-
'https://flutter.dev/docs/release/breaking-changes/theme-data-accent-properties#migration-guide. '
867-
'This feature was deprecated after v2.3.0-0.1.pre.',
868-
)
869-
TextTheme? accentTextTheme,
870-
@Deprecated(
871-
'No longer used by the framework, please remove any reference to it. '
872-
'For more information, consult the migration guide at '
873-
'https://flutter.dev/docs/release/breaking-changes/theme-data-accent-properties#migration-guide. '
874-
'This feature was deprecated after v2.3.0-0.1.pre.',
875-
)
876-
IconThemeData? accentIconTheme,
877840
@Deprecated(
878841
'This "fix" is now enabled by default. '
879842
'This feature was deprecated after v2.5.0-1.0.pre.',
@@ -921,8 +884,6 @@ class ThemeData with Diagnosticable {
921884
// should not be `required`, use getter pattern to avoid breakages.
922885
_accentColor = accentColor,
923886
_accentColorBrightness = accentColorBrightness,
924-
_accentTextTheme = accentTextTheme,
925-
_accentIconTheme = accentIconTheme,
926887
_fixTextFieldOutlineLabel = fixTextFieldOutlineLabel,
927888
_primaryColorBrightness = primaryColorBrightness,
928889
_toggleableActiveColor = toggleableActiveColor,
@@ -934,8 +895,6 @@ class ThemeData with Diagnosticable {
934895
// DEPRECATED (newest deprecations at the bottom)
935896
assert(accentColor != null),
936897
assert(accentColorBrightness != null),
937-
assert(accentTextTheme != null),
938-
assert(accentIconTheme != null),
939898
assert(fixTextFieldOutlineLabel != null),
940899
assert(primaryColorBrightness != null),
941900
assert(errorColor != null),
@@ -1630,46 +1589,6 @@ class ThemeData with Diagnosticable {
16301589
Brightness get accentColorBrightness => _accentColorBrightness!;
16311590
final Brightness? _accentColorBrightness;
16321591

1633-
/// Obsolete property that was originally used when a [TextTheme]
1634-
/// that contrasted well with the [accentColor] was needed.
1635-
///
1636-
/// The material library no longer uses this property and most uses
1637-
/// of [accentColor] have been replaced with
1638-
/// the theme's [colorScheme] [ColorScheme.secondary].
1639-
/// You can configure the color of a [textTheme] [TextStyle] so that it
1640-
/// contrasts well with the [ColorScheme.secondary] like this:
1641-
///
1642-
/// ```dart
1643-
/// final ThemeData theme = Theme.of(context);
1644-
/// final TextStyle style = theme.textTheme.displayLarge!.copyWith(
1645-
/// color: theme.colorScheme.onSecondary,
1646-
/// );
1647-
/// // ...use style...
1648-
/// ```
1649-
@Deprecated(
1650-
'No longer used by the framework, please remove any reference to it. '
1651-
'For more information, consult the migration guide at '
1652-
'https://flutter.dev/docs/release/breaking-changes/theme-data-accent-properties#migration-guide. '
1653-
'This feature was deprecated after v2.3.0-0.1.pre.',
1654-
)
1655-
TextTheme get accentTextTheme => _accentTextTheme!;
1656-
final TextTheme? _accentTextTheme;
1657-
1658-
/// Obsolete property that was originally used when an [IconTheme]
1659-
/// that contrasted well with the [accentColor] was needed.
1660-
///
1661-
/// The material library no longer uses this property and most uses
1662-
/// of [accentColor] have been replaced with
1663-
/// the theme's [colorScheme] [ColorScheme.secondary].
1664-
@Deprecated(
1665-
'No longer used by the framework, please remove any reference to it. '
1666-
'For more information, consult the migration guide at '
1667-
'https://flutter.dev/docs/release/breaking-changes/theme-data-accent-properties#migration-guide. '
1668-
'This feature was deprecated after v2.3.0-0.1.pre.',
1669-
)
1670-
IconThemeData get accentIconTheme => _accentIconTheme!;
1671-
final IconThemeData? _accentIconTheme;
1672-
16731592
/// An obsolete flag to allow apps to opt-out of a
16741593
/// [small fix](https://github.com/flutter/flutter/issues/54028) for the Y
16751594
/// coordinate of the floating label in a [TextField] [OutlineInputBorder].
@@ -1868,20 +1787,6 @@ class ThemeData with Diagnosticable {
18681787
'This feature was deprecated after v2.3.0-0.1.pre.',
18691788
)
18701789
Brightness? accentColorBrightness,
1871-
@Deprecated(
1872-
'No longer used by the framework, please remove any reference to it. '
1873-
'For more information, consult the migration guide at '
1874-
'https://flutter.dev/docs/release/breaking-changes/theme-data-accent-properties#migration-guide. '
1875-
'This feature was deprecated after v2.3.0-0.1.pre.',
1876-
)
1877-
TextTheme? accentTextTheme,
1878-
@Deprecated(
1879-
'No longer used by the framework, please remove any reference to it. '
1880-
'For more information, consult the migration guide at '
1881-
'https://flutter.dev/docs/release/breaking-changes/theme-data-accent-properties#migration-guide. '
1882-
'This feature was deprecated after v2.3.0-0.1.pre.',
1883-
)
1884-
IconThemeData? accentIconTheme,
18851790
@Deprecated(
18861791
'This "fix" is now enabled by default. '
18871792
'This feature was deprecated after v2.5.0-1.0.pre.',
@@ -2017,8 +1922,6 @@ class ThemeData with Diagnosticable {
20171922
// DEPRECATED (newest deprecations at the bottom)
20181923
accentColor: accentColor ?? _accentColor,
20191924
accentColorBrightness: accentColorBrightness ?? _accentColorBrightness,
2020-
accentTextTheme: accentTextTheme ?? _accentTextTheme,
2021-
accentIconTheme: accentIconTheme ?? _accentIconTheme,
20221925
fixTextFieldOutlineLabel: fixTextFieldOutlineLabel ?? _fixTextFieldOutlineLabel,
20231926
primaryColorBrightness: primaryColorBrightness ?? _primaryColorBrightness,
20241927
androidOverscrollIndicator: androidOverscrollIndicator ?? this.androidOverscrollIndicator,
@@ -2059,7 +1962,6 @@ class ThemeData with Diagnosticable {
20591962
() {
20601963
return baseTheme.copyWith(
20611964
primaryTextTheme: localTextGeometry.merge(baseTheme.primaryTextTheme),
2062-
accentTextTheme: localTextGeometry.merge(baseTheme.accentTextTheme),
20631965
textTheme: localTextGeometry.merge(baseTheme.textTheme),
20641966
);
20651967
},
@@ -2212,8 +2114,6 @@ class ThemeData with Diagnosticable {
22122114
// DEPRECATED (newest deprecations at the bottom)
22132115
accentColor: Color.lerp(a.accentColor, b.accentColor, t),
22142116
accentColorBrightness: t < 0.5 ? a.accentColorBrightness : b.accentColorBrightness,
2215-
accentTextTheme: TextTheme.lerp(a.accentTextTheme, b.accentTextTheme, t),
2216-
accentIconTheme: IconThemeData.lerp(a.accentIconTheme, b.accentIconTheme, t),
22172117
fixTextFieldOutlineLabel: t < 0.5 ? a.fixTextFieldOutlineLabel : b.fixTextFieldOutlineLabel,
22182118
primaryColorBrightness: t < 0.5 ? a.primaryColorBrightness : b.primaryColorBrightness,
22192119
androidOverscrollIndicator:t < 0.5 ? a.androidOverscrollIndicator : b.androidOverscrollIndicator,
@@ -2321,8 +2221,6 @@ class ThemeData with Diagnosticable {
23212221
// DEPRECATED (newest deprecations at the bottom)
23222222
other.accentColor == accentColor &&
23232223
other.accentColorBrightness == accentColorBrightness &&
2324-
other.accentTextTheme == accentTextTheme &&
2325-
other.accentIconTheme == accentIconTheme &&
23262224
other.fixTextFieldOutlineLabel == fixTextFieldOutlineLabel &&
23272225
other.primaryColorBrightness == primaryColorBrightness &&
23282226
other.androidOverscrollIndicator == androidOverscrollIndicator &&
@@ -2427,8 +2325,6 @@ class ThemeData with Diagnosticable {
24272325
// DEPRECATED (newest deprecations at the bottom)
24282326
accentColor,
24292327
accentColorBrightness,
2430-
accentTextTheme,
2431-
accentIconTheme,
24322328
fixTextFieldOutlineLabel,
24332329
primaryColorBrightness,
24342330
androidOverscrollIndicator,
@@ -2535,8 +2431,6 @@ class ThemeData with Diagnosticable {
25352431
// DEPRECATED (newest deprecations at the bottom)
25362432
properties.add(ColorProperty('accentColor', accentColor, defaultValue: defaultData.accentColor, level: DiagnosticLevel.debug));
25372433
properties.add(EnumProperty<Brightness>('accentColorBrightness', accentColorBrightness, defaultValue: defaultData.accentColorBrightness, level: DiagnosticLevel.debug));
2538-
properties.add(DiagnosticsProperty<TextTheme>('accentTextTheme', accentTextTheme, level: DiagnosticLevel.debug));
2539-
properties.add(DiagnosticsProperty<IconThemeData>('accentIconTheme', accentIconTheme, level: DiagnosticLevel.debug));
25402434
properties.add(DiagnosticsProperty<bool>('fixTextFieldOutlineLabel', fixTextFieldOutlineLabel, level: DiagnosticLevel.debug));
25412435
properties.add(EnumProperty<Brightness>('primaryColorBrightness', primaryColorBrightness, defaultValue: defaultData.primaryColorBrightness, level: DiagnosticLevel.debug));
25422436
properties.add(EnumProperty<AndroidOverscrollIndicator>('androidOverscrollIndicator', androidOverscrollIndicator, defaultValue: null, level: DiagnosticLevel.debug));

packages/flutter/test/material/theme_data_test.dart

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -815,8 +815,6 @@ void main() {
815815
// DEPRECATED (newest deprecations at the bottom)
816816
accentColor: Colors.black,
817817
accentColorBrightness: Brightness.dark,
818-
accentTextTheme: ThemeData.dark().textTheme,
819-
accentIconTheme: ThemeData.dark().iconTheme,
820818
fixTextFieldOutlineLabel: false,
821819
primaryColorBrightness: Brightness.dark,
822820
androidOverscrollIndicator: AndroidOverscrollIndicator.glow,
@@ -937,8 +935,6 @@ void main() {
937935
// DEPRECATED (newest deprecations at the bottom)
938936
accentColor: Colors.white,
939937
accentColorBrightness: Brightness.light,
940-
accentIconTheme: ThemeData.light().iconTheme,
941-
accentTextTheme: ThemeData.light().textTheme,
942938
fixTextFieldOutlineLabel: true,
943939
primaryColorBrightness: Brightness.light,
944940
androidOverscrollIndicator: AndroidOverscrollIndicator.stretch,
@@ -1042,8 +1038,6 @@ void main() {
10421038
// DEPRECATED (newest deprecations at the bottom)
10431039
accentColor: otherTheme.accentColor,
10441040
accentColorBrightness: otherTheme.accentColorBrightness,
1045-
accentIconTheme: otherTheme.accentIconTheme,
1046-
accentTextTheme: otherTheme.accentTextTheme,
10471041
fixTextFieldOutlineLabel: otherTheme.fixTextFieldOutlineLabel,
10481042
primaryColorBrightness: otherTheme.primaryColorBrightness,
10491043
androidOverscrollIndicator: otherTheme.androidOverscrollIndicator,
@@ -1148,8 +1142,6 @@ void main() {
11481142
// DEPRECATED (newest deprecations at the bottom)
11491143
expect(themeDataCopy.accentColor, equals(otherTheme.accentColor));
11501144
expect(themeDataCopy.accentColorBrightness, equals(otherTheme.accentColorBrightness));
1151-
expect(themeDataCopy.accentIconTheme, equals(otherTheme.accentIconTheme));
1152-
expect(themeDataCopy.accentTextTheme, equals(otherTheme.accentTextTheme));
11531145
expect(themeDataCopy.fixTextFieldOutlineLabel, equals(otherTheme.fixTextFieldOutlineLabel));
11541146
expect(themeDataCopy.primaryColorBrightness, equals(otherTheme.primaryColorBrightness));
11551147
expect(themeDataCopy.androidOverscrollIndicator, equals(otherTheme.androidOverscrollIndicator));
@@ -1286,8 +1278,6 @@ void main() {
12861278
// DEPRECATED (newest deprecations at the bottom)
12871279
'accentColor',
12881280
'accentColorBrightness',
1289-
'accentTextTheme',
1290-
'accentIconTheme',
12911281
'fixTextFieldOutlineLabel',
12921282
'primaryColorBrightness',
12931283
'androidOverscrollIndicator',

packages/flutter/test/material/theme_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ void main() {
444444
];
445445
}
446446

447-
for (final TextTheme textTheme in <TextTheme>[theme.textTheme, theme.primaryTextTheme, theme.accentTextTheme]) {
447+
for (final TextTheme textTheme in <TextTheme>[theme.textTheme, theme.primaryTextTheme]) {
448448
for (final TextStyle style in extractStyles(textTheme).map<TextStyle>((TextStyle style) => _TextStyleProxy(style))) {
449449
expect(style.inherit, false);
450450
expect(style.color, isNotNull);

0 commit comments

Comments
 (0)