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

Commit 63a12b3

Browse files
authored
Re-land text selection theme clean up (#99927)
1 parent 5bc9340 commit 63a12b3

File tree

4 files changed

+1
-143
lines changed

4 files changed

+1
-143
lines changed

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

Lines changed: 0 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -354,26 +354,6 @@ class ThemeData with Diagnosticable {
354354
TooltipThemeData? tooltipTheme,
355355
ExpansionTileThemeData? expansionTileTheme,
356356
// DEPRECATED (newest deprecations at the bottom)
357-
@Deprecated(
358-
'No longer used by the framework, please remove any reference to it. '
359-
'This feature was deprecated after v1.23.0-4.0.pre.',
360-
)
361-
bool? useTextSelectionTheme,
362-
@Deprecated(
363-
'Use TextSelectionThemeData.selectionColor instead. '
364-
'This feature was deprecated after v1.26.0-18.0.pre.',
365-
)
366-
Color? textSelectionColor,
367-
@Deprecated(
368-
'Use TextSelectionThemeData.cursorColor instead. '
369-
'This feature was deprecated after v1.26.0-18.0.pre.',
370-
)
371-
Color? cursorColor,
372-
@Deprecated(
373-
'Use TextSelectionThemeData.selectionHandleColor instead. '
374-
'This feature was deprecated after v1.26.0-18.0.pre.',
375-
)
376-
Color? textSelectionHandleColor,
377357
@Deprecated(
378358
'Use colorScheme.secondary instead. '
379359
'For more information, consult the migration guide at '
@@ -583,10 +563,6 @@ class ThemeData with Diagnosticable {
583563
expansionTileTheme ??= const ExpansionTileThemeData();
584564

585565
// DEPRECATED (newest deprecations at the bottom)
586-
useTextSelectionTheme ??= true;
587-
textSelectionColor ??= isDark ? accentColor : primarySwatch[200]!;
588-
cursorColor = cursorColor ?? const Color.fromRGBO(66, 133, 244, 1.0);
589-
textSelectionHandleColor ??= isDark ? Colors.tealAccent[400]! : primarySwatch[300]!;
590566
accentTextTheme = defaultAccentTextTheme.merge(accentTextTheme);
591567
accentIconTheme ??= accentIsDark ? const IconThemeData(color: Colors.white) : const IconThemeData(color: Colors.black);
592568
buttonColor ??= isDark ? primarySwatch[600]! : Colors.grey[300]!;
@@ -672,10 +648,6 @@ class ThemeData with Diagnosticable {
672648
tooltipTheme: tooltipTheme,
673649
expansionTileTheme: expansionTileTheme,
674650
// DEPRECATED (newest deprecations at the bottom)
675-
useTextSelectionTheme: useTextSelectionTheme,
676-
textSelectionColor: textSelectionColor,
677-
cursorColor: cursorColor,
678-
textSelectionHandleColor: textSelectionHandleColor,
679651
accentColor: accentColor,
680652
accentColorBrightness: accentColorBrightness,
681653
accentTextTheme: accentTextTheme,
@@ -779,26 +751,6 @@ class ThemeData with Diagnosticable {
779751
required this.tooltipTheme,
780752
required this.expansionTileTheme,
781753
// DEPRECATED (newest deprecations at the bottom)
782-
@Deprecated(
783-
'No longer used by the framework, please remove any reference to it. '
784-
'This feature was deprecated after v1.23.0-4.0.pre.',
785-
)
786-
required this.useTextSelectionTheme,
787-
@Deprecated(
788-
'Use TextSelectionThemeData.selectionColor instead. '
789-
'This feature was deprecated after v1.26.0-18.0.pre.',
790-
)
791-
required this.textSelectionColor,
792-
@Deprecated(
793-
'Use TextSelectionThemeData.cursorColor instead. '
794-
'This feature was deprecated after v1.26.0-18.0.pre.',
795-
)
796-
required this.cursorColor,
797-
@Deprecated(
798-
'Use TextSelectionThemeData.selectionHandleColor instead. '
799-
'This feature was deprecated after v1.26.0-18.0.pre.',
800-
)
801-
required this.textSelectionHandleColor,
802754
@Deprecated(
803755
'Use colorScheme.secondary instead. '
804756
'For more information, consult the migration guide at '
@@ -924,10 +876,6 @@ class ThemeData with Diagnosticable {
924876
assert(tooltipTheme != null),
925877
assert(expansionTileTheme != null),
926878
// DEPRECATED (newest deprecations at the bottom)
927-
assert(useTextSelectionTheme != null),
928-
assert(textSelectionColor != null),
929-
assert(cursorColor != null),
930-
assert(textSelectionHandleColor != null),
931879
assert(accentColor != null),
932880
assert(accentColorBrightness != null),
933881
assert(accentTextTheme != null),
@@ -1519,37 +1467,6 @@ class ThemeData with Diagnosticable {
15191467

15201468
// DEPRECATED (newest deprecations at the bottom)
15211469

1522-
/// A temporary flag that was used to opt-in to the new [TextSelectionTheme]
1523-
/// during the migration to this new theme. That migration is now complete
1524-
/// and this flag is not longer used by the framework. Please remove any
1525-
/// reference to this property, as it will be removed in future releases.
1526-
@Deprecated(
1527-
'No longer used by the framework, please remove any reference to it. '
1528-
'This feature was deprecated after v1.23.0-4.0.pre.',
1529-
)
1530-
final bool useTextSelectionTheme;
1531-
1532-
/// The color of text selections in text fields, such as [TextField].
1533-
@Deprecated(
1534-
'Use TextSelectionThemeData.selectionColor instead. '
1535-
'This feature was deprecated after v1.26.0-18.0.pre.',
1536-
)
1537-
final Color textSelectionColor;
1538-
1539-
/// The color of cursors in Material-style text fields, such as [TextField].
1540-
@Deprecated(
1541-
'Use TextSelectionThemeData.cursorColor instead. '
1542-
'This feature was deprecated after v1.26.0-18.0.pre.',
1543-
)
1544-
final Color cursorColor;
1545-
1546-
/// The color of the handles used to adjust what part of the text is currently selected.
1547-
@Deprecated(
1548-
'Use TextSelectionThemeData.selectionHandleColor instead. '
1549-
'This feature was deprecated after v1.26.0-18.0.pre.',
1550-
)
1551-
final Color textSelectionHandleColor;
1552-
15531470
/// Obsolete property that was originally used as the foreground
15541471
/// color for widgets (knobs, text, overscroll edge effect, etc).
15551472
///
@@ -1744,26 +1661,6 @@ class ThemeData with Diagnosticable {
17441661
TooltipThemeData? tooltipTheme,
17451662
ExpansionTileThemeData? expansionTileTheme,
17461663
// DEPRECATED (newest deprecations at the bottom)
1747-
@Deprecated(
1748-
'No longer used by the framework, please remove any reference to it. '
1749-
'This feature was deprecated after v1.23.0-4.0.pre.',
1750-
)
1751-
bool? useTextSelectionTheme,
1752-
@Deprecated(
1753-
'Use TextSelectionThemeData.selectionColor instead. '
1754-
'This feature was deprecated after v1.26.0-18.0.pre.',
1755-
)
1756-
Color? textSelectionColor,
1757-
@Deprecated(
1758-
'Use TextSelectionThemeData.cursorColor instead. '
1759-
'This feature was deprecated after v1.26.0-18.0.pre.',
1760-
)
1761-
Color? cursorColor,
1762-
@Deprecated(
1763-
'Use TextSelectionThemeData.selectionHandleColor instead. '
1764-
'This feature was deprecated after v1.26.0-18.0.pre.',
1765-
)
1766-
Color? textSelectionHandleColor,
17671664
@Deprecated(
17681665
'No longer used by the framework, please remove any reference to it. '
17691666
'For more information, consult the migration guide at '
@@ -1893,10 +1790,6 @@ class ThemeData with Diagnosticable {
18931790
tooltipTheme: tooltipTheme ?? this.tooltipTheme,
18941791
expansionTileTheme: expansionTileTheme ?? this.expansionTileTheme,
18951792
// DEPRECATED (newest deprecations at the bottom)
1896-
useTextSelectionTheme: useTextSelectionTheme ?? this.useTextSelectionTheme,
1897-
textSelectionColor: textSelectionColor ?? this.textSelectionColor,
1898-
cursorColor: cursorColor ?? this.cursorColor,
1899-
textSelectionHandleColor: textSelectionHandleColor ?? this.textSelectionHandleColor,
19001793
accentColor: accentColor ?? this.accentColor,
19011794
accentColorBrightness: accentColorBrightness ?? this.accentColorBrightness,
19021795
accentTextTheme: accentTextTheme ?? this.accentTextTheme,
@@ -2092,10 +1985,6 @@ class ThemeData with Diagnosticable {
20921985
tooltipTheme: TooltipThemeData.lerp(a.tooltipTheme, b.tooltipTheme, t)!,
20931986
expansionTileTheme: ExpansionTileThemeData.lerp(a.expansionTileTheme, b.expansionTileTheme, t)!,
20941987
// DEPRECATED (newest deprecations at the bottom)
2095-
useTextSelectionTheme: t < 0.5 ? a.useTextSelectionTheme : b.useTextSelectionTheme,
2096-
textSelectionColor: Color.lerp(a.textSelectionColor, b.textSelectionColor, t)!,
2097-
cursorColor: Color.lerp(a.cursorColor, b.cursorColor, t)!,
2098-
textSelectionHandleColor: Color.lerp(a.textSelectionHandleColor, b.textSelectionHandleColor, t)!,
20991988
accentColor: Color.lerp(a.accentColor, b.accentColor, t)!,
21001989
accentColorBrightness: t < 0.5 ? a.accentColorBrightness : b.accentColorBrightness,
21011990
accentTextTheme: TextTheme.lerp(a.accentTextTheme, b.accentTextTheme, t),
@@ -2193,10 +2082,6 @@ class ThemeData with Diagnosticable {
21932082
other.tooltipTheme == tooltipTheme &&
21942083
other.expansionTileTheme == expansionTileTheme &&
21952084
// DEPRECATED (newest deprecations at the bottom)
2196-
other.useTextSelectionTheme == useTextSelectionTheme &&
2197-
other.textSelectionColor == textSelectionColor &&
2198-
other.cursorColor == cursorColor &&
2199-
other.textSelectionHandleColor == textSelectionHandleColor &&
22002085
other.accentColor == accentColor &&
22012086
other.accentColorBrightness == accentColorBrightness &&
22022087
other.accentTextTheme == accentTextTheme &&
@@ -2292,10 +2177,6 @@ class ThemeData with Diagnosticable {
22922177
tooltipTheme,
22932178
expansionTileTheme,
22942179
// DEPRECATED (newest deprecations at the bottom)
2295-
useTextSelectionTheme,
2296-
textSelectionColor,
2297-
cursorColor,
2298-
textSelectionHandleColor,
22992180
accentColor,
23002181
accentColorBrightness,
23012182
accentTextTheme,
@@ -2390,10 +2271,6 @@ class ThemeData with Diagnosticable {
23902271
properties.add(DiagnosticsProperty<TooltipThemeData>('tooltipTheme', tooltipTheme, level: DiagnosticLevel.debug));
23912272
properties.add(DiagnosticsProperty<ExpansionTileThemeData>('expansionTileTheme', expansionTileTheme, level: DiagnosticLevel.debug));
23922273
// DEPRECATED (newest deprecations at the bottom)
2393-
properties.add(DiagnosticsProperty<bool>('useTextSelectionTheme', useTextSelectionTheme, level: DiagnosticLevel.debug));
2394-
properties.add(ColorProperty('textSelectionColor', textSelectionColor, defaultValue: defaultData.textSelectionColor, level: DiagnosticLevel.debug));
2395-
properties.add(ColorProperty('cursorColor', cursorColor, defaultValue: defaultData.cursorColor, level: DiagnosticLevel.debug));
2396-
properties.add(ColorProperty('textSelectionHandleColor', textSelectionHandleColor, defaultValue: defaultData.textSelectionHandleColor, level: DiagnosticLevel.debug));
23972274
properties.add(ColorProperty('accentColor', accentColor, defaultValue: defaultData.accentColor, level: DiagnosticLevel.debug));
23982275
properties.add(EnumProperty<Brightness>('accentColorBrightness', accentColorBrightness, defaultValue: defaultData.accentColorBrightness, level: DiagnosticLevel.debug));
23992276
properties.add(DiagnosticsProperty<TextTheme>('accentTextTheme', accentTextTheme, level: DiagnosticLevel.debug));

packages/flutter/lib/src/widgets/editable_text.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ class EditableText extends StatefulWidget {
963963
///
964964
/// For [CupertinoTextField]s, the value is set to the ambient
965965
/// [CupertinoThemeData.primaryColor] with 20% opacity. For [TextField]s, the
966-
/// value is set to the ambient [ThemeData.textSelectionColor].
966+
/// value is set to the ambient [TextSelectionThemeData.selectionColor].
967967
final Color? selectionColor;
968968

969969
/// {@template flutter.widgets.editableText.selectionControls}

packages/flutter/test/material/snack_bar_test.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -752,9 +752,6 @@ void main() {
752752
buttonTheme: const ButtonThemeData(colorScheme: ColorScheme.dark()),
753753
toggleButtonsTheme: const ToggleButtonsThemeData(textStyle: TextStyle(color: Colors.black)),
754754
secondaryHeaderColor: Colors.black,
755-
textSelectionColor: Colors.black,
756-
cursorColor: Colors.black,
757-
textSelectionHandleColor: Colors.black,
758755
backgroundColor: Colors.black,
759756
dialogBackgroundColor: Colors.black,
760757
indicatorColor: Colors.black,
@@ -799,7 +796,6 @@ void main() {
799796
radioTheme: const RadioThemeData(),
800797
switchTheme: const SwitchThemeData(),
801798
progressIndicatorTheme: const ProgressIndicatorThemeData(),
802-
useTextSelectionTheme: false,
803799
);
804800

805801
ThemeData? themeBeforeSnackBar;

packages/flutter/test/material/theme_data_test.dart

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -634,9 +634,6 @@ void main() {
634634
toggleButtonsTheme: const ToggleButtonsThemeData(textStyle: TextStyle(color: Colors.black)),
635635
buttonColor: Colors.black,
636636
secondaryHeaderColor: Colors.black,
637-
textSelectionColor: Colors.black,
638-
cursorColor: Colors.black,
639-
textSelectionHandleColor: Colors.black,
640637
backgroundColor: Colors.black,
641638
dialogBackgroundColor: Colors.black,
642639
indicatorColor: Colors.black,
@@ -690,7 +687,6 @@ void main() {
690687
drawerTheme: const DrawerThemeData(),
691688
listTileTheme: const ListTileThemeData(),
692689
fixTextFieldOutlineLabel: false,
693-
useTextSelectionTheme: false,
694690
androidOverscrollIndicator: null,
695691
extensions: const <Object, ThemeExtension<dynamic>>{},
696692
);
@@ -735,9 +731,6 @@ void main() {
735731
toggleButtonsTheme: const ToggleButtonsThemeData(textStyle: TextStyle(color: Colors.white)),
736732
buttonColor: Colors.white,
737733
secondaryHeaderColor: Colors.white,
738-
textSelectionColor: Colors.white,
739-
cursorColor: Colors.white,
740-
textSelectionHandleColor: Colors.white,
741734
backgroundColor: Colors.white,
742735
dialogBackgroundColor: Colors.white,
743736
indicatorColor: Colors.white,
@@ -791,7 +784,6 @@ void main() {
791784
drawerTheme: const DrawerThemeData(),
792785
listTileTheme: const ListTileThemeData(),
793786
fixTextFieldOutlineLabel: true,
794-
useTextSelectionTheme: true,
795787
androidOverscrollIndicator: AndroidOverscrollIndicator.stretch,
796788
extensions: const <Object, ThemeExtension<dynamic>>{
797789
MyThemeExtensionB: MyThemeExtensionB(textStyle: TextStyle()),
@@ -822,9 +814,6 @@ void main() {
822814
toggleButtonsTheme: otherTheme.toggleButtonsTheme,
823815
buttonColor: otherTheme.buttonColor,
824816
secondaryHeaderColor: otherTheme.secondaryHeaderColor,
825-
textSelectionColor: otherTheme.textSelectionTheme.selectionColor,
826-
cursorColor: otherTheme.textSelectionTheme.cursorColor,
827-
textSelectionHandleColor: otherTheme.textSelectionTheme.selectionHandleColor,
828817
backgroundColor: otherTheme.backgroundColor,
829818
dialogBackgroundColor: otherTheme.dialogBackgroundColor,
830819
indicatorColor: otherTheme.indicatorColor,
@@ -1076,10 +1065,6 @@ void main() {
10761065
'tooltipTheme',
10771066
'expansionTileTheme',
10781067
// DEPRECATED (newest deprecations at the bottom)
1079-
'useTextSelectionTheme',
1080-
'textSelectionColor',
1081-
'cursorColor',
1082-
'textSelectionHandleColor',
10831068
'accentColor',
10841069
'accentColorBrightness',
10851070
'accentTextTheme',

0 commit comments

Comments
 (0)