Unverified Commit 5129d8ff authored by Greg Spencer's avatar Greg Spencer Committed by GitHub

Rename Rail to Track, per UX guideline (#16519)

parent 4dbbf678
...@@ -184,8 +184,8 @@ class _SliderDemoState extends State<SliderDemo> { ...@@ -184,8 +184,8 @@ class _SliderDemoState extends State<SliderDemo> {
children: <Widget>[ children: <Widget>[
new SliderTheme( new SliderTheme(
data: theme.sliderTheme.copyWith( data: theme.sliderTheme.copyWith(
activeRailColor: Colors.deepPurple, activeTrackColor: Colors.deepPurple,
inactiveRailColor: Colors.black26, inactiveTrackColor: Colors.black26,
activeTickMarkColor: Colors.white70, activeTickMarkColor: Colors.white70,
inactiveTickMarkColor: Colors.black, inactiveTickMarkColor: Colors.black,
overlayColor: Colors.black12, overlayColor: Colors.black12,
......
...@@ -32,7 +32,7 @@ import 'theme.dart'; ...@@ -32,7 +32,7 @@ import 'theme.dart';
/// ///
/// * The "thumb", which is a shape that slides horizontally when the user /// * The "thumb", which is a shape that slides horizontally when the user
/// drags it. /// drags it.
/// * The "rail", which is the line that the slider thumb slides along. /// * The "track", which is the line that the slider thumb slides along.
/// * The "value indicator", which is a shape that pops up when the user /// * The "value indicator", which is a shape that pops up when the user
/// is dragging the thumb to indicate the value being selected. /// is dragging the thumb to indicate the value being selected.
/// * The "active" side of the slider is the side between the thumb and the /// * The "active" side of the slider is the side between the thumb and the
...@@ -50,7 +50,7 @@ import 'theme.dart'; ...@@ -50,7 +50,7 @@ import 'theme.dart';
/// slider. /// slider.
/// ///
/// By default, a slider will be as wide as possible, centered vertically. When /// By default, a slider will be as wide as possible, centered vertically. When
/// given unbounded constraints, it will attempt to make the rail 144 pixels /// given unbounded constraints, it will attempt to make the track 144 pixels
/// wide (with margins on each side) and will shrink-wrap vertically. /// wide (with margins on each side) and will shrink-wrap vertically.
/// ///
/// Requires one of its ancestors to be a [Material] widget. /// Requires one of its ancestors to be a [Material] widget.
...@@ -177,23 +177,23 @@ class Slider extends StatefulWidget { ...@@ -177,23 +177,23 @@ class Slider extends StatefulWidget {
/// shape. /// shape.
final String label; final String label;
/// The color to use for the portion of the slider rail that is active. /// The color to use for the portion of the slider track that is active.
/// ///
/// The "active" side of the slider is the side between the thumb and the /// The "active" side of the slider is the side between the thumb and the
/// minimum value. /// minimum value.
/// ///
/// Defaults to [SliderTheme.activeRailColor] of the current [SliderTheme]. /// Defaults to [SliderTheme.activeTrackColor] of the current [SliderTheme].
/// ///
/// Using a [SliderTheme] gives much more fine-grained control over the /// Using a [SliderTheme] gives much more fine-grained control over the
/// appearance of various components of the slider. /// appearance of various components of the slider.
final Color activeColor; final Color activeColor;
/// The color for the inactive portion of the slider rail. /// The color for the inactive portion of the slider track.
/// ///
/// The "inactive" side of the slider is the side between the thumb and the /// The "inactive" side of the slider is the side between the thumb and the
/// maximum value. /// maximum value.
/// ///
/// Defaults to the [SliderTheme.inactiveRailColor] of the current /// Defaults to the [SliderTheme.inactiveTrackColor] of the current
/// [SliderTheme]. /// [SliderTheme].
/// ///
/// Using a [SliderTheme] gives much more fine-grained control over the /// Using a [SliderTheme] gives much more fine-grained control over the
...@@ -297,8 +297,8 @@ class _SliderState extends State<Slider> with TickerProviderStateMixin { ...@@ -297,8 +297,8 @@ class _SliderState extends State<Slider> with TickerProviderStateMixin {
// control than that, then they need to use a SliderTheme. // control than that, then they need to use a SliderTheme.
if (widget.activeColor != null || widget.inactiveColor != null) { if (widget.activeColor != null || widget.inactiveColor != null) {
sliderTheme = sliderTheme.copyWith( sliderTheme = sliderTheme.copyWith(
activeRailColor: widget.activeColor, activeTrackColor: widget.activeColor,
inactiveRailColor: widget.inactiveColor, inactiveTrackColor: widget.inactiveColor,
activeTickMarkColor: widget.inactiveColor, activeTickMarkColor: widget.inactiveColor,
inactiveTickMarkColor: widget.activeColor, inactiveTickMarkColor: widget.activeColor,
thumbColor: widget.activeColor, thumbColor: widget.activeColor,
...@@ -423,9 +423,9 @@ class _RenderSlider extends RenderBox { ...@@ -423,9 +423,9 @@ class _RenderSlider extends RenderBox {
static const Duration _positionAnimationDuration = const Duration(milliseconds: 75); static const Duration _positionAnimationDuration = const Duration(milliseconds: 75);
static const double _overlayRadius = 16.0; static const double _overlayRadius = 16.0;
static const double _overlayDiameter = _overlayRadius * 2.0; static const double _overlayDiameter = _overlayRadius * 2.0;
static const double _railHeight = 2.0; static const double _trackHeight = 2.0;
static const double _preferredRailWidth = 144.0; static const double _preferredTrackWidth = 144.0;
static const double _preferredTotalWidth = _preferredRailWidth + _overlayDiameter; static const double _preferredTotalWidth = _preferredTrackWidth + _overlayDiameter;
static const Duration _minimumInteractionTime = const Duration(milliseconds: 500); static const Duration _minimumInteractionTime = const Duration(milliseconds: 500);
static const double _adjustmentUnit = 0.1; // Matches iOS implementation of material slider. static const double _adjustmentUnit = 0.1; // Matches iOS implementation of material slider.
static final Tween<double> _overlayRadiusTween = new Tween<double>(begin: 0.0, end: _overlayRadius); static final Tween<double> _overlayRadiusTween = new Tween<double>(begin: 0.0, end: _overlayRadius);
...@@ -440,7 +440,7 @@ class _RenderSlider extends RenderBox { ...@@ -440,7 +440,7 @@ class _RenderSlider extends RenderBox {
bool _active = false; bool _active = false;
double _currentDragValue = 0.0; double _currentDragValue = 0.0;
double get _railLength => size.width - _overlayDiameter; double get _trackLength => size.width - _overlayDiameter;
bool get isInteractive => onChanged != null; bool get isInteractive => onChanged != null;
...@@ -619,7 +619,7 @@ class _RenderSlider extends RenderBox { ...@@ -619,7 +619,7 @@ class _RenderSlider extends RenderBox {
} }
double _getValueFromGlobalPosition(Offset globalPosition) { double _getValueFromGlobalPosition(Offset globalPosition) {
final double visualPosition = (globalToLocal(globalPosition).dx - _overlayRadius) / _railLength; final double visualPosition = (globalToLocal(globalPosition).dx - _overlayRadius) / _trackLength;
return _getValueFromVisualPosition(visualPosition); return _getValueFromVisualPosition(visualPosition);
} }
...@@ -666,7 +666,7 @@ class _RenderSlider extends RenderBox { ...@@ -666,7 +666,7 @@ class _RenderSlider extends RenderBox {
void _handleDragUpdate(DragUpdateDetails details) { void _handleDragUpdate(DragUpdateDetails details) {
if (isInteractive) { if (isInteractive) {
final double valueDelta = details.primaryDelta / _railLength; final double valueDelta = details.primaryDelta / _trackLength;
switch (textDirection) { switch (textDirection) {
case TextDirection.rtl: case TextDirection.rtl:
_currentDragValue -= valueDelta; _currentDragValue -= valueDelta;
...@@ -732,24 +732,24 @@ class _RenderSlider extends RenderBox { ...@@ -732,24 +732,24 @@ class _RenderSlider extends RenderBox {
void _paintTickMarks( void _paintTickMarks(
Canvas canvas, Canvas canvas,
Rect railLeft, Rect trackLeft,
Rect railRight, Rect trackRight,
Paint leftPaint, Paint leftPaint,
Paint rightPaint, Paint rightPaint,
) { ) {
if (isDiscrete) { if (isDiscrete) {
// The ticks are tiny circles that are the same height as the rail. // The ticks are tiny circles that are the same height as the track.
const double tickRadius = _railHeight / 2.0; const double tickRadius = _trackHeight / 2.0;
final double railWidth = railRight.right - railLeft.left; final double trackWidth = trackRight.right - trackLeft.left;
final double dx = (railWidth - _railHeight) / divisions; final double dx = (trackWidth - _trackHeight) / divisions;
// If the ticks would be too dense, don't bother painting them. // If the ticks would be too dense, don't bother painting them.
if (dx >= 3.0 * _railHeight) { if (dx >= 3.0 * _trackHeight) {
for (int i = 0; i <= divisions; i += 1) { for (int i = 0; i <= divisions; i += 1) {
final double left = railLeft.left + i * dx; final double left = trackLeft.left + i * dx;
final Offset center = new Offset(left + tickRadius, railLeft.top + tickRadius); final Offset center = new Offset(left + tickRadius, trackLeft.top + tickRadius);
if (railLeft.contains(center)) { if (trackLeft.contains(center)) {
canvas.drawCircle(center, tickRadius, leftPaint); canvas.drawCircle(center, tickRadius, leftPaint);
} else if (railRight.contains(center)) { } else if (trackRight.contains(center)) {
canvas.drawCircle(center, tickRadius, rightPaint); canvas.drawCircle(center, tickRadius, rightPaint);
} }
} }
...@@ -774,71 +774,71 @@ class _RenderSlider extends RenderBox { ...@@ -774,71 +774,71 @@ class _RenderSlider extends RenderBox {
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
final Canvas canvas = context.canvas; final Canvas canvas = context.canvas;
final double railLength = size.width - 2 * _overlayRadius; final double trackLength = size.width - 2 * _overlayRadius;
final double value = _state.positionController.value; final double value = _state.positionController.value;
final ColorTween activeRailEnableColor = new ColorTween(begin: _sliderTheme.disabledActiveRailColor, end: _sliderTheme.activeRailColor); final ColorTween activeTrackEnableColor = new ColorTween(begin: _sliderTheme.disabledActiveTrackColor, end: _sliderTheme.activeTrackColor);
final ColorTween inactiveRailEnableColor = new ColorTween(begin: _sliderTheme.disabledInactiveRailColor, end: _sliderTheme.inactiveRailColor); final ColorTween inactiveTrackEnableColor = new ColorTween(begin: _sliderTheme.disabledInactiveTrackColor, end: _sliderTheme.inactiveTrackColor);
final ColorTween activeTickMarkEnableColor = new ColorTween(begin: _sliderTheme.disabledActiveTickMarkColor, end: _sliderTheme.activeTickMarkColor); final ColorTween activeTickMarkEnableColor = new ColorTween(begin: _sliderTheme.disabledActiveTickMarkColor, end: _sliderTheme.activeTickMarkColor);
final ColorTween inactiveTickMarkEnableColor = new ColorTween(begin: _sliderTheme.disabledInactiveTickMarkColor, end: _sliderTheme.inactiveTickMarkColor); final ColorTween inactiveTickMarkEnableColor = new ColorTween(begin: _sliderTheme.disabledInactiveTickMarkColor, end: _sliderTheme.inactiveTickMarkColor);
final Paint activeRailPaint = new Paint()..color = activeRailEnableColor.evaluate(_enableAnimation); final Paint activeTrackPaint = new Paint()..color = activeTrackEnableColor.evaluate(_enableAnimation);
final Paint inactiveRailPaint = new Paint()..color = inactiveRailEnableColor.evaluate(_enableAnimation); final Paint inactiveTrackPaint = new Paint()..color = inactiveTrackEnableColor.evaluate(_enableAnimation);
final Paint activeTickMarkPaint = new Paint()..color = activeTickMarkEnableColor.evaluate(_enableAnimation); final Paint activeTickMarkPaint = new Paint()..color = activeTickMarkEnableColor.evaluate(_enableAnimation);
final Paint inactiveTickMarkPaint = new Paint()..color = inactiveTickMarkEnableColor.evaluate(_enableAnimation); final Paint inactiveTickMarkPaint = new Paint()..color = inactiveTickMarkEnableColor.evaluate(_enableAnimation);
double visualPosition; double visualPosition;
Paint leftRailPaint; Paint leftTrackPaint;
Paint rightRailPaint; Paint rightTrackPaint;
Paint leftTickMarkPaint; Paint leftTickMarkPaint;
Paint rightTickMarkPaint; Paint rightTickMarkPaint;
switch (textDirection) { switch (textDirection) {
case TextDirection.rtl: case TextDirection.rtl:
visualPosition = 1.0 - value; visualPosition = 1.0 - value;
leftRailPaint = inactiveRailPaint; leftTrackPaint = inactiveTrackPaint;
rightRailPaint = activeRailPaint; rightTrackPaint = activeTrackPaint;
leftTickMarkPaint = inactiveTickMarkPaint; leftTickMarkPaint = inactiveTickMarkPaint;
rightTickMarkPaint = activeTickMarkPaint; rightTickMarkPaint = activeTickMarkPaint;
break; break;
case TextDirection.ltr: case TextDirection.ltr:
visualPosition = value; visualPosition = value;
leftRailPaint = activeRailPaint; leftTrackPaint = activeTrackPaint;
rightRailPaint = inactiveRailPaint; rightTrackPaint = inactiveTrackPaint;
leftTickMarkPaint = activeTickMarkPaint; leftTickMarkPaint = activeTickMarkPaint;
rightTickMarkPaint = inactiveTickMarkPaint; rightTickMarkPaint = inactiveTickMarkPaint;
break; break;
} }
const double railRadius = _railHeight / 2.0; const double trackRadius = _trackHeight / 2.0;
const double thumbGap = 2.0; const double thumbGap = 2.0;
final double railVerticalCenter = offset.dy + (size.height) / 2.0; final double trackVerticalCenter = offset.dy + (size.height) / 2.0;
final double railLeft = offset.dx + _overlayRadius; final double trackLeft = offset.dx + _overlayRadius;
final double railTop = railVerticalCenter - railRadius; final double trackTop = trackVerticalCenter - trackRadius;
final double railBottom = railVerticalCenter + railRadius; final double trackBottom = trackVerticalCenter + trackRadius;
final double railRight = railLeft + railLength; final double trackRight = trackLeft + trackLength;
final double railActive = railLeft + railLength * visualPosition; final double trackActive = trackLeft + trackLength * visualPosition;
final double thumbRadius = _sliderTheme.thumbShape.getPreferredSize(isInteractive, isDiscrete).width / 2.0; final double thumbRadius = _sliderTheme.thumbShape.getPreferredSize(isInteractive, isDiscrete).width / 2.0;
final double railActiveLeft = math.max(0.0, railActive - thumbRadius - thumbGap * (1.0 - _enableAnimation.value)); final double trackActiveLeft = math.max(0.0, trackActive - thumbRadius - thumbGap * (1.0 - _enableAnimation.value));
final double railActiveRight = math.min(railActive + thumbRadius + thumbGap * (1.0 - _enableAnimation.value), railRight); final double trackActiveRight = math.min(trackActive + thumbRadius + thumbGap * (1.0 - _enableAnimation.value), trackRight);
final Rect railLeftRect = new Rect.fromLTRB(railLeft, railTop, railActiveLeft, railBottom); final Rect trackLeftRect = new Rect.fromLTRB(trackLeft, trackTop, trackActiveLeft, trackBottom);
final Rect railRightRect = new Rect.fromLTRB(railActiveRight, railTop, railRight, railBottom); final Rect trackRightRect = new Rect.fromLTRB(trackActiveRight, trackTop, trackRight, trackBottom);
final Offset thumbCenter = new Offset(railActive, railVerticalCenter); final Offset thumbCenter = new Offset(trackActive, trackVerticalCenter);
// Paint the rail. // Paint the track.
if (visualPosition > 0.0) { if (visualPosition > 0.0) {
canvas.drawRect(railLeftRect, leftRailPaint); canvas.drawRect(trackLeftRect, leftTrackPaint);
} }
if (visualPosition < 1.0) { if (visualPosition < 1.0) {
canvas.drawRect(railRightRect, rightRailPaint); canvas.drawRect(trackRightRect, rightTrackPaint);
} }
_paintOverlay(canvas, thumbCenter); _paintOverlay(canvas, thumbCenter);
_paintTickMarks( _paintTickMarks(
canvas, canvas,
railLeftRect, trackLeftRect,
railRightRect, trackRightRect,
leftTickMarkPaint, leftTickMarkPaint,
rightTickMarkPaint, rightTickMarkPaint,
); );
......
...@@ -62,7 +62,7 @@ class SliderTheme extends InheritedWidget { ...@@ -62,7 +62,7 @@ class SliderTheme extends InheritedWidget {
/// @override /// @override
/// Widget build(BuildContext context) { /// Widget build(BuildContext context) {
/// return new SliderTheme( /// return new SliderTheme(
/// data: SliderTheme.of(context).copyWith(activeRailColor: const Color(0xff804040)), /// data: SliderTheme.of(context).copyWith(activeTrackColor: const Color(0xff804040)),
/// child: new Slider( /// child: new Slider(
/// onChanged: (double value) { setState(() { _rocketThrust = value; }); }, /// onChanged: (double value) { setState(() { _rocketThrust = value; }); },
/// value: _rocketThrust, /// value: _rocketThrust,
...@@ -121,7 +121,7 @@ enum ShowValueIndicator { ...@@ -121,7 +121,7 @@ enum ShowValueIndicator {
/// ///
/// * The "thumb", which is a shape that slides horizontally when the user /// * The "thumb", which is a shape that slides horizontally when the user
/// drags it. /// drags it.
/// * The "rail", which is the line that the slider thumb slides along. /// * The "track", which is the line that the slider thumb slides along.
/// * The "value indicator", which is a shape that pops up when the user /// * The "value indicator", which is a shape that pops up when the user
/// is dragging the thumb to indicate the value being selected. /// is dragging the thumb to indicate the value being selected.
/// * The "active" side of the slider is the side between the thumb and the /// * The "active" side of the slider is the side between the thumb and the
...@@ -169,7 +169,7 @@ class SliderThemeData extends Diagnosticable { ...@@ -169,7 +169,7 @@ class SliderThemeData extends Diagnosticable {
/// @override /// @override
/// Widget build(BuildContext context) { /// Widget build(BuildContext context) {
/// return new SliderTheme( /// return new SliderTheme(
/// data: SliderTheme.of(context).copyWith(activeRailColor: const Color(0xff404080)), /// data: SliderTheme.of(context).copyWith(activeTrackColor: const Color(0xff404080)),
/// child: new Slider( /// child: new Slider(
/// onChanged: (double value) { setState(() { _bliss = value; }); }, /// onChanged: (double value) { setState(() { _bliss = value; }); },
/// value: _bliss, /// value: _bliss,
...@@ -179,10 +179,10 @@ class SliderThemeData extends Diagnosticable { ...@@ -179,10 +179,10 @@ class SliderThemeData extends Diagnosticable {
/// } /// }
/// ``` /// ```
const SliderThemeData({ const SliderThemeData({
@required this.activeRailColor, @required this.activeTrackColor,
@required this.inactiveRailColor, @required this.inactiveTrackColor,
@required this.disabledActiveRailColor, @required this.disabledActiveTrackColor,
@required this.disabledInactiveRailColor, @required this.disabledInactiveTrackColor,
@required this.activeTickMarkColor, @required this.activeTickMarkColor,
@required this.inactiveTickMarkColor, @required this.inactiveTickMarkColor,
@required this.disabledActiveTickMarkColor, @required this.disabledActiveTickMarkColor,
...@@ -195,10 +195,10 @@ class SliderThemeData extends Diagnosticable { ...@@ -195,10 +195,10 @@ class SliderThemeData extends Diagnosticable {
@required this.valueIndicatorShape, @required this.valueIndicatorShape,
@required this.showValueIndicator, @required this.showValueIndicator,
@required this.valueIndicatorTextStyle, @required this.valueIndicatorTextStyle,
}) : assert(activeRailColor != null), }) : assert(activeTrackColor != null),
assert(inactiveRailColor != null), assert(inactiveTrackColor != null),
assert(disabledActiveRailColor != null), assert(disabledActiveTrackColor != null),
assert(disabledInactiveRailColor != null), assert(disabledInactiveTrackColor != null),
assert(activeTickMarkColor != null), assert(activeTickMarkColor != null),
assert(inactiveTickMarkColor != null), assert(inactiveTickMarkColor != null),
assert(disabledActiveTickMarkColor != null), assert(disabledActiveTickMarkColor != null),
...@@ -234,10 +234,10 @@ class SliderThemeData extends Diagnosticable { ...@@ -234,10 +234,10 @@ class SliderThemeData extends Diagnosticable {
// These are Material Design defaults, and are used to derive // These are Material Design defaults, and are used to derive
// component Colors (with opacity) from base colors. // component Colors (with opacity) from base colors.
const int activeRailAlpha = 0xff; const int activeTrackAlpha = 0xff;
const int inactiveRailAlpha = 0x3d; // 24% opacity const int inactiveTrackAlpha = 0x3d; // 24% opacity
const int disabledActiveRailAlpha = 0x52; // 32% opacity const int disabledActiveTrackAlpha = 0x52; // 32% opacity
const int disabledInactiveRailAlpha = 0x1f; // 12% opacity const int disabledInactiveTrackAlpha = 0x1f; // 12% opacity
const int activeTickMarkAlpha = 0x8a; // 54% opacity const int activeTickMarkAlpha = 0x8a; // 54% opacity
const int inactiveTickMarkAlpha = 0x8a; // 54% opacity const int inactiveTickMarkAlpha = 0x8a; // 54% opacity
const int disabledActiveTickMarkAlpha = 0x1f; // 12% opacity const int disabledActiveTickMarkAlpha = 0x1f; // 12% opacity
...@@ -254,10 +254,10 @@ class SliderThemeData extends Diagnosticable { ...@@ -254,10 +254,10 @@ class SliderThemeData extends Diagnosticable {
const int overlayLightAlpha = 0x29; // 16% opacity const int overlayLightAlpha = 0x29; // 16% opacity
return new SliderThemeData( return new SliderThemeData(
activeRailColor: primaryColor.withAlpha(activeRailAlpha), activeTrackColor: primaryColor.withAlpha(activeTrackAlpha),
inactiveRailColor: primaryColor.withAlpha(inactiveRailAlpha), inactiveTrackColor: primaryColor.withAlpha(inactiveTrackAlpha),
disabledActiveRailColor: primaryColorDark.withAlpha(disabledActiveRailAlpha), disabledActiveTrackColor: primaryColorDark.withAlpha(disabledActiveTrackAlpha),
disabledInactiveRailColor: primaryColorDark.withAlpha(disabledInactiveRailAlpha), disabledInactiveTrackColor: primaryColorDark.withAlpha(disabledInactiveTrackAlpha),
activeTickMarkColor: primaryColorLight.withAlpha(activeTickMarkAlpha), activeTickMarkColor: primaryColorLight.withAlpha(activeTickMarkAlpha),
inactiveTickMarkColor: primaryColor.withAlpha(inactiveTickMarkAlpha), inactiveTickMarkColor: primaryColor.withAlpha(inactiveTickMarkAlpha),
disabledActiveTickMarkColor: primaryColorLight.withAlpha(disabledActiveTickMarkAlpha), disabledActiveTickMarkColor: primaryColorLight.withAlpha(disabledActiveTickMarkAlpha),
...@@ -273,35 +273,35 @@ class SliderThemeData extends Diagnosticable { ...@@ -273,35 +273,35 @@ class SliderThemeData extends Diagnosticable {
); );
} }
/// The color of the [Slider] rail between the [Slider.min] position and the /// The color of the [Slider] track between the [Slider.min] position and the
/// current thumb position. /// current thumb position.
final Color activeRailColor; final Color activeTrackColor;
/// The color of the [Slider] rail between the current thumb position and the /// The color of the [Slider] track between the current thumb position and the
/// [Slider.max] position. /// [Slider.max] position.
final Color inactiveRailColor; final Color inactiveTrackColor;
/// The color of the [Slider] rail between the [Slider.min] position and the /// The color of the [Slider] track between the [Slider.min] position and the
/// current thumb position when the [Slider] is disabled. /// current thumb position when the [Slider] is disabled.
final Color disabledActiveRailColor; final Color disabledActiveTrackColor;
/// The color of the [Slider] rail between the current thumb position and the /// The color of the [Slider] track between the current thumb position and the
/// [Slider.max] position when the [Slider] is disabled. /// [Slider.max] position when the [Slider] is disabled.
final Color disabledInactiveRailColor; final Color disabledInactiveTrackColor;
/// The color of the rail's tick marks that are drawn between the [Slider.min] /// The color of the track's tick marks that are drawn between the [Slider.min]
/// position and the current thumb position. /// position and the current thumb position.
final Color activeTickMarkColor; final Color activeTickMarkColor;
/// The color of the rail's tick marks that are drawn between the current /// The color of the track's tick marks that are drawn between the current
/// thumb position and the [Slider.max] position. /// thumb position and the [Slider.max] position.
final Color inactiveTickMarkColor; final Color inactiveTickMarkColor;
/// The color of the rail's tick marks that are drawn between the [Slider.min] /// The color of the track's tick marks that are drawn between the [Slider.min]
/// position and the current thumb position when the [Slider] is disabled. /// position and the current thumb position when the [Slider] is disabled.
final Color disabledActiveTickMarkColor; final Color disabledActiveTickMarkColor;
/// The color of the rail's tick marks that are drawn between the current /// The color of the track's tick marks that are drawn between the current
/// thumb position and the [Slider.max] position when the [Slider] is /// thumb position and the [Slider.max] position when the [Slider] is
/// disabled. /// disabled.
final Color disabledInactiveTickMarkColor; final Color disabledInactiveTickMarkColor;
...@@ -350,10 +350,10 @@ class SliderThemeData extends Diagnosticable { ...@@ -350,10 +350,10 @@ class SliderThemeData extends Diagnosticable {
/// Creates a copy of this object but with the given fields replaced with the /// Creates a copy of this object but with the given fields replaced with the
/// new values. /// new values.
SliderThemeData copyWith({ SliderThemeData copyWith({
Color activeRailColor, Color activeTrackColor,
Color inactiveRailColor, Color inactiveTrackColor,
Color disabledActiveRailColor, Color disabledActiveTrackColor,
Color disabledInactiveRailColor, Color disabledInactiveTrackColor,
Color activeTickMarkColor, Color activeTickMarkColor,
Color inactiveTickMarkColor, Color inactiveTickMarkColor,
Color disabledActiveTickMarkColor, Color disabledActiveTickMarkColor,
...@@ -368,10 +368,10 @@ class SliderThemeData extends Diagnosticable { ...@@ -368,10 +368,10 @@ class SliderThemeData extends Diagnosticable {
TextStyle valueIndicatorTextStyle, TextStyle valueIndicatorTextStyle,
}) { }) {
return new SliderThemeData( return new SliderThemeData(
activeRailColor: activeRailColor ?? this.activeRailColor, activeTrackColor: activeTrackColor ?? this.activeTrackColor,
inactiveRailColor: inactiveRailColor ?? this.inactiveRailColor, inactiveTrackColor: inactiveTrackColor ?? this.inactiveTrackColor,
disabledActiveRailColor: disabledActiveRailColor ?? this.disabledActiveRailColor, disabledActiveTrackColor: disabledActiveTrackColor ?? this.disabledActiveTrackColor,
disabledInactiveRailColor: disabledInactiveRailColor ?? this.disabledInactiveRailColor, disabledInactiveTrackColor: disabledInactiveTrackColor ?? this.disabledInactiveTrackColor,
activeTickMarkColor: activeTickMarkColor ?? this.activeTickMarkColor, activeTickMarkColor: activeTickMarkColor ?? this.activeTickMarkColor,
inactiveTickMarkColor: inactiveTickMarkColor ?? this.inactiveTickMarkColor, inactiveTickMarkColor: inactiveTickMarkColor ?? this.inactiveTickMarkColor,
disabledActiveTickMarkColor: disabledActiveTickMarkColor ?? this.disabledActiveTickMarkColor, disabledActiveTickMarkColor: disabledActiveTickMarkColor ?? this.disabledActiveTickMarkColor,
...@@ -407,10 +407,10 @@ class SliderThemeData extends Diagnosticable { ...@@ -407,10 +407,10 @@ class SliderThemeData extends Diagnosticable {
assert(b != null); assert(b != null);
assert(t != null); assert(t != null);
return new SliderThemeData( return new SliderThemeData(
activeRailColor: Color.lerp(a.activeRailColor, b.activeRailColor, t), activeTrackColor: Color.lerp(a.activeTrackColor, b.activeTrackColor, t),
inactiveRailColor: Color.lerp(a.inactiveRailColor, b.inactiveRailColor, t), inactiveTrackColor: Color.lerp(a.inactiveTrackColor, b.inactiveTrackColor, t),
disabledActiveRailColor: Color.lerp(a.disabledActiveRailColor, b.disabledActiveRailColor, t), disabledActiveTrackColor: Color.lerp(a.disabledActiveTrackColor, b.disabledActiveTrackColor, t),
disabledInactiveRailColor: Color.lerp(a.disabledInactiveRailColor, b.disabledInactiveRailColor, t), disabledInactiveTrackColor: Color.lerp(a.disabledInactiveTrackColor, b.disabledInactiveTrackColor, t),
activeTickMarkColor: Color.lerp(a.activeTickMarkColor, b.activeTickMarkColor, t), activeTickMarkColor: Color.lerp(a.activeTickMarkColor, b.activeTickMarkColor, t),
inactiveTickMarkColor: Color.lerp(a.inactiveTickMarkColor, b.inactiveTickMarkColor, t), inactiveTickMarkColor: Color.lerp(a.inactiveTickMarkColor, b.inactiveTickMarkColor, t),
disabledActiveTickMarkColor: Color.lerp(a.disabledActiveTickMarkColor, b.disabledActiveTickMarkColor, t), disabledActiveTickMarkColor: Color.lerp(a.disabledActiveTickMarkColor, b.disabledActiveTickMarkColor, t),
...@@ -429,10 +429,10 @@ class SliderThemeData extends Diagnosticable { ...@@ -429,10 +429,10 @@ class SliderThemeData extends Diagnosticable {
@override @override
int get hashCode { int get hashCode {
return hashValues( return hashValues(
activeRailColor, activeTrackColor,
inactiveRailColor, inactiveTrackColor,
disabledActiveRailColor, disabledActiveTrackColor,
disabledInactiveRailColor, disabledInactiveTrackColor,
activeTickMarkColor, activeTickMarkColor,
inactiveTickMarkColor, inactiveTickMarkColor,
disabledActiveTickMarkColor, disabledActiveTickMarkColor,
...@@ -457,10 +457,10 @@ class SliderThemeData extends Diagnosticable { ...@@ -457,10 +457,10 @@ class SliderThemeData extends Diagnosticable {
return false; return false;
} }
final SliderThemeData otherData = other; final SliderThemeData otherData = other;
return otherData.activeRailColor == activeRailColor && return otherData.activeTrackColor == activeTrackColor &&
otherData.inactiveRailColor == inactiveRailColor && otherData.inactiveTrackColor == inactiveTrackColor &&
otherData.disabledActiveRailColor == disabledActiveRailColor && otherData.disabledActiveTrackColor == disabledActiveTrackColor &&
otherData.disabledInactiveRailColor == disabledInactiveRailColor && otherData.disabledInactiveTrackColor == disabledInactiveTrackColor &&
otherData.activeTickMarkColor == activeTickMarkColor && otherData.activeTickMarkColor == activeTickMarkColor &&
otherData.inactiveTickMarkColor == inactiveTickMarkColor && otherData.inactiveTickMarkColor == inactiveTickMarkColor &&
otherData.disabledActiveTickMarkColor == disabledActiveTickMarkColor && otherData.disabledActiveTickMarkColor == disabledActiveTickMarkColor &&
...@@ -485,10 +485,10 @@ class SliderThemeData extends Diagnosticable { ...@@ -485,10 +485,10 @@ class SliderThemeData extends Diagnosticable {
primaryColorLight: defaultTheme.primaryColorLight, primaryColorLight: defaultTheme.primaryColorLight,
valueIndicatorTextStyle: defaultTheme.accentTextTheme.body2, valueIndicatorTextStyle: defaultTheme.accentTextTheme.body2,
); );
properties.add(new DiagnosticsProperty<Color>('activeRailColor', activeRailColor, defaultValue: defaultData.activeRailColor)); properties.add(new DiagnosticsProperty<Color>('activeTrackColor', activeTrackColor, defaultValue: defaultData.activeTrackColor));
properties.add(new DiagnosticsProperty<Color>('inactiveRailColor', inactiveRailColor, defaultValue: defaultData.inactiveRailColor)); properties.add(new DiagnosticsProperty<Color>('inactiveTrackColor', inactiveTrackColor, defaultValue: defaultData.inactiveTrackColor));
properties.add(new DiagnosticsProperty<Color>('disabledActiveRailColor', disabledActiveRailColor, defaultValue: defaultData.disabledActiveRailColor, level: DiagnosticLevel.debug)); properties.add(new DiagnosticsProperty<Color>('disabledActiveTrackColor', disabledActiveTrackColor, defaultValue: defaultData.disabledActiveTrackColor, level: DiagnosticLevel.debug));
properties.add(new DiagnosticsProperty<Color>('disabledInactiveRailColor', disabledInactiveRailColor, defaultValue: defaultData.disabledInactiveRailColor, level: DiagnosticLevel.debug)); properties.add(new DiagnosticsProperty<Color>('disabledInactiveTrackColor', disabledInactiveTrackColor, defaultValue: defaultData.disabledInactiveTrackColor, level: DiagnosticLevel.debug));
properties.add(new DiagnosticsProperty<Color>('activeTickMarkColor', activeTickMarkColor, defaultValue: defaultData.activeTickMarkColor, level: DiagnosticLevel.debug)); properties.add(new DiagnosticsProperty<Color>('activeTickMarkColor', activeTickMarkColor, defaultValue: defaultData.activeTickMarkColor, level: DiagnosticLevel.debug));
properties.add(new DiagnosticsProperty<Color>('inactiveTickMarkColor', inactiveTickMarkColor, defaultValue: defaultData.inactiveTickMarkColor, level: DiagnosticLevel.debug)); properties.add(new DiagnosticsProperty<Color>('inactiveTickMarkColor', inactiveTickMarkColor, defaultValue: defaultData.inactiveTickMarkColor, level: DiagnosticLevel.debug));
properties.add(new DiagnosticsProperty<Color>('disabledActiveTickMarkColor', disabledActiveTickMarkColor, defaultValue: defaultData.disabledActiveTickMarkColor, level: DiagnosticLevel.debug)); properties.add(new DiagnosticsProperty<Color>('disabledActiveTickMarkColor', disabledActiveTickMarkColor, defaultValue: defaultData.disabledActiveTickMarkColor, level: DiagnosticLevel.debug));
......
...@@ -555,30 +555,30 @@ void main() { ...@@ -555,30 +555,30 @@ void main() {
final RenderBox sliderBox = tester.firstRenderObject<RenderBox>(find.byType(Slider)); final RenderBox sliderBox = tester.firstRenderObject<RenderBox>(find.byType(Slider));
// Check default theme for enabled widget. // Check default theme for enabled widget.
expect(sliderBox, paints..rect(color: sliderTheme.activeRailColor)..rect(color: sliderTheme.inactiveRailColor)); expect(sliderBox, paints..rect(color: sliderTheme.activeTrackColor)..rect(color: sliderTheme.inactiveTrackColor));
expect(sliderBox, paints..circle(color: sliderTheme.thumbColor)); expect(sliderBox, paints..circle(color: sliderTheme.thumbColor));
expect(sliderBox, isNot(paints..circle(color: sliderTheme.disabledThumbColor))); expect(sliderBox, isNot(paints..circle(color: sliderTheme.disabledThumbColor)));
expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledActiveRailColor))); expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledActiveTrackColor)));
expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledInactiveRailColor))); expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledInactiveTrackColor)));
expect(sliderBox, isNot(paints..circle(color: sliderTheme.activeTickMarkColor))); expect(sliderBox, isNot(paints..circle(color: sliderTheme.activeTickMarkColor)));
expect(sliderBox, isNot(paints..circle(color: sliderTheme.inactiveTickMarkColor))); expect(sliderBox, isNot(paints..circle(color: sliderTheme.inactiveTickMarkColor)));
// Test setting only the activeColor. // Test setting only the activeColor.
await tester.pumpWidget(buildApp(activeColor: customColor1)); await tester.pumpWidget(buildApp(activeColor: customColor1));
expect(sliderBox, paints..rect(color: customColor1)..rect(color: sliderTheme.inactiveRailColor)); expect(sliderBox, paints..rect(color: customColor1)..rect(color: sliderTheme.inactiveTrackColor));
expect(sliderBox, paints..circle(color: customColor1)); expect(sliderBox, paints..circle(color: customColor1));
expect(sliderBox, isNot(paints..circle(color: sliderTheme.thumbColor))); expect(sliderBox, isNot(paints..circle(color: sliderTheme.thumbColor)));
expect(sliderBox, isNot(paints..circle(color: sliderTheme.disabledThumbColor))); expect(sliderBox, isNot(paints..circle(color: sliderTheme.disabledThumbColor)));
expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledActiveRailColor))); expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledActiveTrackColor)));
expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledInactiveRailColor))); expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledInactiveTrackColor)));
// Test setting only the inactiveColor. // Test setting only the inactiveColor.
await tester.pumpWidget(buildApp(inactiveColor: customColor1)); await tester.pumpWidget(buildApp(inactiveColor: customColor1));
expect(sliderBox, paints..rect(color: sliderTheme.activeRailColor)..rect(color: customColor1)); expect(sliderBox, paints..rect(color: sliderTheme.activeTrackColor)..rect(color: customColor1));
expect(sliderBox, paints..circle(color: sliderTheme.thumbColor)); expect(sliderBox, paints..circle(color: sliderTheme.thumbColor));
expect(sliderBox, isNot(paints..circle(color: sliderTheme.disabledThumbColor))); expect(sliderBox, isNot(paints..circle(color: sliderTheme.disabledThumbColor)));
expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledActiveRailColor))); expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledActiveTrackColor)));
expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledInactiveRailColor))); expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledInactiveTrackColor)));
// Test setting both activeColor and inactiveColor. // Test setting both activeColor and inactiveColor.
await tester.pumpWidget(buildApp(activeColor: customColor1, inactiveColor: customColor2)); await tester.pumpWidget(buildApp(activeColor: customColor1, inactiveColor: customColor2));
...@@ -586,12 +586,12 @@ void main() { ...@@ -586,12 +586,12 @@ void main() {
expect(sliderBox, paints..circle(color: customColor1)); expect(sliderBox, paints..circle(color: customColor1));
expect(sliderBox, isNot(paints..circle(color: sliderTheme.thumbColor))); expect(sliderBox, isNot(paints..circle(color: sliderTheme.thumbColor)));
expect(sliderBox, isNot(paints..circle(color: sliderTheme.disabledThumbColor))); expect(sliderBox, isNot(paints..circle(color: sliderTheme.disabledThumbColor)));
expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledActiveRailColor))); expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledActiveTrackColor)));
expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledInactiveRailColor))); expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledInactiveTrackColor)));
// Test colors for discrete slider. // Test colors for discrete slider.
await tester.pumpWidget(buildApp(divisions: 3)); await tester.pumpWidget(buildApp(divisions: 3));
expect(sliderBox, paints..rect(color: sliderTheme.activeRailColor)..rect(color: sliderTheme.inactiveRailColor)); expect(sliderBox, paints..rect(color: sliderTheme.activeTrackColor)..rect(color: sliderTheme.inactiveTrackColor));
expect( expect(
sliderBox, sliderBox,
paints paints
...@@ -601,8 +601,8 @@ void main() { ...@@ -601,8 +601,8 @@ void main() {
..circle(color: sliderTheme.inactiveTickMarkColor) ..circle(color: sliderTheme.inactiveTickMarkColor)
..circle(color: sliderTheme.thumbColor)); ..circle(color: sliderTheme.thumbColor));
expect(sliderBox, isNot(paints..circle(color: sliderTheme.disabledThumbColor))); expect(sliderBox, isNot(paints..circle(color: sliderTheme.disabledThumbColor)));
expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledActiveRailColor))); expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledActiveTrackColor)));
expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledInactiveRailColor))); expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledInactiveTrackColor)));
// Test colors for discrete slider with inactiveColor and activeColor set. // Test colors for discrete slider with inactiveColor and activeColor set.
await tester.pumpWidget(buildApp( await tester.pumpWidget(buildApp(
...@@ -621,8 +621,8 @@ void main() { ...@@ -621,8 +621,8 @@ void main() {
..circle(color: customColor1)); ..circle(color: customColor1));
expect(sliderBox, isNot(paints..circle(color: sliderTheme.thumbColor))); expect(sliderBox, isNot(paints..circle(color: sliderTheme.thumbColor)));
expect(sliderBox, isNot(paints..circle(color: sliderTheme.disabledThumbColor))); expect(sliderBox, isNot(paints..circle(color: sliderTheme.disabledThumbColor)));
expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledActiveRailColor))); expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledActiveTrackColor)));
expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledInactiveRailColor))); expect(sliderBox, isNot(paints..rect(color: sliderTheme.disabledInactiveTrackColor)));
expect(sliderBox, isNot(paints..circle(color: sliderTheme.activeTickMarkColor))); expect(sliderBox, isNot(paints..circle(color: sliderTheme.activeTickMarkColor)));
expect(sliderBox, isNot(paints..circle(color: sliderTheme.inactiveTickMarkColor))); expect(sliderBox, isNot(paints..circle(color: sliderTheme.inactiveTickMarkColor)));
...@@ -632,24 +632,24 @@ void main() { ...@@ -632,24 +632,24 @@ void main() {
expect( expect(
sliderBox, sliderBox,
paints paints
..rect(color: sliderTheme.disabledActiveRailColor) ..rect(color: sliderTheme.disabledActiveTrackColor)
..rect(color: sliderTheme.disabledInactiveRailColor)); ..rect(color: sliderTheme.disabledInactiveTrackColor));
expect(sliderBox, paints..circle(color: sliderTheme.disabledThumbColor)); expect(sliderBox, paints..circle(color: sliderTheme.disabledThumbColor));
expect(sliderBox, isNot(paints..circle(color: sliderTheme.thumbColor))); expect(sliderBox, isNot(paints..circle(color: sliderTheme.thumbColor)));
expect(sliderBox, isNot(paints..rect(color: sliderTheme.activeRailColor))); expect(sliderBox, isNot(paints..rect(color: sliderTheme.activeTrackColor)));
expect(sliderBox, isNot(paints..rect(color: sliderTheme.inactiveRailColor))); expect(sliderBox, isNot(paints..rect(color: sliderTheme.inactiveTrackColor)));
// Test setting the activeColor and inactiveColor for disabled widget. // Test setting the activeColor and inactiveColor for disabled widget.
await tester.pumpWidget(buildApp(activeColor: customColor1, inactiveColor: customColor2, enabled: false)); await tester.pumpWidget(buildApp(activeColor: customColor1, inactiveColor: customColor2, enabled: false));
expect( expect(
sliderBox, sliderBox,
paints paints
..rect(color: sliderTheme.disabledActiveRailColor) ..rect(color: sliderTheme.disabledActiveTrackColor)
..rect(color: sliderTheme.disabledInactiveRailColor)); ..rect(color: sliderTheme.disabledInactiveTrackColor));
expect(sliderBox, paints..circle(color: sliderTheme.disabledThumbColor)); expect(sliderBox, paints..circle(color: sliderTheme.disabledThumbColor));
expect(sliderBox, isNot(paints..circle(color: sliderTheme.thumbColor))); expect(sliderBox, isNot(paints..circle(color: sliderTheme.thumbColor)));
expect(sliderBox, isNot(paints..rect(color: sliderTheme.activeRailColor))); expect(sliderBox, isNot(paints..rect(color: sliderTheme.activeTrackColor)));
expect(sliderBox, isNot(paints..rect(color: sliderTheme.inactiveRailColor))); expect(sliderBox, isNot(paints..rect(color: sliderTheme.inactiveTrackColor)));
// Test that the default value indicator has the right colors. // Test that the default value indicator has the right colors.
await tester.pumpWidget(buildApp(divisions: 3)); await tester.pumpWidget(buildApp(divisions: 3));
...@@ -661,8 +661,8 @@ void main() { ...@@ -661,8 +661,8 @@ void main() {
expect( expect(
sliderBox, sliderBox,
paints paints
..rect(color: sliderTheme.activeRailColor) ..rect(color: sliderTheme.activeTrackColor)
..rect(color: sliderTheme.inactiveRailColor) ..rect(color: sliderTheme.inactiveTrackColor)
..circle(color: sliderTheme.overlayColor) ..circle(color: sliderTheme.overlayColor)
..circle(color: sliderTheme.activeTickMarkColor) ..circle(color: sliderTheme.activeTickMarkColor)
..circle(color: sliderTheme.activeTickMarkColor) ..circle(color: sliderTheme.activeTickMarkColor)
......
...@@ -19,8 +19,8 @@ void main() { ...@@ -19,8 +19,8 @@ void main() {
); );
final SliderThemeData sliderTheme = theme.sliderTheme; final SliderThemeData sliderTheme = theme.sliderTheme;
expect(sliderTheme.activeRailColor.value, equals(Colors.red.value)); expect(sliderTheme.activeTrackColor.value, equals(Colors.red.value));
expect(sliderTheme.inactiveRailColor.value, equals(Colors.red.withAlpha(0x3d).value)); expect(sliderTheme.inactiveTrackColor.value, equals(Colors.red.withAlpha(0x3d).value));
}); });
testWidgets('Slider uses ThemeData slider theme if present', (WidgetTester tester) async { testWidgets('Slider uses ThemeData slider theme if present', (WidgetTester tester) async {
...@@ -55,7 +55,7 @@ void main() { ...@@ -55,7 +55,7 @@ void main() {
final RenderBox sliderBox = tester.firstRenderObject<RenderBox>(find.byType(Slider)); final RenderBox sliderBox = tester.firstRenderObject<RenderBox>(find.byType(Slider));
expect(sliderBox, paints..rect(color: sliderTheme.disabledActiveRailColor)..rect(color: sliderTheme.disabledInactiveRailColor)); expect(sliderBox, paints..rect(color: sliderTheme.disabledActiveTrackColor)..rect(color: sliderTheme.disabledInactiveTrackColor));
}); });
testWidgets('Slider overrides ThemeData theme if SliderTheme present', (WidgetTester tester) async { testWidgets('Slider overrides ThemeData theme if SliderTheme present', (WidgetTester tester) async {
...@@ -65,8 +65,8 @@ void main() { ...@@ -65,8 +65,8 @@ void main() {
); );
final SliderThemeData sliderTheme = theme.sliderTheme; final SliderThemeData sliderTheme = theme.sliderTheme;
final SliderThemeData customTheme = sliderTheme.copyWith( final SliderThemeData customTheme = sliderTheme.copyWith(
activeRailColor: Colors.purple, activeTrackColor: Colors.purple,
inactiveRailColor: Colors.purple.withAlpha(0x3d), inactiveTrackColor: Colors.purple.withAlpha(0x3d),
); );
Widget buildSlider(SliderThemeData data) { Widget buildSlider(SliderThemeData data) {
...@@ -97,7 +97,7 @@ void main() { ...@@ -97,7 +97,7 @@ void main() {
final RenderBox sliderBox = tester.firstRenderObject<RenderBox>(find.byType(Slider)); final RenderBox sliderBox = tester.firstRenderObject<RenderBox>(find.byType(Slider));
expect(sliderBox, paints..rect(color: customTheme.disabledActiveRailColor)..rect(color: customTheme.disabledInactiveRailColor)); expect(sliderBox, paints..rect(color: customTheme.disabledActiveTrackColor)..rect(color: customTheme.disabledInactiveTrackColor));
}); });
testWidgets('SliderThemeData generates correct opacities for fromPrimaryColors', (WidgetTester tester) async { testWidgets('SliderThemeData generates correct opacities for fromPrimaryColors', (WidgetTester tester) async {
...@@ -113,10 +113,10 @@ void main() { ...@@ -113,10 +113,10 @@ void main() {
valueIndicatorTextStyle: new ThemeData.fallback().accentTextTheme.body2.copyWith(color: customColor4), valueIndicatorTextStyle: new ThemeData.fallback().accentTextTheme.body2.copyWith(color: customColor4),
); );
expect(sliderTheme.activeRailColor, equals(customColor1.withAlpha(0xff))); expect(sliderTheme.activeTrackColor, equals(customColor1.withAlpha(0xff)));
expect(sliderTheme.inactiveRailColor, equals(customColor1.withAlpha(0x3d))); expect(sliderTheme.inactiveTrackColor, equals(customColor1.withAlpha(0x3d)));
expect(sliderTheme.disabledActiveRailColor, equals(customColor2.withAlpha(0x52))); expect(sliderTheme.disabledActiveTrackColor, equals(customColor2.withAlpha(0x52)));
expect(sliderTheme.disabledInactiveRailColor, equals(customColor2.withAlpha(0x1f))); expect(sliderTheme.disabledInactiveTrackColor, equals(customColor2.withAlpha(0x1f)));
expect(sliderTheme.activeTickMarkColor, equals(customColor3.withAlpha(0x8a))); expect(sliderTheme.activeTickMarkColor, equals(customColor3.withAlpha(0x8a)));
expect(sliderTheme.inactiveTickMarkColor, equals(customColor1.withAlpha(0x8a))); expect(sliderTheme.inactiveTickMarkColor, equals(customColor1.withAlpha(0x8a)));
expect(sliderTheme.disabledActiveTickMarkColor, equals(customColor3.withAlpha(0x1f))); expect(sliderTheme.disabledActiveTickMarkColor, equals(customColor3.withAlpha(0x1f)));
...@@ -146,10 +146,10 @@ void main() { ...@@ -146,10 +146,10 @@ void main() {
); );
final SliderThemeData lerp = SliderThemeData.lerp(sliderThemeBlack, sliderThemeWhite, 0.5); final SliderThemeData lerp = SliderThemeData.lerp(sliderThemeBlack, sliderThemeWhite, 0.5);
const Color middleGrey = const Color(0xff7f7f7f); const Color middleGrey = const Color(0xff7f7f7f);
expect(lerp.activeRailColor, equals(middleGrey.withAlpha(0xff))); expect(lerp.activeTrackColor, equals(middleGrey.withAlpha(0xff)));
expect(lerp.inactiveRailColor, equals(middleGrey.withAlpha(0x3d))); expect(lerp.inactiveTrackColor, equals(middleGrey.withAlpha(0x3d)));
expect(lerp.disabledActiveRailColor, equals(middleGrey.withAlpha(0x52))); expect(lerp.disabledActiveTrackColor, equals(middleGrey.withAlpha(0x52)));
expect(lerp.disabledInactiveRailColor, equals(middleGrey.withAlpha(0x1f))); expect(lerp.disabledInactiveTrackColor, equals(middleGrey.withAlpha(0x1f)));
expect(lerp.activeTickMarkColor, equals(middleGrey.withAlpha(0x8a))); expect(lerp.activeTickMarkColor, equals(middleGrey.withAlpha(0x8a)));
expect(lerp.inactiveTickMarkColor, equals(middleGrey.withAlpha(0x8a))); expect(lerp.inactiveTickMarkColor, equals(middleGrey.withAlpha(0x8a)));
expect(lerp.disabledActiveTickMarkColor, equals(middleGrey.withAlpha(0x1f))); expect(lerp.disabledActiveTickMarkColor, equals(middleGrey.withAlpha(0x1f)));
......
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