Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
5129d8ff
Unverified
Commit
5129d8ff
authored
6 years ago
by
Greg Spencer
Committed by
GitHub
6 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename Rail to Track, per UX guideline (#16519)
parent
4dbbf678
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
150 additions
and
150 deletions
+150
-150
slider_demo.dart
examples/flutter_gallery/lib/demo/material/slider_demo.dart
+2
-2
slider.dart
packages/flutter/lib/src/material/slider.dart
+53
-53
slider_theme.dart
packages/flutter/lib/src/material/slider_theme.dart
+55
-55
slider_test.dart
packages/flutter/test/material/slider_test.dart
+26
-26
slider_theme_test.dart
packages/flutter/test/material/slider_theme_test.dart
+14
-14
No files found.
examples/flutter_gallery/lib/demo/material/slider_demo.dart
View file @
5129d8ff
...
...
@@ -184,8 +184,8 @@ class _SliderDemoState extends State<SliderDemo> {
children:
<
Widget
>[
new
SliderTheme
(
data:
theme
.
sliderTheme
.
copyWith
(
active
Rail
Color:
Colors
.
deepPurple
,
inactive
Rail
Color:
Colors
.
black26
,
active
Track
Color:
Colors
.
deepPurple
,
inactive
Track
Color:
Colors
.
black26
,
activeTickMarkColor:
Colors
.
white70
,
inactiveTickMarkColor:
Colors
.
black
,
overlayColor:
Colors
.
black12
,
...
...
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/material/slider.dart
View file @
5129d8ff
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/material/slider_theme.dart
View file @
5129d8ff
This diff is collapsed.
Click to expand it.
packages/flutter/test/material/slider_test.dart
View file @
5129d8ff
...
...
@@ -555,30 +555,30 @@ void main() {
final
RenderBox
sliderBox
=
tester
.
firstRenderObject
<
RenderBox
>(
find
.
byType
(
Slider
));
// Check default theme for enabled widget.
expect
(
sliderBox
,
paints
..
rect
(
color:
sliderTheme
.
active
RailColor
)..
rect
(
color:
sliderTheme
.
inactiveRail
Color
));
expect
(
sliderBox
,
paints
..
rect
(
color:
sliderTheme
.
active
TrackColor
)..
rect
(
color:
sliderTheme
.
inactiveTrack
Color
));
expect
(
sliderBox
,
paints
..
circle
(
color:
sliderTheme
.
thumbColor
));
expect
(
sliderBox
,
isNot
(
paints
..
circle
(
color:
sliderTheme
.
disabledThumbColor
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
disabledActive
Rail
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
disabledInactive
Rail
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
disabledActive
Track
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
disabledInactive
Track
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
circle
(
color:
sliderTheme
.
activeTickMarkColor
)));
expect
(
sliderBox
,
isNot
(
paints
..
circle
(
color:
sliderTheme
.
inactiveTickMarkColor
)));
// Test setting only the activeColor.
await
tester
.
pumpWidget
(
buildApp
(
activeColor:
customColor1
));
expect
(
sliderBox
,
paints
..
rect
(
color:
customColor1
)..
rect
(
color:
sliderTheme
.
inactive
Rail
Color
));
expect
(
sliderBox
,
paints
..
rect
(
color:
customColor1
)..
rect
(
color:
sliderTheme
.
inactive
Track
Color
));
expect
(
sliderBox
,
paints
..
circle
(
color:
customColor1
));
expect
(
sliderBox
,
isNot
(
paints
..
circle
(
color:
sliderTheme
.
thumbColor
)));
expect
(
sliderBox
,
isNot
(
paints
..
circle
(
color:
sliderTheme
.
disabledThumbColor
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
disabledActive
Rail
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
disabledInactive
Rail
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
disabledActive
Track
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
disabledInactive
Track
Color
)));
// Test setting only the inactiveColor.
await
tester
.
pumpWidget
(
buildApp
(
inactiveColor:
customColor1
));
expect
(
sliderBox
,
paints
..
rect
(
color:
sliderTheme
.
active
Rail
Color
)..
rect
(
color:
customColor1
));
expect
(
sliderBox
,
paints
..
rect
(
color:
sliderTheme
.
active
Track
Color
)..
rect
(
color:
customColor1
));
expect
(
sliderBox
,
paints
..
circle
(
color:
sliderTheme
.
thumbColor
));
expect
(
sliderBox
,
isNot
(
paints
..
circle
(
color:
sliderTheme
.
disabledThumbColor
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
disabledActive
Rail
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
disabledInactive
Rail
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
disabledActive
Track
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
disabledInactive
Track
Color
)));
// Test setting both activeColor and inactiveColor.
await
tester
.
pumpWidget
(
buildApp
(
activeColor:
customColor1
,
inactiveColor:
customColor2
));
...
...
@@ -586,12 +586,12 @@ void main() {
expect
(
sliderBox
,
paints
..
circle
(
color:
customColor1
));
expect
(
sliderBox
,
isNot
(
paints
..
circle
(
color:
sliderTheme
.
thumbColor
)));
expect
(
sliderBox
,
isNot
(
paints
..
circle
(
color:
sliderTheme
.
disabledThumbColor
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
disabledActive
Rail
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
disabledInactive
Rail
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
disabledActive
Track
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
disabledInactive
Track
Color
)));
// Test colors for discrete slider.
await
tester
.
pumpWidget
(
buildApp
(
divisions:
3
));
expect
(
sliderBox
,
paints
..
rect
(
color:
sliderTheme
.
active
RailColor
)..
rect
(
color:
sliderTheme
.
inactiveRail
Color
));
expect
(
sliderBox
,
paints
..
rect
(
color:
sliderTheme
.
active
TrackColor
)..
rect
(
color:
sliderTheme
.
inactiveTrack
Color
));
expect
(
sliderBox
,
paints
...
...
@@ -601,8 +601,8 @@ void main() {
..
circle
(
color:
sliderTheme
.
inactiveTickMarkColor
)
..
circle
(
color:
sliderTheme
.
thumbColor
));
expect
(
sliderBox
,
isNot
(
paints
..
circle
(
color:
sliderTheme
.
disabledThumbColor
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
disabledActive
Rail
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
disabledInactive
Rail
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
disabledActive
Track
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
disabledInactive
Track
Color
)));
// Test colors for discrete slider with inactiveColor and activeColor set.
await
tester
.
pumpWidget
(
buildApp
(
...
...
@@ -621,8 +621,8 @@ void main() {
..
circle
(
color:
customColor1
));
expect
(
sliderBox
,
isNot
(
paints
..
circle
(
color:
sliderTheme
.
thumbColor
)));
expect
(
sliderBox
,
isNot
(
paints
..
circle
(
color:
sliderTheme
.
disabledThumbColor
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
disabledActive
Rail
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
disabledInactive
Rail
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
disabledActive
Track
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
disabledInactive
Track
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
circle
(
color:
sliderTheme
.
activeTickMarkColor
)));
expect
(
sliderBox
,
isNot
(
paints
..
circle
(
color:
sliderTheme
.
inactiveTickMarkColor
)));
...
...
@@ -632,24 +632,24 @@ void main() {
expect
(
sliderBox
,
paints
..
rect
(
color:
sliderTheme
.
disabledActive
Rail
Color
)
..
rect
(
color:
sliderTheme
.
disabledInactive
Rail
Color
));
..
rect
(
color:
sliderTheme
.
disabledActive
Track
Color
)
..
rect
(
color:
sliderTheme
.
disabledInactive
Track
Color
));
expect
(
sliderBox
,
paints
..
circle
(
color:
sliderTheme
.
disabledThumbColor
));
expect
(
sliderBox
,
isNot
(
paints
..
circle
(
color:
sliderTheme
.
thumbColor
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
active
Rail
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
inactive
Rail
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
active
Track
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
inactive
Track
Color
)));
// Test setting the activeColor and inactiveColor for disabled widget.
await
tester
.
pumpWidget
(
buildApp
(
activeColor:
customColor1
,
inactiveColor:
customColor2
,
enabled:
false
));
expect
(
sliderBox
,
paints
..
rect
(
color:
sliderTheme
.
disabledActive
Rail
Color
)
..
rect
(
color:
sliderTheme
.
disabledInactive
Rail
Color
));
..
rect
(
color:
sliderTheme
.
disabledActive
Track
Color
)
..
rect
(
color:
sliderTheme
.
disabledInactive
Track
Color
));
expect
(
sliderBox
,
paints
..
circle
(
color:
sliderTheme
.
disabledThumbColor
));
expect
(
sliderBox
,
isNot
(
paints
..
circle
(
color:
sliderTheme
.
thumbColor
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
active
Rail
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
inactive
Rail
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
active
Track
Color
)));
expect
(
sliderBox
,
isNot
(
paints
..
rect
(
color:
sliderTheme
.
inactive
Track
Color
)));
// Test that the default value indicator has the right colors.
await
tester
.
pumpWidget
(
buildApp
(
divisions:
3
));
...
...
@@ -661,8 +661,8 @@ void main() {
expect
(
sliderBox
,
paints
..
rect
(
color:
sliderTheme
.
active
Rail
Color
)
..
rect
(
color:
sliderTheme
.
inactive
Rail
Color
)
..
rect
(
color:
sliderTheme
.
active
Track
Color
)
..
rect
(
color:
sliderTheme
.
inactive
Track
Color
)
..
circle
(
color:
sliderTheme
.
overlayColor
)
..
circle
(
color:
sliderTheme
.
activeTickMarkColor
)
..
circle
(
color:
sliderTheme
.
activeTickMarkColor
)
...
...
This diff is collapsed.
Click to expand it.
packages/flutter/test/material/slider_theme_test.dart
View file @
5129d8ff
...
...
@@ -19,8 +19,8 @@ void main() {
);
final
SliderThemeData
sliderTheme
=
theme
.
sliderTheme
;
expect
(
sliderTheme
.
active
Rail
Color
.
value
,
equals
(
Colors
.
red
.
value
));
expect
(
sliderTheme
.
inactive
Rail
Color
.
value
,
equals
(
Colors
.
red
.
withAlpha
(
0x3d
).
value
));
expect
(
sliderTheme
.
active
Track
Color
.
value
,
equals
(
Colors
.
red
.
value
));
expect
(
sliderTheme
.
inactive
Track
Color
.
value
,
equals
(
Colors
.
red
.
withAlpha
(
0x3d
).
value
));
});
testWidgets
(
'Slider uses ThemeData slider theme if present'
,
(
WidgetTester
tester
)
async
{
...
...
@@ -55,7 +55,7 @@ void main() {
final
RenderBox
sliderBox
=
tester
.
firstRenderObject
<
RenderBox
>(
find
.
byType
(
Slider
));
expect
(
sliderBox
,
paints
..
rect
(
color:
sliderTheme
.
disabledActive
RailColor
)..
rect
(
color:
sliderTheme
.
disabledInactiveRail
Color
));
expect
(
sliderBox
,
paints
..
rect
(
color:
sliderTheme
.
disabledActive
TrackColor
)..
rect
(
color:
sliderTheme
.
disabledInactiveTrack
Color
));
});
testWidgets
(
'Slider overrides ThemeData theme if SliderTheme present'
,
(
WidgetTester
tester
)
async
{
...
...
@@ -65,8 +65,8 @@ void main() {
);
final
SliderThemeData
sliderTheme
=
theme
.
sliderTheme
;
final
SliderThemeData
customTheme
=
sliderTheme
.
copyWith
(
active
Rail
Color:
Colors
.
purple
,
inactive
Rail
Color:
Colors
.
purple
.
withAlpha
(
0x3d
),
active
Track
Color:
Colors
.
purple
,
inactive
Track
Color:
Colors
.
purple
.
withAlpha
(
0x3d
),
);
Widget
buildSlider
(
SliderThemeData
data
)
{
...
...
@@ -97,7 +97,7 @@ void main() {
final
RenderBox
sliderBox
=
tester
.
firstRenderObject
<
RenderBox
>(
find
.
byType
(
Slider
));
expect
(
sliderBox
,
paints
..
rect
(
color:
customTheme
.
disabledActive
RailColor
)..
rect
(
color:
customTheme
.
disabledInactiveRail
Color
));
expect
(
sliderBox
,
paints
..
rect
(
color:
customTheme
.
disabledActive
TrackColor
)..
rect
(
color:
customTheme
.
disabledInactiveTrack
Color
));
});
testWidgets
(
'SliderThemeData generates correct opacities for fromPrimaryColors'
,
(
WidgetTester
tester
)
async
{
...
...
@@ -113,10 +113,10 @@ void main() {
valueIndicatorTextStyle:
new
ThemeData
.
fallback
().
accentTextTheme
.
body2
.
copyWith
(
color:
customColor4
),
);
expect
(
sliderTheme
.
active
Rail
Color
,
equals
(
customColor1
.
withAlpha
(
0xff
)));
expect
(
sliderTheme
.
inactive
Rail
Color
,
equals
(
customColor1
.
withAlpha
(
0x3d
)));
expect
(
sliderTheme
.
disabledActive
Rail
Color
,
equals
(
customColor2
.
withAlpha
(
0x52
)));
expect
(
sliderTheme
.
disabledInactive
Rail
Color
,
equals
(
customColor2
.
withAlpha
(
0x1f
)));
expect
(
sliderTheme
.
active
Track
Color
,
equals
(
customColor1
.
withAlpha
(
0xff
)));
expect
(
sliderTheme
.
inactive
Track
Color
,
equals
(
customColor1
.
withAlpha
(
0x3d
)));
expect
(
sliderTheme
.
disabledActive
Track
Color
,
equals
(
customColor2
.
withAlpha
(
0x52
)));
expect
(
sliderTheme
.
disabledInactive
Track
Color
,
equals
(
customColor2
.
withAlpha
(
0x1f
)));
expect
(
sliderTheme
.
activeTickMarkColor
,
equals
(
customColor3
.
withAlpha
(
0x8a
)));
expect
(
sliderTheme
.
inactiveTickMarkColor
,
equals
(
customColor1
.
withAlpha
(
0x8a
)));
expect
(
sliderTheme
.
disabledActiveTickMarkColor
,
equals
(
customColor3
.
withAlpha
(
0x1f
)));
...
...
@@ -146,10 +146,10 @@ void main() {
);
final
SliderThemeData
lerp
=
SliderThemeData
.
lerp
(
sliderThemeBlack
,
sliderThemeWhite
,
0.5
);
const
Color
middleGrey
=
const
Color
(
0xff7f7f7f
);
expect
(
lerp
.
active
Rail
Color
,
equals
(
middleGrey
.
withAlpha
(
0xff
)));
expect
(
lerp
.
inactive
Rail
Color
,
equals
(
middleGrey
.
withAlpha
(
0x3d
)));
expect
(
lerp
.
disabledActive
Rail
Color
,
equals
(
middleGrey
.
withAlpha
(
0x52
)));
expect
(
lerp
.
disabledInactive
Rail
Color
,
equals
(
middleGrey
.
withAlpha
(
0x1f
)));
expect
(
lerp
.
active
Track
Color
,
equals
(
middleGrey
.
withAlpha
(
0xff
)));
expect
(
lerp
.
inactive
Track
Color
,
equals
(
middleGrey
.
withAlpha
(
0x3d
)));
expect
(
lerp
.
disabledActive
Track
Color
,
equals
(
middleGrey
.
withAlpha
(
0x52
)));
expect
(
lerp
.
disabledInactive
Track
Color
,
equals
(
middleGrey
.
withAlpha
(
0x1f
)));
expect
(
lerp
.
activeTickMarkColor
,
equals
(
middleGrey
.
withAlpha
(
0x8a
)));
expect
(
lerp
.
inactiveTickMarkColor
,
equals
(
middleGrey
.
withAlpha
(
0x8a
)));
expect
(
lerp
.
disabledActiveTickMarkColor
,
equals
(
middleGrey
.
withAlpha
(
0x1f
)));
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment