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
d3f540d4
Commit
d3f540d4
authored
Sep 22, 2016
by
Hans Muller
Committed by
GitHub
Sep 22, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed tabs fling velocity threshold (#5990)
parent
d3efe7da
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
tabs.dart
packages/flutter/lib/src/material/tabs.dart
+3
-4
tabs_test.dart
packages/flutter/test/material/tabs_test.dart
+4
-4
No files found.
packages/flutter/lib/src/material/tabs.dart
View file @
d3f540d4
...
...
@@ -37,10 +37,9 @@ const Duration _kTabBarScroll = const Duration(milliseconds: 200);
const
Curve
_kTabIndicatorLeadingCurve
=
Curves
.
easeOut
;
const
Curve
_kTabIndicatorTrailingCurve
=
Curves
.
easeIn
;
// The scrollOffset (velocity) provided to fling() is pixels/ms, and the
// tolerance velocity is pixels/sec. The additional factor of 5 is to further
// increase sensitivity to swipe gestures and was determined "experimentally".
final
double
_kMinFlingVelocity
=
kPixelScrollTolerance
.
velocity
/
5000.0
;
// The additional factor of 5 is to further increase sensitivity to swipe
// gestures and was determined "experimentally".
final
double
_kMinFlingVelocity
=
kPixelScrollTolerance
.
velocity
/
5.0
;
class
_TabBarParentData
extends
ContainerBoxParentDataMixin
<
RenderBox
>
{
}
...
...
packages/flutter/test/material/tabs_test.dart
View file @
d3f540d4
...
...
@@ -171,7 +171,7 @@ void main() {
// Fling-scroll the TabBar to the left
expect
(
tester
.
getCenter
(
find
.
text
(
'HHHHHH'
)).
x
,
lessThan
(
700.0
));
await
tester
.
fling
(
find
.
byKey
(
tabBarKey
),
const
Offset
(-
20
.0
,
0.0
),
1
000.0
);
await
tester
.
fling
(
find
.
byKey
(
tabBarKey
),
const
Offset
(-
20
0.0
,
0.0
),
10
000.0
);
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
// finish the scroll animation
expect
(
tester
.
getCenter
(
find
.
text
(
'HHHHHH'
)).
x
,
lessThan
(
500.0
));
...
...
@@ -267,7 +267,7 @@ void main() {
// Fling to the left, switch from the 'LEFT' tab to the 'RIGHT'
Point
flingStart
=
tester
.
getCenter
(
find
.
text
(
'LEFT CHILD'
));
await
tester
.
flingFrom
(
flingStart
,
new
Offset
(-
200.0
,
0.0
),
1000.0
);
await
tester
.
flingFrom
(
flingStart
,
new
Offset
(-
200.0
,
0.0
),
1000
0
.0
);
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
// finish the scroll animation
expect
(
selection
.
value
,
equals
(
'RIGHT'
));
...
...
@@ -276,7 +276,7 @@ void main() {
// Fling to the right, switch back to the 'LEFT' tab
flingStart
=
tester
.
getCenter
(
find
.
text
(
'RIGHT CHILD'
));
await
tester
.
flingFrom
(
flingStart
,
new
Offset
(
200.0
,
0.0
),
1000.0
);
await
tester
.
flingFrom
(
flingStart
,
new
Offset
(
200.0
,
0.0
),
1000
0
.0
);
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
// finish the scroll animation
expect
(
selection
.
value
,
equals
(
'LEFT'
));
...
...
@@ -301,7 +301,7 @@ void main() {
// a change to the selected tab, everything should just settle back to
// to where it started.
Point
flingStart
=
tester
.
getCenter
(
find
.
text
(
'LEFT CHILD'
));
await
tester
.
flingFrom
(
flingStart
,
new
Offset
(-
200.0
,
0.0
),
-
1000.0
);
await
tester
.
flingFrom
(
flingStart
,
new
Offset
(-
200.0
,
0.0
),
-
1000
0
.0
);
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
// finish the scroll animation
expect
(
selection
.
value
,
equals
(
'LEFT'
));
...
...
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