Unverified Commit d435b724 authored by Kate Lovett's avatar Kate Lovett Committed by GitHub

Revert "Re-land text selection theme clean up" (#100564)

parent b95a7ab4
...@@ -354,6 +354,26 @@ class ThemeData with Diagnosticable { ...@@ -354,6 +354,26 @@ class ThemeData with Diagnosticable {
TooltipThemeData? tooltipTheme, TooltipThemeData? tooltipTheme,
ExpansionTileThemeData? expansionTileTheme, ExpansionTileThemeData? expansionTileTheme,
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
@Deprecated(
'No longer used by the framework, please remove any reference to it. '
'This feature was deprecated after v1.23.0-4.0.pre.',
)
bool? useTextSelectionTheme,
@Deprecated(
'Use TextSelectionThemeData.selectionColor instead. '
'This feature was deprecated after v1.26.0-18.0.pre.',
)
Color? textSelectionColor,
@Deprecated(
'Use TextSelectionThemeData.cursorColor instead. '
'This feature was deprecated after v1.26.0-18.0.pre.',
)
Color? cursorColor,
@Deprecated(
'Use TextSelectionThemeData.selectionHandleColor instead. '
'This feature was deprecated after v1.26.0-18.0.pre.',
)
Color? textSelectionHandleColor,
@Deprecated( @Deprecated(
'Use colorScheme.secondary instead. ' 'Use colorScheme.secondary instead. '
'For more information, consult the migration guide at ' 'For more information, consult the migration guide at '
...@@ -563,6 +583,10 @@ class ThemeData with Diagnosticable { ...@@ -563,6 +583,10 @@ class ThemeData with Diagnosticable {
expansionTileTheme ??= const ExpansionTileThemeData(); expansionTileTheme ??= const ExpansionTileThemeData();
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
useTextSelectionTheme ??= true;
textSelectionColor ??= isDark ? accentColor : primarySwatch[200]!;
cursorColor = cursorColor ?? const Color.fromRGBO(66, 133, 244, 1.0);
textSelectionHandleColor ??= isDark ? Colors.tealAccent[400]! : primarySwatch[300]!;
accentTextTheme = defaultAccentTextTheme.merge(accentTextTheme); accentTextTheme = defaultAccentTextTheme.merge(accentTextTheme);
accentIconTheme ??= accentIsDark ? const IconThemeData(color: Colors.white) : const IconThemeData(color: Colors.black); accentIconTheme ??= accentIsDark ? const IconThemeData(color: Colors.white) : const IconThemeData(color: Colors.black);
buttonColor ??= isDark ? primarySwatch[600]! : Colors.grey[300]!; buttonColor ??= isDark ? primarySwatch[600]! : Colors.grey[300]!;
...@@ -648,6 +672,10 @@ class ThemeData with Diagnosticable { ...@@ -648,6 +672,10 @@ class ThemeData with Diagnosticable {
tooltipTheme: tooltipTheme, tooltipTheme: tooltipTheme,
expansionTileTheme: expansionTileTheme, expansionTileTheme: expansionTileTheme,
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
useTextSelectionTheme: useTextSelectionTheme,
textSelectionColor: textSelectionColor,
cursorColor: cursorColor,
textSelectionHandleColor: textSelectionHandleColor,
accentColor: accentColor, accentColor: accentColor,
accentColorBrightness: accentColorBrightness, accentColorBrightness: accentColorBrightness,
accentTextTheme: accentTextTheme, accentTextTheme: accentTextTheme,
...@@ -751,6 +779,26 @@ class ThemeData with Diagnosticable { ...@@ -751,6 +779,26 @@ class ThemeData with Diagnosticable {
required this.tooltipTheme, required this.tooltipTheme,
required this.expansionTileTheme, required this.expansionTileTheme,
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
@Deprecated(
'No longer used by the framework, please remove any reference to it. '
'This feature was deprecated after v1.23.0-4.0.pre.',
)
required this.useTextSelectionTheme,
@Deprecated(
'Use TextSelectionThemeData.selectionColor instead. '
'This feature was deprecated after v1.26.0-18.0.pre.',
)
required this.textSelectionColor,
@Deprecated(
'Use TextSelectionThemeData.cursorColor instead. '
'This feature was deprecated after v1.26.0-18.0.pre.',
)
required this.cursorColor,
@Deprecated(
'Use TextSelectionThemeData.selectionHandleColor instead. '
'This feature was deprecated after v1.26.0-18.0.pre.',
)
required this.textSelectionHandleColor,
@Deprecated( @Deprecated(
'Use colorScheme.secondary instead. ' 'Use colorScheme.secondary instead. '
'For more information, consult the migration guide at ' 'For more information, consult the migration guide at '
...@@ -876,6 +924,10 @@ class ThemeData with Diagnosticable { ...@@ -876,6 +924,10 @@ class ThemeData with Diagnosticable {
assert(tooltipTheme != null), assert(tooltipTheme != null),
assert(expansionTileTheme != null), assert(expansionTileTheme != null),
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
assert(useTextSelectionTheme != null),
assert(textSelectionColor != null),
assert(cursorColor != null),
assert(textSelectionHandleColor != null),
assert(accentColor != null), assert(accentColor != null),
assert(accentColorBrightness != null), assert(accentColorBrightness != null),
assert(accentTextTheme != null), assert(accentTextTheme != null),
...@@ -1467,6 +1519,37 @@ class ThemeData with Diagnosticable { ...@@ -1467,6 +1519,37 @@ class ThemeData with Diagnosticable {
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
/// A temporary flag that was used to opt-in to the new [TextSelectionTheme]
/// during the migration to this new theme. That migration is now complete
/// and this flag is not longer used by the framework. Please remove any
/// reference to this property, as it will be removed in future releases.
@Deprecated(
'No longer used by the framework, please remove any reference to it. '
'This feature was deprecated after v1.23.0-4.0.pre.',
)
final bool useTextSelectionTheme;
/// The color of text selections in text fields, such as [TextField].
@Deprecated(
'Use TextSelectionThemeData.selectionColor instead. '
'This feature was deprecated after v1.26.0-18.0.pre.',
)
final Color textSelectionColor;
/// The color of cursors in Material-style text fields, such as [TextField].
@Deprecated(
'Use TextSelectionThemeData.cursorColor instead. '
'This feature was deprecated after v1.26.0-18.0.pre.',
)
final Color cursorColor;
/// The color of the handles used to adjust what part of the text is currently selected.
@Deprecated(
'Use TextSelectionThemeData.selectionHandleColor instead. '
'This feature was deprecated after v1.26.0-18.0.pre.',
)
final Color textSelectionHandleColor;
/// Obsolete property that was originally used as the foreground /// Obsolete property that was originally used as the foreground
/// color for widgets (knobs, text, overscroll edge effect, etc). /// color for widgets (knobs, text, overscroll edge effect, etc).
/// ///
...@@ -1661,6 +1744,26 @@ class ThemeData with Diagnosticable { ...@@ -1661,6 +1744,26 @@ class ThemeData with Diagnosticable {
TooltipThemeData? tooltipTheme, TooltipThemeData? tooltipTheme,
ExpansionTileThemeData? expansionTileTheme, ExpansionTileThemeData? expansionTileTheme,
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
@Deprecated(
'No longer used by the framework, please remove any reference to it. '
'This feature was deprecated after v1.23.0-4.0.pre.',
)
bool? useTextSelectionTheme,
@Deprecated(
'Use TextSelectionThemeData.selectionColor instead. '
'This feature was deprecated after v1.26.0-18.0.pre.',
)
Color? textSelectionColor,
@Deprecated(
'Use TextSelectionThemeData.cursorColor instead. '
'This feature was deprecated after v1.26.0-18.0.pre.',
)
Color? cursorColor,
@Deprecated(
'Use TextSelectionThemeData.selectionHandleColor instead. '
'This feature was deprecated after v1.26.0-18.0.pre.',
)
Color? textSelectionHandleColor,
@Deprecated( @Deprecated(
'No longer used by the framework, please remove any reference to it. ' 'No longer used by the framework, please remove any reference to it. '
'For more information, consult the migration guide at ' 'For more information, consult the migration guide at '
...@@ -1790,6 +1893,10 @@ class ThemeData with Diagnosticable { ...@@ -1790,6 +1893,10 @@ class ThemeData with Diagnosticable {
tooltipTheme: tooltipTheme ?? this.tooltipTheme, tooltipTheme: tooltipTheme ?? this.tooltipTheme,
expansionTileTheme: expansionTileTheme ?? this.expansionTileTheme, expansionTileTheme: expansionTileTheme ?? this.expansionTileTheme,
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
useTextSelectionTheme: useTextSelectionTheme ?? this.useTextSelectionTheme,
textSelectionColor: textSelectionColor ?? this.textSelectionColor,
cursorColor: cursorColor ?? this.cursorColor,
textSelectionHandleColor: textSelectionHandleColor ?? this.textSelectionHandleColor,
accentColor: accentColor ?? this.accentColor, accentColor: accentColor ?? this.accentColor,
accentColorBrightness: accentColorBrightness ?? this.accentColorBrightness, accentColorBrightness: accentColorBrightness ?? this.accentColorBrightness,
accentTextTheme: accentTextTheme ?? this.accentTextTheme, accentTextTheme: accentTextTheme ?? this.accentTextTheme,
...@@ -1985,6 +2092,10 @@ class ThemeData with Diagnosticable { ...@@ -1985,6 +2092,10 @@ class ThemeData with Diagnosticable {
tooltipTheme: TooltipThemeData.lerp(a.tooltipTheme, b.tooltipTheme, t)!, tooltipTheme: TooltipThemeData.lerp(a.tooltipTheme, b.tooltipTheme, t)!,
expansionTileTheme: ExpansionTileThemeData.lerp(a.expansionTileTheme, b.expansionTileTheme, t)!, expansionTileTheme: ExpansionTileThemeData.lerp(a.expansionTileTheme, b.expansionTileTheme, t)!,
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
useTextSelectionTheme: t < 0.5 ? a.useTextSelectionTheme : b.useTextSelectionTheme,
textSelectionColor: Color.lerp(a.textSelectionColor, b.textSelectionColor, t)!,
cursorColor: Color.lerp(a.cursorColor, b.cursorColor, t)!,
textSelectionHandleColor: Color.lerp(a.textSelectionHandleColor, b.textSelectionHandleColor, t)!,
accentColor: Color.lerp(a.accentColor, b.accentColor, t)!, accentColor: Color.lerp(a.accentColor, b.accentColor, t)!,
accentColorBrightness: t < 0.5 ? a.accentColorBrightness : b.accentColorBrightness, accentColorBrightness: t < 0.5 ? a.accentColorBrightness : b.accentColorBrightness,
accentTextTheme: TextTheme.lerp(a.accentTextTheme, b.accentTextTheme, t), accentTextTheme: TextTheme.lerp(a.accentTextTheme, b.accentTextTheme, t),
...@@ -2082,6 +2193,10 @@ class ThemeData with Diagnosticable { ...@@ -2082,6 +2193,10 @@ class ThemeData with Diagnosticable {
other.tooltipTheme == tooltipTheme && other.tooltipTheme == tooltipTheme &&
other.expansionTileTheme == expansionTileTheme && other.expansionTileTheme == expansionTileTheme &&
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
other.useTextSelectionTheme == useTextSelectionTheme &&
other.textSelectionColor == textSelectionColor &&
other.cursorColor == cursorColor &&
other.textSelectionHandleColor == textSelectionHandleColor &&
other.accentColor == accentColor && other.accentColor == accentColor &&
other.accentColorBrightness == accentColorBrightness && other.accentColorBrightness == accentColorBrightness &&
other.accentTextTheme == accentTextTheme && other.accentTextTheme == accentTextTheme &&
...@@ -2177,6 +2292,10 @@ class ThemeData with Diagnosticable { ...@@ -2177,6 +2292,10 @@ class ThemeData with Diagnosticable {
tooltipTheme, tooltipTheme,
expansionTileTheme, expansionTileTheme,
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
useTextSelectionTheme,
textSelectionColor,
cursorColor,
textSelectionHandleColor,
accentColor, accentColor,
accentColorBrightness, accentColorBrightness,
accentTextTheme, accentTextTheme,
...@@ -2271,6 +2390,10 @@ class ThemeData with Diagnosticable { ...@@ -2271,6 +2390,10 @@ class ThemeData with Diagnosticable {
properties.add(DiagnosticsProperty<TooltipThemeData>('tooltipTheme', tooltipTheme, level: DiagnosticLevel.debug)); properties.add(DiagnosticsProperty<TooltipThemeData>('tooltipTheme', tooltipTheme, level: DiagnosticLevel.debug));
properties.add(DiagnosticsProperty<ExpansionTileThemeData>('expansionTileTheme', expansionTileTheme, level: DiagnosticLevel.debug)); properties.add(DiagnosticsProperty<ExpansionTileThemeData>('expansionTileTheme', expansionTileTheme, level: DiagnosticLevel.debug));
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
properties.add(DiagnosticsProperty<bool>('useTextSelectionTheme', useTextSelectionTheme, level: DiagnosticLevel.debug));
properties.add(ColorProperty('textSelectionColor', textSelectionColor, defaultValue: defaultData.textSelectionColor, level: DiagnosticLevel.debug));
properties.add(ColorProperty('cursorColor', cursorColor, defaultValue: defaultData.cursorColor, level: DiagnosticLevel.debug));
properties.add(ColorProperty('textSelectionHandleColor', textSelectionHandleColor, defaultValue: defaultData.textSelectionHandleColor, level: DiagnosticLevel.debug));
properties.add(ColorProperty('accentColor', accentColor, defaultValue: defaultData.accentColor, level: DiagnosticLevel.debug)); properties.add(ColorProperty('accentColor', accentColor, defaultValue: defaultData.accentColor, level: DiagnosticLevel.debug));
properties.add(EnumProperty<Brightness>('accentColorBrightness', accentColorBrightness, defaultValue: defaultData.accentColorBrightness, level: DiagnosticLevel.debug)); properties.add(EnumProperty<Brightness>('accentColorBrightness', accentColorBrightness, defaultValue: defaultData.accentColorBrightness, level: DiagnosticLevel.debug));
properties.add(DiagnosticsProperty<TextTheme>('accentTextTheme', accentTextTheme, level: DiagnosticLevel.debug)); properties.add(DiagnosticsProperty<TextTheme>('accentTextTheme', accentTextTheme, level: DiagnosticLevel.debug));
......
...@@ -963,7 +963,7 @@ class EditableText extends StatefulWidget { ...@@ -963,7 +963,7 @@ class EditableText extends StatefulWidget {
/// ///
/// For [CupertinoTextField]s, the value is set to the ambient /// For [CupertinoTextField]s, the value is set to the ambient
/// [CupertinoThemeData.primaryColor] with 20% opacity. For [TextField]s, the /// [CupertinoThemeData.primaryColor] with 20% opacity. For [TextField]s, the
/// value is set to the ambient [TextSelectionThemeData.selectionColor]. /// value is set to the ambient [ThemeData.textSelectionColor].
final Color? selectionColor; final Color? selectionColor;
/// {@template flutter.widgets.editableText.selectionControls} /// {@template flutter.widgets.editableText.selectionControls}
......
...@@ -752,6 +752,9 @@ void main() { ...@@ -752,6 +752,9 @@ void main() {
buttonTheme: const ButtonThemeData(colorScheme: ColorScheme.dark()), buttonTheme: const ButtonThemeData(colorScheme: ColorScheme.dark()),
toggleButtonsTheme: const ToggleButtonsThemeData(textStyle: TextStyle(color: Colors.black)), toggleButtonsTheme: const ToggleButtonsThemeData(textStyle: TextStyle(color: Colors.black)),
secondaryHeaderColor: Colors.black, secondaryHeaderColor: Colors.black,
textSelectionColor: Colors.black,
cursorColor: Colors.black,
textSelectionHandleColor: Colors.black,
backgroundColor: Colors.black, backgroundColor: Colors.black,
dialogBackgroundColor: Colors.black, dialogBackgroundColor: Colors.black,
indicatorColor: Colors.black, indicatorColor: Colors.black,
...@@ -796,6 +799,7 @@ void main() { ...@@ -796,6 +799,7 @@ void main() {
radioTheme: const RadioThemeData(), radioTheme: const RadioThemeData(),
switchTheme: const SwitchThemeData(), switchTheme: const SwitchThemeData(),
progressIndicatorTheme: const ProgressIndicatorThemeData(), progressIndicatorTheme: const ProgressIndicatorThemeData(),
useTextSelectionTheme: false,
); );
ThemeData? themeBeforeSnackBar; ThemeData? themeBeforeSnackBar;
......
...@@ -634,6 +634,9 @@ void main() { ...@@ -634,6 +634,9 @@ void main() {
toggleButtonsTheme: const ToggleButtonsThemeData(textStyle: TextStyle(color: Colors.black)), toggleButtonsTheme: const ToggleButtonsThemeData(textStyle: TextStyle(color: Colors.black)),
buttonColor: Colors.black, buttonColor: Colors.black,
secondaryHeaderColor: Colors.black, secondaryHeaderColor: Colors.black,
textSelectionColor: Colors.black,
cursorColor: Colors.black,
textSelectionHandleColor: Colors.black,
backgroundColor: Colors.black, backgroundColor: Colors.black,
dialogBackgroundColor: Colors.black, dialogBackgroundColor: Colors.black,
indicatorColor: Colors.black, indicatorColor: Colors.black,
...@@ -687,6 +690,7 @@ void main() { ...@@ -687,6 +690,7 @@ void main() {
drawerTheme: const DrawerThemeData(), drawerTheme: const DrawerThemeData(),
listTileTheme: const ListTileThemeData(), listTileTheme: const ListTileThemeData(),
fixTextFieldOutlineLabel: false, fixTextFieldOutlineLabel: false,
useTextSelectionTheme: false,
androidOverscrollIndicator: null, androidOverscrollIndicator: null,
extensions: const <Object, ThemeExtension<dynamic>>{}, extensions: const <Object, ThemeExtension<dynamic>>{},
); );
...@@ -731,6 +735,9 @@ void main() { ...@@ -731,6 +735,9 @@ void main() {
toggleButtonsTheme: const ToggleButtonsThemeData(textStyle: TextStyle(color: Colors.white)), toggleButtonsTheme: const ToggleButtonsThemeData(textStyle: TextStyle(color: Colors.white)),
buttonColor: Colors.white, buttonColor: Colors.white,
secondaryHeaderColor: Colors.white, secondaryHeaderColor: Colors.white,
textSelectionColor: Colors.white,
cursorColor: Colors.white,
textSelectionHandleColor: Colors.white,
backgroundColor: Colors.white, backgroundColor: Colors.white,
dialogBackgroundColor: Colors.white, dialogBackgroundColor: Colors.white,
indicatorColor: Colors.white, indicatorColor: Colors.white,
...@@ -784,6 +791,7 @@ void main() { ...@@ -784,6 +791,7 @@ void main() {
drawerTheme: const DrawerThemeData(), drawerTheme: const DrawerThemeData(),
listTileTheme: const ListTileThemeData(), listTileTheme: const ListTileThemeData(),
fixTextFieldOutlineLabel: true, fixTextFieldOutlineLabel: true,
useTextSelectionTheme: true,
androidOverscrollIndicator: AndroidOverscrollIndicator.stretch, androidOverscrollIndicator: AndroidOverscrollIndicator.stretch,
extensions: const <Object, ThemeExtension<dynamic>>{ extensions: const <Object, ThemeExtension<dynamic>>{
MyThemeExtensionB: MyThemeExtensionB(textStyle: TextStyle()), MyThemeExtensionB: MyThemeExtensionB(textStyle: TextStyle()),
...@@ -814,6 +822,9 @@ void main() { ...@@ -814,6 +822,9 @@ void main() {
toggleButtonsTheme: otherTheme.toggleButtonsTheme, toggleButtonsTheme: otherTheme.toggleButtonsTheme,
buttonColor: otherTheme.buttonColor, buttonColor: otherTheme.buttonColor,
secondaryHeaderColor: otherTheme.secondaryHeaderColor, secondaryHeaderColor: otherTheme.secondaryHeaderColor,
textSelectionColor: otherTheme.textSelectionTheme.selectionColor,
cursorColor: otherTheme.textSelectionTheme.cursorColor,
textSelectionHandleColor: otherTheme.textSelectionTheme.selectionHandleColor,
backgroundColor: otherTheme.backgroundColor, backgroundColor: otherTheme.backgroundColor,
dialogBackgroundColor: otherTheme.dialogBackgroundColor, dialogBackgroundColor: otherTheme.dialogBackgroundColor,
indicatorColor: otherTheme.indicatorColor, indicatorColor: otherTheme.indicatorColor,
...@@ -1065,6 +1076,10 @@ void main() { ...@@ -1065,6 +1076,10 @@ void main() {
'tooltipTheme', 'tooltipTheme',
'expansionTileTheme', 'expansionTileTheme',
// DEPRECATED (newest deprecations at the bottom) // DEPRECATED (newest deprecations at the bottom)
'useTextSelectionTheme',
'textSelectionColor',
'cursorColor',
'textSelectionHandleColor',
'accentColor', 'accentColor',
'accentColorBrightness', 'accentColorBrightness',
'accentTextTheme', 'accentTextTheme',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment