Skip to content

Bug: Floating Snackbar captures touch events on its margin area #108785

@AlexDochioiu

Description

@AlexDochioiu

Steps to Reproduce

Flutter 3.0.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f1875d570e (3 weeks ago) • 2022-07-13 11:24:16 -0700
Engine • revision e85ea0e79c
Tools • Dart 2.17.6 • DevTools 2.12.2

Running the following

ScaffoldMessenger.of(context).showSnackBar(
                SnackBar(
                  content: Text("Coming soon"),
                  behavior: SnackBarBehavior.floating,
                  margin: EdgeInsets.only(bottom: 70, left: 10, right: 10),
                ),
              )

Will place the snackbar at expected location and the content below it is visible as expected (in my cause it's placing the snackbar above a bottom navigation bar). However, touch events to the navigation bar (or anything below the snackbar are intercepted by the snackbar itself so, in my case, the navigation bar cannot be used until the snackbar goes away or is dismissed).

P.S. I know there are workarounds by adding another scaffold for the main screen, etc, but this is not the point of this bug report. I'm raising this because floating widgets should not capture events around them.

P.P.S. Even if some would argue that my usage of snackbar is not 100% correct (by being placed in the wrong scaffold), snackbars should sometimes be placed above other UI elements (such as FAB) as outlined in the material design guidelines (https://material.io/components/snackbars#placement).

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: duplicateIssue is closed as a duplicate of an existing issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions