Unverified Commit 5d99748c authored by Bruno Leroux's avatar Bruno Leroux Committed by GitHub

Remove accessibleNavigation reference from BottomSheet (#121132)

Remove accessibleNavigation reference from BottomSheet
parent dfe7f841
......@@ -559,10 +559,8 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> {
onDragEnd: handleDragEnd,
),
builder: (BuildContext context, Widget? child) {
// Disable the initial animation when accessible navigation is on so
// that the semantics are added to the tree at the correct time.
final double animationValue = animationCurve.transform(
MediaQuery.accessibleNavigationOf(context) ? 1.0 : widget.route.animation!.value,
widget.route.animation!.value,
);
return Semantics(
scopesRoute: true,
......
......@@ -90,9 +90,7 @@ void main() {
await tester.pumpWidget(Container());
});
testWidgets('Swiping down a BottomSheet should dismiss it by default', (WidgetTester tester) async {
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
bool showBottomSheetThenCalled = false;
......@@ -128,7 +126,6 @@ void main() {
});
testWidgets('Swiping down a BottomSheet should not dismiss it when enableDrag is false', (WidgetTester tester) async {
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
bool showBottomSheetThenCalled = false;
......@@ -369,6 +366,32 @@ void main() {
expect(find.text('BottomSheet'), findsNothing);
});
// Regression test for https://github.com/flutter/flutter/issues/121098
testWidgets('Verify that accessibleNavigation has no impact on the BottomSheet animation', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(
builder: (BuildContext context, Widget? child) {
return MediaQuery(
data: const MediaQueryData(accessibleNavigation: true),
child: child!,
);
},
home: const Center(child: Text('Test')),
));
await tester.pump();
expect(find.text('BottomSheet'), findsNothing);
final BuildContext homeContext = tester.element(find.text('Test'));
showModalBottomSheet<void>(
context: homeContext,
builder: (BuildContext context) => const Text('BottomSheet'),
);
await tester.pump();
await checkNonLinearAnimation(tester);
await tester.pumpAndSettle();
});
testWidgets('Tapping outside a modal BottomSheet should not dismiss it when isDismissible=false', (WidgetTester tester) async {
late BuildContext savedContext;
......@@ -841,7 +864,7 @@ void main() {
expect(modalBarrier.color, barrierColor);
});
testWidgets('BottomSheet uses fallback values in maretial3',
testWidgets('BottomSheet uses fallback values in material3',
(WidgetTester tester) async {
const Color surfaceColor = Colors.pink;
const Color surfaceTintColor = Colors.blue;
......@@ -891,7 +914,6 @@ void main() {
),
));
showModalBottomSheet<void>(
context: scaffoldKey.currentContext!,
builder: (BuildContext context) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment