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
f6cde06a
Commit
f6cde06a
authored
Dec 06, 2016
by
Hans Muller
Committed by
GitHub
Dec 06, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct scrollable tabs fling velocity (#7170)
parent
2fd786b5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
2 deletions
+40
-2
tabs.dart
packages/flutter/lib/src/material/tabs.dart
+1
-2
tabs_test.dart
packages/flutter/test/material/tabs_test.dart
+39
-0
No files found.
packages/flutter/lib/src/material/tabs.dart
View file @
f6cde06a
...
...
@@ -430,9 +430,8 @@ class _TabsScrollBehavior extends BoundedBehavior {
if
(!
isScrollable
)
return
null
;
double
velocityPerSecond
=
velocity
*
1000.0
;
return
new
BoundedFrictionSimulation
(
_kTabBarScrollDrag
,
position
,
velocity
PerSecond
,
minScrollOffset
,
maxScrollOffset
_kTabBarScrollDrag
,
position
,
velocity
,
minScrollOffset
,
maxScrollOffset
);
}
...
...
packages/flutter/test/material/tabs_test.dart
View file @
f6cde06a
...
...
@@ -309,4 +309,43 @@ void main() {
expect
(
find
.
text
(
'RIGHT CHILD'
),
findsNothing
);
});
// A regression test for https://github.com/flutter/flutter/issues/7133
testWidgets
(
'TabBar fling velocity'
,
(
WidgetTester
tester
)
async
{
List
<
String
>
tabs
=
<
String
>[
'AAAAAA'
,
'BBBBBB'
,
'CCCCCC'
,
'DDDDDD'
,
'EEEEEE'
,
'FFFFFF'
,
'GGGGGG'
,
'HHHHHH'
,
'IIIIII'
,
'JJJJJJ'
,
'KKKKKK'
,
'LLLLLL'
];
int
index
=
0
;
await
tester
.
pumpWidget
(
new
MaterialApp
(
home:
new
Align
(
alignment:
FractionalOffset
.
topLeft
,
child:
new
SizedBox
(
width:
300.0
,
height:
200.0
,
child:
new
TabBarSelection
<
String
>(
values:
tabs
,
child:
new
Scaffold
(
appBar:
new
AppBar
(
title:
new
Text
(
'tabs'
),
bottom:
new
TabBar
<
String
>(
isScrollable:
true
,
labels:
new
Map
<
String
,
TabLabel
>.
fromIterable
(
tabs
,
value:
(
String
tab
)
=>
new
TabLabel
(
text:
tab
)),
),
),
body:
new
TabBarView
<
String
>(
children:
tabs
.
map
((
String
name
)
=>
new
Text
(
'
${index++}
'
)).
toList
(),
),
),
),
),
),
),
);
// After a small slow fling to the left, we expect the second item to still be visible.
await
tester
.
fling
(
find
.
text
(
'AAAAAA'
),
new
Offset
(-
25.0
,
0.0
),
100.0
);
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
// finish the scroll animation
final
RenderBox
box
=
tester
.
renderObject
(
find
.
text
(
'BBBBBB'
));
expect
(
box
.
localToGlobal
(
Point
.
origin
).
x
,
greaterThan
(
0.0
));
});
}
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