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
0902576a
Unverified
Commit
0902576a
authored
May 20, 2021
by
nt4f04uNd
Committed by
GitHub
May 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix slider notifies start and end twice when participates in gesture arena (#82152)
parent
11edf362
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
3 deletions
+42
-3
slider.dart
packages/flutter/lib/src/material/slider.dart
+2
-3
slider_test.dart
packages/flutter/test/material/slider_test.dart
+40
-0
No files found.
packages/flutter/lib/src/material/slider.dart
View file @
0902576a
...
...
@@ -903,8 +903,7 @@ class _RenderSlider extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
_tap
=
TapGestureRecognizer
()
..
team
=
team
..
onTapDown
=
_handleTapDown
..
onTapUp
=
_handleTapUp
..
onTapCancel
=
_endInteraction
;
..
onTapUp
=
_handleTapUp
;
_overlayAnimation
=
CurvedAnimation
(
parent:
_state
.
overlayController
,
curve:
Curves
.
fastOutSlowIn
,
...
...
@@ -1224,7 +1223,7 @@ class _RenderSlider extends RenderBox with RelayoutWhenSystemFontsChangeMixin {
void
_startInteraction
(
Offset
globalPosition
)
{
_state
.
showValueIndicator
();
if
(
isInteractive
)
{
if
(
!
_active
&&
isInteractive
)
{
_active
=
true
;
// We supply the *current* value as the start location, so that if we have
// a tap, it consists of a call to onChangeStart with the previous value and
...
...
packages/flutter/test/material/slider_test.dart
View file @
0902576a
...
...
@@ -908,6 +908,46 @@ void main() {
await
gesture
.
up
();
});
testWidgets
(
'Slider onChangeStart and onChangeEnd fire once'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/28115
int
startFired
=
0
;
int
endFired
=
0
;
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Center
(
child:
GestureDetector
(
onHorizontalDragUpdate:
(
_
)
{
},
child:
Slider
(
value:
0.0
,
onChanged:
(
double
newValue
)
{
},
onChangeStart:
(
double
value
)
{
startFired
+=
1
;
},
onChangeEnd:
(
double
value
)
{
endFired
+=
1
;
},
),
),
),
),
),
),
);
await
tester
.
timedDrag
(
find
.
byType
(
Slider
),
const
Offset
(
20.0
,
0.0
),
const
Duration
(
milliseconds:
100
),
);
expect
(
startFired
,
equals
(
1
));
expect
(
endFired
,
equals
(
1
));
});
testWidgets
(
'Slider sizing'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
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