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
9651db22
Commit
9651db22
authored
Dec 10, 2015
by
Hans Muller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TabBarView is-a PageableList, doesn't need itemExtent
parent
4fa9e571
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
17 deletions
+11
-17
tabs.dart
packages/flutter/lib/src/material/tabs.dart
+11
-17
No files found.
packages/flutter/lib/src/material/tabs.dart
View file @
9651db22
...
...
@@ -28,7 +28,7 @@ const double _kMinTabWidth = 72.0;
const
double
_kMaxTabWidth
=
264.0
;
const
EdgeDims
_kTabLabelPadding
=
const
EdgeDims
.
symmetric
(
horizontal:
12.0
);
const
double
_kTabBarScrollDrag
=
0.025
;
const
Duration
_kTabBarScroll
=
const
Duration
(
milliseconds:
2
00
);
const
Duration
_kTabBarScroll
=
const
Duration
(
milliseconds:
8
00
);
class
_TabBarParentData
extends
ContainerBoxParentDataMixin
<
RenderBox
>
{
}
...
...
@@ -612,19 +612,17 @@ class _TabBarState extends ScrollableState<TabBar> {
}
}
class
TabBarView
<
T
>
extends
Scroll
ableList
<
T
>
{
class
TabBarView
<
T
>
extends
Page
ableList
<
T
>
{
TabBarView
({
Key
key
,
this
.
selection
,
List
<
T
>
items
,
ItemBuilder
<
T
>
itemBuilder
,
double
itemExtent
ItemBuilder
<
T
>
itemBuilder
})
:
super
(
key:
key
,
scrollDirection:
ScrollDirection
.
horizontal
,
items:
items
,
itemBuilder:
itemBuilder
,
itemExtent:
itemExtent
,
itemsWrap:
false
)
{
assert
(
selection
!=
null
);
...
...
@@ -640,9 +638,11 @@ class _NotScrollable extends BoundedBehavior {
bool
get
isScrollable
=>
false
;
}
class
_TabBarViewState
<
T
>
extends
Scroll
ableListState
<
T
,
TabBarView
<
T
>>
{
class
_TabBarViewState
<
T
>
extends
Page
ableListState
<
T
,
TabBarView
<
T
>>
{
ScrollBehavior
createScrollBehavior
()
=>
new
_NotScrollable
();
final
_NotScrollable
_notScrollable
=
new
_NotScrollable
();
ScrollBehavior
createScrollBehavior
()
=>
_notScrollable
;
ExtentScrollBehavior
get
scrollBehavior
=>
_notScrollable
;
List
<
int
>
_itemIndices
=
[
0
,
1
];
AnimationDirection
_scrollDirection
=
AnimationDirection
.
forward
;
...
...
@@ -655,10 +655,10 @@ class _TabBarViewState<T> extends ScrollableListState<T, TabBarView<T>> {
scrollTo
(
0.0
);
}
else
if
(
selectedIndex
==
config
.
items
.
length
-
1
)
{
_itemIndices
=
<
int
>[
selectedIndex
-
1
,
selectedIndex
];
scrollTo
(
config
.
itemExtent
);
scrollTo
(
1.0
);
}
else
{
_itemIndices
=
<
int
>[
selectedIndex
-
1
,
selectedIndex
,
selectedIndex
+
1
];
scrollTo
(
config
.
itemExtent
);
scrollTo
(
1.0
);
}
}
...
...
@@ -680,12 +680,6 @@ class _TabBarViewState<T> extends ScrollableListState<T, TabBarView<T>> {
super
.
dispose
();
}
void
didUpdateConfig
(
TabBarView
oldConfig
)
{
super
.
didUpdateConfig
(
oldConfig
);
if
(
oldConfig
.
itemExtent
!=
config
.
itemExtent
&&
!
_performance
.
isAnimating
)
_initItemIndicesAndScrollPosition
();
}
void
_handleStatusChange
(
PerformanceStatus
status
)
{
final
int
selectedIndex
=
config
.
selection
.
index
;
final
int
previousSelectedIndex
=
config
.
selection
.
previousIndex
;
...
...
@@ -705,9 +699,9 @@ class _TabBarViewState<T> extends ScrollableListState<T, TabBarView<T>> {
void
_handleProgressChange
()
{
if
(
_scrollDirection
==
AnimationDirection
.
forward
)
scrollTo
(
config
.
itemExtent
*
_performance
.
progress
);
scrollTo
(
_performance
.
progress
);
else
scrollTo
(
config
.
itemExtent
*
(
1.0
-
_performance
.
progress
)
);
scrollTo
(
1.0
-
_performance
.
progress
);
}
int
get
itemCount
=>
_itemIndices
.
length
;
...
...
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