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
64d36470
Commit
64d36470
authored
Jan 31, 2017
by
Ian Hickson
Committed by
GitHub
Jan 31, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tab crash in complex_layout (#7744)
parent
8e3ea752
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
18 deletions
+17
-18
main.dart
dev/benchmarks/complex_layout/lib/main.dart
+13
-15
tabs.dart
packages/flutter/lib/src/material/tabs.dart
+4
-3
No files found.
dev/benchmarks/complex_layout/lib/main.dart
View file @
64d36470
...
...
@@ -50,16 +50,15 @@ class ComplexLayout extends StatefulWidget {
ComplexLayoutState
createState
()
=>
new
ComplexLayoutState
();
static
ComplexLayoutState
of
(
BuildContext
context
)
=>
context
.
ancestorStateOfType
(
const
TypeMatcher
<
ComplexLayoutState
>());
}
class
FancyItemDelegate
extends
LazyBlockDelegate
{
@override
Widget
buildItem
(
BuildContext
context
,
int
index
)
{
if
(
index
%
2
==
0
)
return
new
FancyImageItem
(
index
,
key:
new
Key
(
'Item
$index
'
));
return
new
FancyImageItem
(
index
,
key:
new
ValueKey
<
int
>(
index
));
else
return
new
FancyGalleryItem
(
index
,
key:
new
Key
(
'Item
$index
'
));
return
new
FancyGalleryItem
(
index
,
key:
new
ValueKey
<
int
>(
index
));
}
@override
...
...
@@ -84,7 +83,7 @@ class ComplexLayoutState extends State<ComplexLayout> {
tooltip:
'Search'
,
onPressed:
()
{
print
(
'Pressed search'
);
}
}
,
),
new
TopBarMenu
()
]
...
...
@@ -93,14 +92,13 @@ class ComplexLayoutState extends State<ComplexLayout> {
children:
<
Widget
>[
new
Expanded
(
child:
new
LazyBlock
(
key:
new
Key
(
'main-scroll'
),
delegate:
new
FancyItemDelegate
()
delegate:
new
FancyItemDelegate
(),
)
),
new
BottomBar
()
]
new
BottomBar
()
,
]
,
),
drawer:
new
GalleryDrawer
()
drawer:
new
GalleryDrawer
()
,
);
}
}
...
...
@@ -478,7 +476,7 @@ class ItemGalleryBox extends StatelessWidget {
child:
new
TabBarView
(
children:
tabNames
.
map
((
String
tabName
)
{
return
new
Container
(
key:
new
Key
(
'Tab
$index
-
$tabName
'
),
key:
new
Key
(
tabName
),
child:
new
Padding
(
padding:
new
EdgeInsets
.
all
(
8.0
),
child:
new
Card
(
...
...
@@ -487,10 +485,10 @@ class ItemGalleryBox extends StatelessWidget {
new
Expanded
(
child:
new
Container
(
decoration:
new
BoxDecoration
(
backgroundColor:
Theme
.
of
(
context
).
primaryColor
backgroundColor:
Theme
.
of
(
context
).
primaryColor
,
),
child:
new
Center
(
child:
new
Text
(
tabName
,
style:
Theme
.
of
(
context
).
textTheme
.
headline
.
copyWith
(
color:
Colors
.
white
))
child:
new
Text
(
tabName
,
style:
Theme
.
of
(
context
).
textTheme
.
headline
.
copyWith
(
color:
Colors
.
white
))
,
)
)
),
...
...
@@ -498,16 +496,16 @@ class ItemGalleryBox extends StatelessWidget {
children:
<
Widget
>[
new
IconButton
(
icon:
new
Icon
(
Icons
.
share
),
onPressed:
()
{
print
(
'Pressed share'
);
}
onPressed:
()
{
print
(
'Pressed share'
);
}
,
),
new
IconButton
(
icon:
new
Icon
(
Icons
.
event
),
onPressed:
()
{
print
(
'Pressed event'
);
}
onPressed:
()
{
print
(
'Pressed event'
);
}
,
),
new
Expanded
(
child:
new
Padding
(
padding:
new
EdgeInsets
.
only
(
left:
8.0
),
child:
new
Text
(
'This is item
$tabName
'
)
child:
new
Text
(
'This is item
$tabName
'
)
,
)
)
]
...
...
packages/flutter/lib/src/material/tabs.dart
View file @
64d36470
...
...
@@ -866,6 +866,7 @@ class TabPageSelector extends StatelessWidget {
final
ColorTween
selectedColor
=
new
ColorTween
(
begin:
Colors
.
transparent
,
end:
color
);
final
ColorTween
previousColor
=
new
ColorTween
(
begin:
color
,
end:
Colors
.
transparent
);
final
TabController
tabController
=
controller
??
DefaultTabController
.
of
(
context
);
assert
(
tabController
!=
null
);
final
Animation
<
double
>
animation
=
new
CurvedAnimation
(
parent:
tabController
.
animation
,
curve:
Curves
.
fastOutSlowIn
,
...
...
@@ -874,11 +875,11 @@ class TabPageSelector extends StatelessWidget {
animation:
animation
,
builder:
(
BuildContext
context
,
Widget
child
)
{
return
new
Semantics
(
label:
'Page
${
controller.index + 1}
of
${c
ontroller.length}
'
,
label:
'Page
${
tabController.index + 1}
of
${tabC
ontroller.length}
'
,
child:
new
Row
(
mainAxisSize:
MainAxisSize
.
min
,
children:
new
List
<
Widget
>.
generate
(
c
ontroller
.
length
,
(
int
tabIndex
)
{
return
_buildTabIndicator
(
tabIndex
,
c
ontroller
,
selectedColor
,
previousColor
);
children:
new
List
<
Widget
>.
generate
(
tabC
ontroller
.
length
,
(
int
tabIndex
)
{
return
_buildTabIndicator
(
tabIndex
,
tabC
ontroller
,
selectedColor
,
previousColor
);
}).
toList
(),
),
);
...
...
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