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 {
final
double
evaluatedElevation
=
elevationTween
.
evaluate
(
activationAnimation
);
final
Path
path
=
Path
()
..
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
(
center
,
...
...
@@ -2475,7 +2487,19 @@ class RoundRangeSliderThumbShape extends RangeSliderThumbShape {
final
double
evaluatedElevation
=
isPressed
!
?
elevationTween
.
evaluate
(
activationAnimation
)
:
elevation
;
final
Path
shadowPath
=
Path
()
..
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
(
center
,
...
...
@@ -3359,3 +3383,15 @@ class RangeLabels {
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() {
expect
(
valueIndicatorBox
,
paints
..
path
(
color:
Colors
.
black
)
// shadow
..
path
(
color:
Colors
.
black
)
// shadow
..
path
(
color:
sliderTheme
.
valueIndicatorColor
)
..
paragraph
()
,
..
paragraph
()
);
await
gesture
.
up
();
// Wait for value indicator animation to finish.
...
...
@@ -1360,7 +1362,7 @@ void main() {
);
// Represents the Raised Button and Range Slider.
expect
(
valueIndicatorBox
,
paintsExactlyCountTimes
(
#drawPath
,
4
));
expect
(
valueIndicatorBox
,
paintsExactlyCountTimes
(
#drawPath
,
6
));
expect
(
valueIndicatorBox
,
paintsExactlyCountTimes
(
#drawParagraph
,
3
));
await
tester
.
tap
(
find
.
text
(
'Next'
));
...
...
@@ -1370,11 +1372,11 @@ void main() {
expect
(
valueIndicatorBox
,
isNot
(
paints
..
path
(
color:
fillColor
)
..
paragraph
()
..
path
(
color:
fillColor
)
..
paragraph
(),
paints
..
path
(
color:
fillColor
)
..
paragraph
()
..
path
(
color:
fillColor
)
..
paragraph
(),
),
);
...
...
@@ -1519,6 +1521,8 @@ void main() {
expect
(
valueIndicatorBox
,
paints
..
path
(
color:
Colors
.
black
)
// shadow
..
path
(
color:
Colors
.
black
)
// shadow
..
path
(
color:
sliderTheme
.
valueIndicatorColor
)
..
paragraph
(),
);
...
...
@@ -1594,6 +1598,8 @@ void main() {
expect
(
valueIndicatorBox
,
paints
..
path
(
color:
Colors
.
black
)
// shadow
..
path
(
color:
Colors
.
black
)
// shadow
..
path
(
color:
sliderTheme
.
valueIndicatorColor
)
..
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