Skip to content

SnackBar shows behind modalBottomSheet #75968

@samu-developments

Description

@samu-developments

Steps to Reproduce

  1. Run flutter create bug.
  2. Update the files as follows:
    add to scaffold fab:
onPressed: () {
  showModalBottomSheet(
    context: context,
    builder: (context) {
      return Container(height: 100, color: Colors.green);
    },
  );
  ScaffoldMessenger.of(context).showSnackBar(
      SnackBar(content: Text('Snackbar is behind modal')));
},
  1. Run and press fab

Expected results:

SnackBar should show above modalBottomSheet, as detail in Material spec: https://material.io/components/snackbars#placement
(see "Place snackbars in front of medium extended sheets.")

Actual results:

SnackBar is hidden behind modal.

I believe this is closely related to #73558, however that PR was for persistent bottom bars, not modals. That PR is working as expected.

The issue can be seen in the screenshot below.
Screenshot from 2021-02-13 15-15-44

Logs
flutter doctor -v
[✓] Flutter (Channel master, 1.27.0-2.0.pre.96, on Linux, locale en_US.UTF-8)
• Flutter version 1.27.0-2.0.pre.96 at /home/oyvindsam/Development/flutter/sdk/flutter
    • Framework revision 8104c5786d (11 hours ago), 2021-02-12 21:41:03 -0500
    • Engine revision 1d537824d6
    • Dart version 2.13.0 (build 2.13.0-30.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
    • Android SDK at /home/oyvindsam/Development/Android/Sdk
    • Platform android-30, build-tools 30.0.0
    • Java binary at: /opt/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /usr/bin/google-chrome-stable

[✓] Android Studio
    • Android Studio at /opt/android-studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] IntelliJ IDEA Ultimate Edition (version 2020.3)
    • IntelliJ at /opt/intellij-idea-ultimate-edition
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    f: material designflutter/packages/flutter/material repository.found in release: 1.27Found to occur in 1.27frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions