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(
|
final ScaffoldPrelayoutGeometry currentGeometry = ScaffoldPrelayoutGeometry(
|
||||||
bottomSheetSize: bottomSheetSize,
|
bottomSheetSize: bottomSheetSize,
|
||||||
contentBottom: contentBottom,
|
contentBottom: contentBottom,
|
||||||
contentTop: contentTop,
|
/// [appBarHeight] should be used instead of [contentTop] because
|
||||||
|
/// ScaffoldPrelayoutGeometry.contentTop must not be affected by [extendBodyBehindAppBar].
|
||||||
|
contentTop: appBarHeight,
|
||||||
floatingActionButtonSize: fabSize,
|
floatingActionButtonSize: fabSize,
|
||||||
minInsets: minInsets,
|
minInsets: minInsets,
|
||||||
scaffoldSize: size,
|
scaffoldSize: size,
|
||||||
|
@ -2031,6 +2031,36 @@ void main() {
|
|||||||
);
|
);
|
||||||
await tester.pumpAndSettle();
|
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 {
|
testWidgets('ScaffoldMessenger.maybeOf can return null if not found', (WidgetTester tester) async {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user