VelocityX icon indicating copy to clipboard operation
VelocityX copied to clipboard

VxToast behind system nav bar in android 15 (edge-to-edge)

Open btraas opened this issue 7 months ago • 0 comments

Describe the bug When using edge-to-edge mode (now enforced in android 15), VxToast can appear behind the system nav bar.

To Reproduce Steps to reproduce the behavior:

  1. Set targetSdk to 35 in app/build.gradle
  2. Add a basic VxToast, i.e. VxToast.show(context, msg: "Hello World".text.make());
  3. Test on an android 15 device with system navigation bar enabled, and not a high resolution (see below). Likely not replicable on a tablet or XL / plus size device.
  4. See toast behind navigation bar (or at least much lower than it should be / lower than it is on API 34)

Expected behavior Toast appears fully above the navigation bar

Screenshots

Image

Desktop N/A

Smartphone

  • Device: Pixel 9 pro
  • Vertical DP: 857 or lower, (display size 3/5 or higher on a pixel 9 pro) (important!)
  • OS: Android 15
  • Navigation mode: 3-button navigation (important)
  • Version: Flutter 3.27+ (tested 3.32.1), Android targetSdk 35+ (tested targetSdk 35)

Additional context

This is a result of "edge to edge" mode, which is now enforced in android 15 / API 35, when the navigation bar is enabled on the device (i.e. not the fancy new swipe gestures).

https://docs.flutter.dev/release/breaking-changes/default-systemuimode-edge-to-edge

It can be replicated in a basic flutter app that meets all of these conditions:

  • Flutter 3.27+
  • Android targetSdk 35+ in app/build.gradle
  • Device has android 15+
  • Device has navigation bar enabled (not swipe gestures)

Occurs with basic VxToast usage:

  • VxToast.show(context, msg: "Hello World".text.make());

Note: because VelocityX uses a percentage-based positioning, devices with a high vertical resolution may not be cut off.

Example app with issue: https://github.com/btraas/vxtoast_android15_demo

Simple commit that fixes the issue: https://github.com/iampawan/VelocityX/compare/stable...btraas:VelocityX:edge_to_edge_fix

Would you like me to submit a PR? I have verified that this change makes API 35 now have the same toast position as API 34. I have also tested this commit on android API 34 and iOS.

btraas avatar Jun 14 '25 09:06 btraas