Closed itsJoKr closed 4 months ago
I tracked the problem down to bottom_sheet.dart
, in the build method there's the logic:
mediaQuery.accessibleNavigation
? 1.0
: widget.animationController.value);
I get the idea of disabling animation, BUT you cannot rely on accessibleNavigation
to check if TalkBack is on.
In my case, I don't have any accessibility features turned on. You can read more about the issue here: https://github.com/flutter/flutter/issues/128409
I think the best way is to remove the accessibleNavigation check making it always animate with widget.animationController.value
.
Same on Samsung phone. There is only animations on barrier color instead of sheet.
May my code help you.
MyBottomSheet
is a copy of BarBottomSheet
with different style.
Future<T?> showMyBottomSheet<T>({
required BuildContext context,
required WidgetBuilder builder,
...
}) {
//...
if (showCompatibility) {
myBuilder = (ctx) {
return MyBottomSheet(child: builder(ctx));
};
myContainerWidget =
(BuildContext ctx, Animation<double> animation, Widget child) {
final tween = Tween<Offset>(
begin: const Offset(0, 1),
end: Offset.zero,
).chain(CurveTween(curve: Curves.easeOutCirc));
return SlideTransition(
position: tween.animate(animation),
child: child,
);
};
} else {
myBuilder = builder;
myContainerWidget = (_, __, Widget child) {
return MyBottomSheet(
child: child,
);
};
}
return showCustomModalBottomSheet(
context: context,
builder: myBuilder,
containerWidget: myContainerWidget,...
);
}
Wondering if this is still valid issue? I don't see the reference to mediaQuery.accessibleNavigation
in the code anymore. Can you check @itsJoKr?
@orestesgaolin It works on Pixel 7A, so I guess it's fixed. Thanks for the info.
I noticed that iOS-styled modal bottom sheet doesn't drag on some devices, such as Pixel 7a. It will animate screen behind correctly.
The same thing works on Android emulator, iOS simulator and iPhone devices.
https://github.com/jamesblasco/modal_bottom_sheet/assets/11093480/c0191939-fe0e-4a31-9c17-952e581e2d3c