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
3a6c18da
Unverified
Commit
3a6c18da
authored
Sep 28, 2021
by
Hans Muller
Committed by
GitHub
Sep 28, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct notch geometry when MediaQuery padding.top is non-zero (#90703)
parent
d9f9fc45
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
0 deletions
+68
-0
bottom_app_bar.dart
packages/flutter/lib/src/material/bottom_app_bar.dart
+7
-0
bottom_app_bar_test.dart
packages/flutter/test/material/bottom_app_bar_test.dart
+61
-0
No files found.
packages/flutter/lib/src/material/bottom_app_bar.dart
View file @
3a6c18da
...
...
@@ -174,7 +174,14 @@ class _BottomAppBarClipper extends CustomClipper<Path> {
final
double
notchMargin
;
// Returns the top of the BottomAppBar in global coordinates.
//
// If the Scaffold's bottomNavigationBar was specified, then we can use its
// geometry value, otherwise we compute the location based on the AppBar's
// Material widget.
double
get
bottomNavigationBarTop
{
final
double
?
bottomNavigationBarTop
=
geometry
.
value
.
bottomNavigationBarTop
;
if
(
bottomNavigationBarTop
!=
null
)
return
bottomNavigationBarTop
;
final
RenderBox
?
box
=
materialKey
.
currentContext
?.
findRenderObject
()
as
RenderBox
?;
return
box
?.
localToGlobal
(
Offset
.
zero
).
dy
??
0
;
}
...
...
packages/flutter/test/material/bottom_app_bar_test.dart
View file @
3a6c18da
...
...
@@ -418,6 +418,67 @@ void main() {
expect
(
tester
.
getRect
(
find
.
byType
(
FloatingActionButton
)),
const
Rect
.
fromLTRB
(
372
,
528
,
428
,
584
));
expect
(
tester
.
getSize
(
find
.
byType
(
BottomAppBar
)),
const
Size
(
800
,
50
));
});
testWidgets
(
'notch with margin and top padding, home safe area'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/90024
await
tester
.
pumpWidget
(
const
MediaQuery
(
data:
MediaQueryData
(
padding:
EdgeInsets
.
only
(
top:
128
),
),
child:
MaterialApp
(
useInheritedMediaQuery:
true
,
home:
SafeArea
(
child:
Scaffold
(
bottomNavigationBar:
ShapeListener
(
BottomAppBar
(
shape:
RectangularNotch
(),
notchMargin:
6.0
,
child:
SizedBox
(
height:
100.0
),
),
),
floatingActionButton:
FloatingActionButton
(
onPressed:
null
,
child:
Icon
(
Icons
.
add
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation
.
centerDocked
,
),
),
),
),
);
final
ShapeListenerState
shapeListenerState
=
tester
.
state
(
find
.
byType
(
ShapeListener
));
final
RenderBox
babBox
=
tester
.
renderObject
(
find
.
byType
(
BottomAppBar
));
final
Size
babSize
=
babBox
.
size
;
final
RenderBox
fabBox
=
tester
.
renderObject
(
find
.
byType
(
FloatingActionButton
));
final
Size
fabSize
=
fabBox
.
size
;
final
double
fabLeft
=
(
babSize
.
width
/
2.0
)
-
(
fabSize
.
width
/
2.0
)
-
6.0
;
final
double
fabRight
=
fabLeft
+
fabSize
.
width
+
6.0
;
final
double
fabBottom
=
6.0
+
fabSize
.
height
/
2.0
;
final
Path
expectedPath
=
Path
()
..
moveTo
(
0.0
,
0.0
)
..
lineTo
(
fabLeft
,
0.0
)
..
lineTo
(
fabLeft
,
fabBottom
)
..
lineTo
(
fabRight
,
fabBottom
)
..
lineTo
(
fabRight
,
0.0
)
..
lineTo
(
babSize
.
width
,
0.0
)
..
lineTo
(
babSize
.
width
,
babSize
.
height
)
..
lineTo
(
0.0
,
babSize
.
height
)
..
close
();
final
Path
actualPath
=
shapeListenerState
.
cache
.
value
;
expect
(
actualPath
,
coversSameAreaAs
(
expectedPath
,
areaToCompare:
(
Offset
.
zero
&
babSize
).
inflate
(
5.0
),
),
);
});
}
// The bottom app bar clip path computation is only available at paint time.
...
...
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