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
0d3d8d4b
Unverified
Commit
0d3d8d4b
authored
Jun 06, 2022
by
Jonah Williams
Committed by
GitHub
Jun 06, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[framework] respect debugDisableShadows in slider thumbs (#105467)
parent
9f735613
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
867 additions
and
740 deletions
+867
-740
slider_theme.dart
packages/flutter/lib/src/material/slider_theme.dart
+38
-2
range_slider_test.dart
packages/flutter/test/material/range_slider_test.dart
+13
-7
slider_test.dart
packages/flutter/test/material/slider_test.dart
+342
-332
slider_theme_test.dart
packages/flutter/test/material/slider_theme_test.dart
+474
-399
No files found.
packages/flutter/lib/src/material/slider_theme.dart
View file @
0d3d8d4b
...
@@ -2366,7 +2366,19 @@ class RoundSliderThumbShape extends SliderComponentShape {
...
@@ -2366,7 +2366,19 @@ class RoundSliderThumbShape extends SliderComponentShape {
final
double
evaluatedElevation
=
elevationTween
.
evaluate
(
activationAnimation
);
final
double
evaluatedElevation
=
elevationTween
.
evaluate
(
activationAnimation
);
final
Path
path
=
Path
()
final
Path
path
=
Path
()
..
addArc
(
Rect
.
fromCenter
(
center:
center
,
width:
2
*
radius
,
height:
2
*
radius
),
0
,
math
.
pi
*
2
);
..
addArc
(
Rect
.
fromCenter
(
center:
center
,
width:
2
*
radius
,
height:
2
*
radius
),
0
,
math
.
pi
*
2
);
canvas
.
drawShadow
(
path
,
Colors
.
black
,
evaluatedElevation
,
true
);
bool
paintShadows
=
true
;
assert
(()
{
if
(
debugDisableShadows
)
{
_debugDrawShadow
(
canvas
,
path
,
evaluatedElevation
);
paintShadows
=
false
;
}
return
true
;
}());
if
(
paintShadows
)
{
canvas
.
drawShadow
(
path
,
Colors
.
black
,
evaluatedElevation
,
true
);
}
canvas
.
drawCircle
(
canvas
.
drawCircle
(
center
,
center
,
...
@@ -2475,7 +2487,19 @@ class RoundRangeSliderThumbShape extends RangeSliderThumbShape {
...
@@ -2475,7 +2487,19 @@ class RoundRangeSliderThumbShape extends RangeSliderThumbShape {
final
double
evaluatedElevation
=
isPressed
!
?
elevationTween
.
evaluate
(
activationAnimation
)
:
elevation
;
final
double
evaluatedElevation
=
isPressed
!
?
elevationTween
.
evaluate
(
activationAnimation
)
:
elevation
;
final
Path
shadowPath
=
Path
()
final
Path
shadowPath
=
Path
()
..
addArc
(
Rect
.
fromCenter
(
center:
center
,
width:
2
*
radius
,
height:
2
*
radius
),
0
,
math
.
pi
*
2
);
..
addArc
(
Rect
.
fromCenter
(
center:
center
,
width:
2
*
radius
,
height:
2
*
radius
),
0
,
math
.
pi
*
2
);
canvas
.
drawShadow
(
shadowPath
,
Colors
.
black
,
evaluatedElevation
,
true
);
bool
paintShadows
=
true
;
assert
(()
{
if
(
debugDisableShadows
)
{
_debugDrawShadow
(
canvas
,
shadowPath
,
evaluatedElevation
);
paintShadows
=
false
;
}
return
true
;
}());
if
(
paintShadows
)
{
canvas
.
drawShadow
(
shadowPath
,
Colors
.
black
,
evaluatedElevation
,
true
);
}
canvas
.
drawCircle
(
canvas
.
drawCircle
(
center
,
center
,
...
@@ -3359,3 +3383,15 @@ class RangeLabels {
...
@@ -3359,3 +3383,15 @@ class RangeLabels {
return
'
${objectRuntimeType(this, 'RangeLabels')}
(
$start
,
$end
)'
;
return
'
${objectRuntimeType(this, 'RangeLabels')}
(
$start
,
$end
)'
;
}
}
}
}
void
_debugDrawShadow
(
Canvas
canvas
,
Path
path
,
double
elevation
)
{
if
(
elevation
>
0.0
)
{
canvas
.
drawPath
(
path
,
Paint
()
..
color
=
Colors
.
black
..
style
=
PaintingStyle
.
stroke
..
strokeWidth
=
elevation
*
2.0
,
);
}
}
packages/flutter/test/material/range_slider_test.dart
View file @
0d3d8d4b
...
@@ -1276,8 +1276,10 @@ void main() {
...
@@ -1276,8 +1276,10 @@ void main() {
expect
(
expect
(
valueIndicatorBox
,
valueIndicatorBox
,
paints
paints
..
path
(
color:
Colors
.
black
)
// shadow
..
path
(
color:
Colors
.
black
)
// shadow
..
path
(
color:
sliderTheme
.
valueIndicatorColor
)
..
path
(
color:
sliderTheme
.
valueIndicatorColor
)
..
paragraph
()
,
..
paragraph
()
);
);
await
gesture
.
up
();
await
gesture
.
up
();
// Wait for value indicator animation to finish.
// Wait for value indicator animation to finish.
...
@@ -1360,7 +1362,7 @@ void main() {
...
@@ -1360,7 +1362,7 @@ void main() {
);
);
// Represents the Raised Button and Range Slider.
// Represents the Raised Button and Range Slider.
expect
(
valueIndicatorBox
,
paintsExactlyCountTimes
(
#drawPath
,
4
));
expect
(
valueIndicatorBox
,
paintsExactlyCountTimes
(
#drawPath
,
6
));
expect
(
valueIndicatorBox
,
paintsExactlyCountTimes
(
#drawParagraph
,
3
));
expect
(
valueIndicatorBox
,
paintsExactlyCountTimes
(
#drawParagraph
,
3
));
await
tester
.
tap
(
find
.
text
(
'Next'
));
await
tester
.
tap
(
find
.
text
(
'Next'
));
...
@@ -1370,11 +1372,11 @@ void main() {
...
@@ -1370,11 +1372,11 @@ void main() {
expect
(
expect
(
valueIndicatorBox
,
valueIndicatorBox
,
isNot
(
isNot
(
paints
paints
..
path
(
color:
fillColor
)
..
path
(
color:
fillColor
)
..
paragraph
()
..
paragraph
()
..
path
(
color:
fillColor
)
..
path
(
color:
fillColor
)
..
paragraph
(),
..
paragraph
(),
),
),
);
);
...
@@ -1519,6 +1521,8 @@ void main() {
...
@@ -1519,6 +1521,8 @@ void main() {
expect
(
expect
(
valueIndicatorBox
,
valueIndicatorBox
,
paints
paints
..
path
(
color:
Colors
.
black
)
// shadow
..
path
(
color:
Colors
.
black
)
// shadow
..
path
(
color:
sliderTheme
.
valueIndicatorColor
)
..
path
(
color:
sliderTheme
.
valueIndicatorColor
)
..
paragraph
(),
..
paragraph
(),
);
);
...
@@ -1594,6 +1598,8 @@ void main() {
...
@@ -1594,6 +1598,8 @@ void main() {
expect
(
expect
(
valueIndicatorBox
,
valueIndicatorBox
,
paints
paints
..
path
(
color:
Colors
.
black
)
// shadow
..
path
(
color:
Colors
.
black
)
// shadow
..
path
(
color:
sliderTheme
.
valueIndicatorColor
)
..
path
(
color:
sliderTheme
.
valueIndicatorColor
)
..
paragraph
(),
..
paragraph
(),
);
);
...
...
packages/flutter/test/material/slider_test.dart
View file @
0d3d8d4b
This diff is collapsed.
Click to expand it.
packages/flutter/test/material/slider_theme_test.dart
View file @
0d3d8d4b
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