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
4c1045c0
Unverified
Commit
4c1045c0
authored
Feb 12, 2020
by
Anthony Mansour
Committed by
GitHub
Feb 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed preferredSize getter in TabBar (#41299)
parent
1903ce01
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
tabs.dart
packages/flutter/lib/src/material/tabs.dart
+1
-1
tabs_test.dart
packages/flutter/test/material/tabs_test.dart
+16
-0
No files found.
packages/flutter/lib/src/material/tabs.dart
View file @
4c1045c0
...
@@ -753,7 +753,7 @@ class TabBar extends StatefulWidget implements PreferredSizeWidget {
...
@@ -753,7 +753,7 @@ class TabBar extends StatefulWidget implements PreferredSizeWidget {
for
(
final
Widget
item
in
tabs
)
{
for
(
final
Widget
item
in
tabs
)
{
if
(
item
is
Tab
)
{
if
(
item
is
Tab
)
{
final
Tab
tab
=
item
;
final
Tab
tab
=
item
;
if
(
tab
.
text
!=
null
&&
tab
.
icon
!=
null
)
if
(
(
tab
.
text
!=
null
||
tab
.
child
!=
null
)
&&
tab
.
icon
!=
null
)
return
Size
.
fromHeight
(
_kTextAndIconTabHeight
+
indicatorWeight
);
return
Size
.
fromHeight
(
_kTextAndIconTabHeight
+
indicatorWeight
);
}
}
}
}
...
...
packages/flutter/test/material/tabs_test.dart
View file @
4c1045c0
...
@@ -2459,4 +2459,20 @@ void main() {
...
@@ -2459,4 +2459,20 @@ void main() {
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
expect
(
find
.
text
(
'No tabs'
),
findsOneWidget
);
expect
(
find
.
text
(
'No tabs'
),
findsOneWidget
);
});
});
testWidgets
(
'TabBar expands vertically to accommodate the Icon and child Text() pair the same amount it would expand for Icon and text pair.'
,
(
WidgetTester
tester
)
async
{
const
double
indicatorWeight
=
2.0
;
const
List
<
Widget
>
tabListWithText
=
<
Widget
>[
Tab
(
icon:
Icon
(
Icons
.
notifications
),
text:
'Test'
),
];
const
List
<
Widget
>
tabListWithTextChild
=
<
Widget
>[
Tab
(
icon:
Icon
(
Icons
.
notifications
),
child:
Text
(
'Test'
)),
];
const
TabBar
tabBarWithText
=
TabBar
(
tabs:
tabListWithText
,
indicatorWeight:
indicatorWeight
,);
const
TabBar
tabBarWithTextChild
=
TabBar
(
tabs:
tabListWithTextChild
,
indicatorWeight:
indicatorWeight
,);
expect
(
tabBarWithText
.
preferredSize
,
tabBarWithTextChild
.
preferredSize
);
});
}
}
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