mirror of
https://github.com/flutter/flutter
synced 2024-10-13 11:42:54 +00:00
FloatingActionButton always keeps the same position when FloatingActionButtonLocation is top. (#64746)
This commit is contained in:
parent
de56c6ad72
commit
20b68c28a2
|
@ -959,7 +959,9 @@ class _ScaffoldLayout extends MultiChildLayoutDelegate {
|
|||
final ScaffoldPrelayoutGeometry currentGeometry = ScaffoldPrelayoutGeometry(
|
||||
bottomSheetSize: bottomSheetSize,
|
||||
contentBottom: contentBottom,
|
||||
contentTop: contentTop,
|
||||
/// [appBarHeight] should be used instead of [contentTop] because
|
||||
/// ScaffoldPrelayoutGeometry.contentTop must not be affected by [extendBodyBehindAppBar].
|
||||
contentTop: appBarHeight,
|
||||
floatingActionButtonSize: fabSize,
|
||||
minInsets: minInsets,
|
||||
scaffoldSize: size,
|
||||
|
|
|
@ -2031,6 +2031,36 @@ void main() {
|
|||
);
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
testWidgets('FloatingActionButton always keeps the same position regardless of extendBodyBehindAppBar', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () {},
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.endTop,
|
||||
extendBodyBehindAppBar: false,
|
||||
),
|
||||
));
|
||||
final Offset defaultOffset = tester.getCenter(find.byType(FloatingActionButton));
|
||||
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () {},
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.endTop,
|
||||
extendBodyBehindAppBar: true,
|
||||
),
|
||||
));
|
||||
final Offset extendedBodyOffset = tester.getCenter(find.byType(FloatingActionButton));
|
||||
|
||||
expect(defaultOffset.dy, extendedBodyOffset.dy);
|
||||
});
|
||||
});
|
||||
|
||||
testWidgets('ScaffoldMessenger.maybeOf can return null if not found', (WidgetTester tester) async {
|
||||
|
|
Loading…
Reference in a new issue