Unverified Commit 187c89b6 authored by Hans Muller's avatar Hans Muller Committed by GitHub

Remove accentTextTheme from sliders and chips, tests and docs (#46801)

parent 23b7853d
...@@ -78,6 +78,8 @@ abstract class ChipAttributes { ...@@ -78,6 +78,8 @@ abstract class ChipAttributes {
/// The style to be applied to the chip's label. /// The style to be applied to the chip's label.
/// ///
/// If null, the value of the [ChipTheme]'s [ChipThemeData.labelStyle] is used.
//
/// This only has an effect on widgets that respect the [DefaultTextStyle], /// This only has an effect on widgets that respect the [DefaultTextStyle],
/// such as [Text]. /// such as [Text].
/// ///
...@@ -2935,4 +2937,3 @@ bool _tapIsOnDeleteIcon({ ...@@ -2935,4 +2937,3 @@ bool _tapIsOnDeleteIcon({
} }
return tapIsOnDeleteIcon; return tapIsOnDeleteIcon;
} }
...@@ -273,8 +273,9 @@ class RangeSlider extends StatefulWidget { ...@@ -273,8 +273,9 @@ class RangeSlider extends StatefulWidget {
/// There are two labels: one for the start thumb and one for the end thumb. /// There are two labels: one for the start thumb and one for the end thumb.
/// ///
/// Each label is rendered using the active [ThemeData]'s /// Each label is rendered using the active [ThemeData]'s
/// [ThemeData.accentTextTheme.body2] text style, and can be overridden /// [ThemeData.textTheme.body2] text style, with the
/// by changing the [SliderThemeData.valueIndicatorTextStyle]. /// theme data's [ThemeData.colorScheme.onPrimaryColor]. The label's text
/// style can be overridden with [SliderThemeData.valueIndicatorTextStyle].
/// ///
/// If null, then the value indicator will not be displayed. /// If null, then the value indicator will not be displayed.
/// ///
......
...@@ -302,7 +302,9 @@ class Slider extends StatefulWidget { ...@@ -302,7 +302,9 @@ class Slider extends StatefulWidget {
/// as part of the value indicator shape. /// as part of the value indicator shape.
/// ///
/// The label is rendered using the active [ThemeData]'s /// The label is rendered using the active [ThemeData]'s
/// [ThemeData.accentTextTheme.body2] text style. /// [ThemeData.textTheme.body2] text style, with the
/// theme data's [ThemeData.colorScheme.onPrimaryColor]. The label's text style
/// can be overridden with [SliderThemeData.valueIndicatorTextStyle].
/// ///
/// If null, then the value indicator will not be displayed. /// If null, then the value indicator will not be displayed.
/// ///
......
...@@ -615,8 +615,6 @@ class SliderThemeData extends Diagnosticable { ...@@ -615,8 +615,6 @@ class SliderThemeData extends Diagnosticable {
final ShowValueIndicator showValueIndicator; final ShowValueIndicator showValueIndicator;
/// The text style for the text on the value indicator. /// The text style for the text on the value indicator.
///
/// By default this is the [ThemeData.accentTextTheme.body2] text theme.
final TextStyle valueIndicatorTextStyle; final TextStyle valueIndicatorTextStyle;
/// Limits the thumb's separation distance. /// Limits the thumb's separation distance.
......
...@@ -169,7 +169,7 @@ void main() { ...@@ -169,7 +169,7 @@ void main() {
testWidgets('ChipThemeData generates correct opacities for defaults', (WidgetTester tester) async { testWidgets('ChipThemeData generates correct opacities for defaults', (WidgetTester tester) async {
const Color customColor1 = Color(0xcafefeed); const Color customColor1 = Color(0xcafefeed);
const Color customColor2 = Color(0xdeadbeef); const Color customColor2 = Color(0xdeadbeef);
final TextStyle customStyle = ThemeData.fallback().accentTextTheme.body2.copyWith(color: customColor2); final TextStyle customStyle = ThemeData.fallback().textTheme.body2.copyWith(color: customColor2);
final ChipThemeData lightTheme = ChipThemeData.fromDefaults( final ChipThemeData lightTheme = ChipThemeData.fromDefaults(
secondaryColor: customColor1, secondaryColor: customColor1,
...@@ -230,7 +230,7 @@ void main() { ...@@ -230,7 +230,7 @@ void main() {
final ChipThemeData chipThemeBlack = ChipThemeData.fromDefaults( final ChipThemeData chipThemeBlack = ChipThemeData.fromDefaults(
secondaryColor: Colors.black, secondaryColor: Colors.black,
brightness: Brightness.dark, brightness: Brightness.dark,
labelStyle: ThemeData.fallback().accentTextTheme.body2.copyWith(color: Colors.black), labelStyle: ThemeData.fallback().textTheme.body2.copyWith(color: Colors.black),
).copyWith( ).copyWith(
elevation: 1.0, elevation: 1.0,
pressElevation: 4.0, pressElevation: 4.0,
...@@ -241,7 +241,7 @@ void main() { ...@@ -241,7 +241,7 @@ void main() {
final ChipThemeData chipThemeWhite = ChipThemeData.fromDefaults( final ChipThemeData chipThemeWhite = ChipThemeData.fromDefaults(
secondaryColor: Colors.white, secondaryColor: Colors.white,
brightness: Brightness.light, brightness: Brightness.light,
labelStyle: ThemeData.fallback().accentTextTheme.body2.copyWith(color: Colors.white), labelStyle: ThemeData.fallback().textTheme.body2.copyWith(color: Colors.white),
).copyWith( ).copyWith(
padding: const EdgeInsets.all(2.0), padding: const EdgeInsets.all(2.0),
labelPadding: const EdgeInsets.only(top: 8.0, bottom: 8.0), labelPadding: const EdgeInsets.only(top: 8.0, bottom: 8.0),
......
...@@ -144,7 +144,7 @@ void main() { ...@@ -144,7 +144,7 @@ void main() {
primaryColor: customColor1, primaryColor: customColor1,
primaryColorDark: customColor2, primaryColorDark: customColor2,
primaryColorLight: customColor3, primaryColorLight: customColor3,
valueIndicatorTextStyle: ThemeData.fallback().accentTextTheme.body2.copyWith(color: customColor4), valueIndicatorTextStyle: ThemeData.fallback().textTheme.body2.copyWith(color: customColor4),
); );
expect(sliderTheme.activeTrackColor, equals(customColor1.withAlpha(0xff))); expect(sliderTheme.activeTrackColor, equals(customColor1.withAlpha(0xff)));
...@@ -172,7 +172,7 @@ void main() { ...@@ -172,7 +172,7 @@ void main() {
primaryColor: customColor1, primaryColor: customColor1,
primaryColorDark: customColor2, primaryColorDark: customColor2,
primaryColorLight: customColor3, primaryColorLight: customColor3,
valueIndicatorTextStyle: ThemeData.fallback().accentTextTheme.body2.copyWith(color: customColor4), valueIndicatorTextStyle: ThemeData.fallback().textTheme.body2.copyWith(color: customColor4),
); );
expect(sliderTheme.overlayShape, const RoundSliderOverlayShape()); expect(sliderTheme.overlayShape, const RoundSliderOverlayShape());
...@@ -191,13 +191,13 @@ void main() { ...@@ -191,13 +191,13 @@ void main() {
primaryColor: Colors.black, primaryColor: Colors.black,
primaryColorDark: Colors.black, primaryColorDark: Colors.black,
primaryColorLight: Colors.black, primaryColorLight: Colors.black,
valueIndicatorTextStyle: ThemeData.fallback().accentTextTheme.body2.copyWith(color: Colors.black), valueIndicatorTextStyle: ThemeData.fallback().textTheme.body2.copyWith(color: Colors.black),
).copyWith(trackHeight: 2.0); ).copyWith(trackHeight: 2.0);
final SliderThemeData sliderThemeWhite = SliderThemeData.fromPrimaryColors( final SliderThemeData sliderThemeWhite = SliderThemeData.fromPrimaryColors(
primaryColor: Colors.white, primaryColor: Colors.white,
primaryColorDark: Colors.white, primaryColorDark: Colors.white,
primaryColorLight: Colors.white, primaryColorLight: Colors.white,
valueIndicatorTextStyle: ThemeData.fallback().accentTextTheme.body2.copyWith(color: Colors.white), valueIndicatorTextStyle: ThemeData.fallback().textTheme.body2.copyWith(color: Colors.white),
).copyWith(trackHeight: 6.0); ).copyWith(trackHeight: 6.0);
final SliderThemeData lerp = SliderThemeData.lerp(sliderThemeBlack, sliderThemeWhite, 0.5); final SliderThemeData lerp = SliderThemeData.lerp(sliderThemeBlack, sliderThemeWhite, 0.5);
const Color middleGrey = Color(0xff7f7f7f); const Color middleGrey = Color(0xff7f7f7f);
......
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