Remove accentTextTheme from sliders and chips, tests and docs (#46801)
This commit is contained in:
@@ -78,6 +78,8 @@ abstract class ChipAttributes {
|
||||
|
||||
/// 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],
|
||||
/// such as [Text].
|
||||
///
|
||||
@@ -2935,4 +2937,3 @@ bool _tapIsOnDeleteIcon({
|
||||
}
|
||||
return tapIsOnDeleteIcon;
|
||||
}
|
||||
|
||||
|
||||
@@ -273,8 +273,9 @@ class RangeSlider extends StatefulWidget {
|
||||
/// There are two labels: one for the start thumb and one for the end thumb.
|
||||
///
|
||||
/// Each label is rendered using the active [ThemeData]'s
|
||||
/// [ThemeData.accentTextTheme.body2] text style, and can be overridden
|
||||
/// by changing the [SliderThemeData.valueIndicatorTextStyle].
|
||||
/// [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.
|
||||
///
|
||||
|
||||
@@ -302,7 +302,9 @@ class Slider extends StatefulWidget {
|
||||
/// as part of the value indicator shape.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
|
||||
@@ -615,8 +615,6 @@ class SliderThemeData extends Diagnosticable {
|
||||
final ShowValueIndicator showValueIndicator;
|
||||
|
||||
/// The text style for the text on the value indicator.
|
||||
///
|
||||
/// By default this is the [ThemeData.accentTextTheme.body2] text theme.
|
||||
final TextStyle valueIndicatorTextStyle;
|
||||
|
||||
/// Limits the thumb's separation distance.
|
||||
|
||||
@@ -169,7 +169,7 @@ void main() {
|
||||
testWidgets('ChipThemeData generates correct opacities for defaults', (WidgetTester tester) async {
|
||||
const Color customColor1 = Color(0xcafefeed);
|
||||
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(
|
||||
secondaryColor: customColor1,
|
||||
@@ -230,7 +230,7 @@ void main() {
|
||||
final ChipThemeData chipThemeBlack = ChipThemeData.fromDefaults(
|
||||
secondaryColor: Colors.black,
|
||||
brightness: Brightness.dark,
|
||||
labelStyle: ThemeData.fallback().accentTextTheme.body2.copyWith(color: Colors.black),
|
||||
labelStyle: ThemeData.fallback().textTheme.body2.copyWith(color: Colors.black),
|
||||
).copyWith(
|
||||
elevation: 1.0,
|
||||
pressElevation: 4.0,
|
||||
@@ -241,7 +241,7 @@ void main() {
|
||||
final ChipThemeData chipThemeWhite = ChipThemeData.fromDefaults(
|
||||
secondaryColor: Colors.white,
|
||||
brightness: Brightness.light,
|
||||
labelStyle: ThemeData.fallback().accentTextTheme.body2.copyWith(color: Colors.white),
|
||||
labelStyle: ThemeData.fallback().textTheme.body2.copyWith(color: Colors.white),
|
||||
).copyWith(
|
||||
padding: const EdgeInsets.all(2.0),
|
||||
labelPadding: const EdgeInsets.only(top: 8.0, bottom: 8.0),
|
||||
|
||||
@@ -144,7 +144,7 @@ void main() {
|
||||
primaryColor: customColor1,
|
||||
primaryColorDark: customColor2,
|
||||
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)));
|
||||
@@ -172,7 +172,7 @@ void main() {
|
||||
primaryColor: customColor1,
|
||||
primaryColorDark: customColor2,
|
||||
primaryColorLight: customColor3,
|
||||
valueIndicatorTextStyle: ThemeData.fallback().accentTextTheme.body2.copyWith(color: customColor4),
|
||||
valueIndicatorTextStyle: ThemeData.fallback().textTheme.body2.copyWith(color: customColor4),
|
||||
);
|
||||
|
||||
expect(sliderTheme.overlayShape, const RoundSliderOverlayShape());
|
||||
@@ -191,13 +191,13 @@ void main() {
|
||||
primaryColor: Colors.black,
|
||||
primaryColorDark: 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);
|
||||
final SliderThemeData sliderThemeWhite = SliderThemeData.fromPrimaryColors(
|
||||
primaryColor: Colors.white,
|
||||
primaryColorDark: 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);
|
||||
final SliderThemeData lerp = SliderThemeData.lerp(sliderThemeBlack, sliderThemeWhite, 0.5);
|
||||
const Color middleGrey = Color(0xff7f7f7f);
|
||||
|
||||
Reference in New Issue
Block a user