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
dc85f0bb
Commit
dc85f0bb
authored
Jul 28, 2016
by
Hans Muller
Committed by
GitHub
Jul 28, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ease tab swipe transitions (#5111)
parent
8c8409d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
tabs.dart
packages/flutter/lib/src/material/tabs.dart
+11
-10
No files found.
packages/flutter/lib/src/material/tabs.dart
View file @
dc85f0bb
...
...
@@ -609,14 +609,15 @@ class TabBarSelectionState<T> extends State<TabBarSelection<T>> {
// If the selected value change was triggered by a drag gesture, the current
// value of _controller.value will reflect where the gesture ended. While
// the drag was underway progress indicates where the indicator and TabBarView
// scrollPosition are vis the indices of the two tabs adjacent to the selected
// one. So 0.5 means the drag didn't move at all, 0.0 means the drag extended
// to the beginning of the tab on the left and 1.0 likewise for the tab on the
// right. That is unless the index of the selected value was 0 or values.length - 1.
// In those cases progress just moves between the selected tab and the adjacent
// one. Convert progress to reflect the fact that we're now moving between (just)
// the previous and current selection index.
// the drag was underway the controller's value indicates where the indicator
// and TabBarView scrollPositions are vis the indices of the two tabs adjacent
// to the selected one. So 0.5 means the drag didn't move at all, 0.0 means the
// drag extended to the beginning of the tab on the left and 1.0 likewise for
// the tab on the right. That is unless the index of the selected value was 0
// or values.length - 1. In those cases the controller's value just moves between
// the selected tab and the adjacent one. So: convert the controller's value
// here to reflect the fact that we're now moving between (just) the previous
// and current selection index.
double
value
;
if
(
_controller
.
status
==
AnimationStatus
.
completed
)
...
...
@@ -1187,10 +1188,10 @@ class _TabBarViewState<T> extends PageableListState<TabBarView<T>> implements Ta
if
(
selectedIndex
<
previousSelectedIndex
)
{
_updateItemsFromChildren
(
selectedIndex
,
previousSelectedIndex
);
scrollTo
(
1.0
-
animation
.
value
);
scrollTo
(
new
CurveTween
(
curve:
Curves
.
ease
.
flipped
).
evaluate
(
new
ReverseAnimation
(
animation
))
);
}
else
{
_updateItemsFromChildren
(
previousSelectedIndex
,
selectedIndex
);
scrollTo
(
animation
.
value
);
scrollTo
(
new
CurveTween
(
curve:
Curves
.
ease
).
evaluate
(
animation
)
);
}
}
...
...
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