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
499e900e
Unverified
Commit
499e900e
authored
Feb 09, 2022
by
wangying
Committed by
GitHub
Feb 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix timer keeps active when resampling disabled in some cases (#97197)
parent
3669e366
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
binding.dart
packages/flutter/lib/src/gestures/binding.dart
+1
-0
gesture_binding_resample_event_on_widget_test.dart
...stures/gesture_binding_resample_event_on_widget_test.dart
+16
-0
No files found.
packages/flutter/lib/src/gestures/binding.dart
View file @
499e900e
...
@@ -180,6 +180,7 @@ class _Resampler {
...
@@ -180,6 +180,7 @@ class _Resampler {
}
}
_resamplers
.
clear
();
_resamplers
.
clear
();
_frameTime
=
Duration
.
zero
;
_frameTime
=
Duration
.
zero
;
_timer
?.
cancel
();
}
}
void
_onSampleTimeChanged
()
{
void
_onSampleTimeChanged
()
{
...
...
packages/flutter/test/gestures/gesture_binding_resample_event_on_widget_test.dart
View file @
499e900e
...
@@ -123,4 +123,20 @@ void main() {
...
@@ -123,4 +123,20 @@ void main() {
expect
(
events
[
3
].
timeStamp
,
currentTestFrameTime
()
+
kSamplingOffset
);
expect
(
events
[
3
].
timeStamp
,
currentTestFrameTime
()
+
kSamplingOffset
);
expect
(
events
[
3
],
isA
<
PointerUpEvent
>());
expect
(
events
[
3
],
isA
<
PointerUpEvent
>());
});
});
testWidgets
(
'Timer should be canceled when resampling stopped'
,
(
WidgetTester
tester
)
async
{
// A timer will be started when event's timeStamp is larger than sampleTime.
final
ui
.
PointerDataPacket
packet
=
ui
.
PointerDataPacket
(
data:
<
ui
.
PointerData
>[
ui
.
PointerData
(
timeStamp:
Duration
(
microseconds:
DateTime
.
now
().
microsecondsSinceEpoch
),
),
],
);
GestureBinding
.
instance
.
resamplingEnabled
=
true
;
ui
.
window
.
onPointerDataPacket
!(
packet
);
// Expected to stop resampling, but the timer keeps active if _timer?.cancel() not be called.
GestureBinding
.
instance
.
resamplingEnabled
=
false
;
});
}
}
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