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
e7c2571b
Commit
e7c2571b
authored
Nov 16, 2016
by
Jason Simmons
Committed by
GitHub
Nov 16, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle empty sizes in AppBar's toolbar layout (#6894)
parent
cac54594
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletion
+21
-1
app_bar.dart
packages/flutter/lib/src/material/app_bar.dart
+3
-1
app_bar_test.dart
packages/flutter/test/material/app_bar_test.dart
+18
-0
No files found.
packages/flutter/lib/src/material/app_bar.dart
View file @
e7c2571b
...
...
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:math'
as
math
;
import
'package:flutter/services.dart'
;
import
'package:flutter/widgets.dart'
;
...
...
@@ -58,7 +60,7 @@ class _ToolbarLayout extends MultiChildLayoutDelegate {
}
if
(
hasChild
(
_ToolbarSlot
.
title
))
{
final
double
maxWidth
=
size
.
width
-
kTitleLeft
-
actionsWidth
;
final
double
maxWidth
=
math
.
max
(
size
.
width
-
kTitleLeft
-
actionsWidth
,
0.0
)
;
final
BoxConstraints
constraints
=
new
BoxConstraints
.
loose
(
size
).
copyWith
(
maxWidth:
maxWidth
);
final
Size
titleSize
=
layoutChild
(
_ToolbarSlot
.
title
,
constraints
);
final
double
titleY
=
(
size
.
height
-
titleSize
.
height
)
/
2.0
;
...
...
packages/flutter/test/material/app_bar_test.dart
View file @
e7c2571b
...
...
@@ -179,4 +179,22 @@ void main() {
expect
(
tester
.
getSize
(
title
).
width
,
equals
(
620.0
));
});
testWidgets
(
'AppBar render at zero size'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
new
Center
(
child:
new
Container
(
height:
0.0
,
width:
0.0
,
child:
new
Scaffold
(
appBar:
new
AppBar
(
title:
new
Text
(
'X'
)
)
)
)
)
);
Finder
title
=
find
.
text
(
'X'
);
expect
(
tester
.
getSize
(
title
).
isEmpty
,
isTrue
);
});
}
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