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
6c83d84e
Unverified
Commit
6c83d84e
authored
Feb 11, 2021
by
Kate Lovett
Committed by
GitHub
Feb 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply bottom margin to FABs that have been boosted into the Safe Area (#75809)
parent
408c092f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
16 deletions
+15
-16
floating_action_button_location.dart
...ter/lib/src/material/floating_action_button_location.dart
+1
-2
floating_action_button_location_test.dart
...r/test/material/floating_action_button_location_test.dart
+14
-14
No files found.
packages/flutter/lib/src/material/floating_action_button_location.dart
View file @
6c83d84e
...
...
@@ -559,7 +559,7 @@ mixin FabFloatOffsetY on StandardFabLocation {
final
double
snackBarHeight
=
scaffoldGeometry
.
snackBarSize
.
height
;
final
double
safeMargin
=
math
.
max
(
kFloatingActionButtonMargin
,
scaffoldGeometry
.
minViewPadding
.
bottom
-
bottomContentHeight
,
scaffoldGeometry
.
minViewPadding
.
bottom
-
bottomContentHeight
+
kFloatingActionButtonMargin
,
);
double
fabY
=
contentBottom
-
fabHeight
-
safeMargin
;
...
...
@@ -567,7 +567,6 @@ mixin FabFloatOffsetY on StandardFabLocation {
fabY
=
math
.
min
(
fabY
,
contentBottom
-
snackBarHeight
-
fabHeight
-
kFloatingActionButtonMargin
);
if
(
bottomSheetHeight
>
0.0
)
fabY
=
math
.
min
(
fabY
,
contentBottom
-
bottomSheetHeight
-
fabHeight
/
2.0
);
return
fabY
+
adjustment
;
}
}
...
...
packages/flutter/test/material/floating_action_button_location_test.dart
View file @
6c83d84e
...
...
@@ -710,7 +710,7 @@ void main() {
tester
.
getRect
(
find
.
byKey
(
floatingActionButton
)),
rectMoreOrLessEquals
(
defaultRect
.
translate
(
0.0
,
viewPadding
-
keyboardHeight
-
kFloatingActionButtonMargin
,
viewPadding
-
keyboardHeight
,
)),
);
...
...
@@ -922,18 +922,18 @@ void main() {
await
tester
.
pumpAndSettle
();
// Show SnackBar
expect
(
tester
.
getRect
(
find
.
byKey
(
floatingActionButton
)),
rectMoreOrLessEquals
(
snackBarRect
.
translate
(
0.0
,
-
keyboardHeight
)),
rectMoreOrLessEquals
(
snackBarRect
.
translate
(
0.0
,
-
keyboardHeight
+
kFloatingActionButtonMargin
/
2
)),
);
}
testWidgets
(
'startFloat'
,
(
WidgetTester
tester
)
async
{
const
Rect
defaultRect
=
Rect
.
fromLTRB
(
16.0
,
4
94.0
,
72.0
,
550
.0
);
const
Rect
defaultRect
=
Rect
.
fromLTRB
(
16.0
,
4
78.0
,
72.0
,
534
.0
);
// Positioned relative to BottomNavigationBar
const
Rect
bottomNavigationBarRect
=
Rect
.
fromLTRB
(
16.0
,
429.0
,
72.0
,
485.0
);
// Position relative to BottomSheet
const
Rect
bottomSheetRect
=
Rect
.
fromLTRB
(
16.0
,
472.0
,
72.0
,
528.0
);
// Positioned relative to SnackBar
const
Rect
snackBarRect
=
Rect
.
fromLTRB
(
16.0
,
4
86.0
,
72.0
,
542
.0
);
const
Rect
snackBarRect
=
Rect
.
fromLTRB
(
16.0
,
4
78.0
,
72.0
,
534
.0
);
await
_runFloatTests
(
tester
,
FloatingActionButtonLocation
.
startFloat
,
...
...
@@ -945,13 +945,13 @@ void main() {
});
testWidgets
(
'miniStartFloat'
,
(
WidgetTester
tester
)
async
{
const
Rect
defaultRect
=
Rect
.
fromLTRB
(
12.0
,
506.0
,
60.0
,
554
.0
);
const
Rect
defaultRect
=
Rect
.
fromLTRB
(
12.0
,
490.0
,
60.0
,
538
.0
);
// Positioned relative to BottomNavigationBar
const
Rect
bottomNavigationBarRect
=
Rect
.
fromLTRB
(
12.0
,
441.0
,
60.0
,
489.0
);
// Positioned relative to BottomSheet
const
Rect
bottomSheetRect
=
Rect
.
fromLTRB
(
12.0
,
480.0
,
60.0
,
528.0
);
// Positioned relative to SnackBar
const
Rect
snackBarRect
=
Rect
.
fromLTRB
(
12.0
,
49
8.0
,
60.0
,
546
.0
);
const
Rect
snackBarRect
=
Rect
.
fromLTRB
(
12.0
,
49
0.0
,
60.0
,
538
.0
);
await
_runFloatTests
(
tester
,
FloatingActionButtonLocation
.
miniStartFloat
,
...
...
@@ -964,13 +964,13 @@ void main() {
});
testWidgets
(
'centerFloat'
,
(
WidgetTester
tester
)
async
{
const
Rect
defaultRect
=
Rect
.
fromLTRB
(
372.0
,
4
94.0
,
428.0
,
550
.0
);
const
Rect
defaultRect
=
Rect
.
fromLTRB
(
372.0
,
4
78.0
,
428.0
,
534
.0
);
// Positioned relative to BottomNavigationBar
const
Rect
bottomNavigationBarRect
=
Rect
.
fromLTRB
(
372.0
,
429.0
,
428.0
,
485.0
);
// Positioned relative to BottomSheet
const
Rect
bottomSheetRect
=
Rect
.
fromLTRB
(
372.0
,
472.0
,
428.0
,
528.0
);
// Positioned relative to SnackBar
const
Rect
snackBarRect
=
Rect
.
fromLTRB
(
372.0
,
4
86.0
,
428.0
,
542
.0
);
const
Rect
snackBarRect
=
Rect
.
fromLTRB
(
372.0
,
4
78.0
,
428.0
,
534
.0
);
await
_runFloatTests
(
tester
,
FloatingActionButtonLocation
.
centerFloat
,
...
...
@@ -982,13 +982,13 @@ void main() {
});
testWidgets
(
'miniCenterFloat'
,
(
WidgetTester
tester
)
async
{
const
Rect
defaultRect
=
Rect
.
fromLTRB
(
376.0
,
506.0
,
424.0
,
554
.0
);
const
Rect
defaultRect
=
Rect
.
fromLTRB
(
376.0
,
490.0
,
424.0
,
538
.0
);
// Positioned relative to BottomNavigationBar
const
Rect
bottomNavigationBarRect
=
Rect
.
fromLTRB
(
376.0
,
441.0
,
424.0
,
489.0
);
// Positioned relative to BottomSheet
const
Rect
bottomSheetRect
=
Rect
.
fromLTRB
(
376.0
,
480.0
,
424.0
,
528.0
);
// Positioned relative to SnackBar
const
Rect
snackBarRect
=
Rect
.
fromLTRB
(
376.0
,
49
8.0
,
424.0
,
546
.0
);
const
Rect
snackBarRect
=
Rect
.
fromLTRB
(
376.0
,
49
0.0
,
424.0
,
538
.0
);
await
_runFloatTests
(
tester
,
FloatingActionButtonLocation
.
miniCenterFloat
,
...
...
@@ -1001,13 +1001,13 @@ void main() {
});
testWidgets
(
'endFloat'
,
(
WidgetTester
tester
)
async
{
const
Rect
defaultRect
=
Rect
.
fromLTRB
(
728.0
,
4
94.0
,
784.0
,
550
.0
);
const
Rect
defaultRect
=
Rect
.
fromLTRB
(
728.0
,
4
78.0
,
784.0
,
534
.0
);
// Positioned relative to BottomNavigationBar
const
Rect
bottomNavigationBarRect
=
Rect
.
fromLTRB
(
728.0
,
429.0
,
784.0
,
485.0
);
// Positioned relative to BottomSheet
const
Rect
bottomSheetRect
=
Rect
.
fromLTRB
(
728.0
,
472.0
,
784.0
,
528.0
);
// Positioned relative to SnackBar
const
Rect
snackBarRect
=
Rect
.
fromLTRB
(
728.0
,
4
86.0
,
784.0
,
542
.0
);
const
Rect
snackBarRect
=
Rect
.
fromLTRB
(
728.0
,
4
78.0
,
784.0
,
534
.0
);
await
_runFloatTests
(
tester
,
FloatingActionButtonLocation
.
endFloat
,
...
...
@@ -1019,13 +1019,13 @@ void main() {
});
testWidgets
(
'miniEndFloat'
,
(
WidgetTester
tester
)
async
{
const
Rect
defaultRect
=
Rect
.
fromLTRB
(
740.0
,
506.0
,
788.0
,
554
.0
);
const
Rect
defaultRect
=
Rect
.
fromLTRB
(
740.0
,
490.0
,
788.0
,
538
.0
);
// Positioned relative to BottomNavigationBar
const
Rect
bottomNavigationBarRect
=
Rect
.
fromLTRB
(
740.0
,
441.0
,
788.0
,
489.0
);
// Positioned relative to BottomSheet
const
Rect
bottomSheetRect
=
Rect
.
fromLTRB
(
740.0
,
480.0
,
788.0
,
528.0
);
// Positioned relative to SnackBar
const
Rect
snackBarRect
=
Rect
.
fromLTRB
(
740.0
,
49
8.0
,
788.0
,
546
.0
);
const
Rect
snackBarRect
=
Rect
.
fromLTRB
(
740.0
,
49
0.0
,
788.0
,
538
.0
);
await
_runFloatTests
(
tester
,
FloatingActionButtonLocation
.
miniEndFloat
,
...
...
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