Skip to content

[PopUpMenuButton] When the menu is open, scroll gesture doesn't dismiss the modal barrier #90223

@nosmirck

Description

@nosmirck

Steps to Reproduce

This is the minimal code required to reproduce it, open the popup menu from the AppBar and attempt to scroll the ListView behind it. Only possible actions are either tap anywhere outside the popup menu to dismiss it or select an item. Scrolling the background ListView should be possible. Optionally, we should be able to set the behaviour for this, we could have this default behavior (only possible actions are to tap to close or select item), close on any action (not just tap, any gesture, like drag) or pass through the gesture (let the gesture be passed down if not captured by the pop-up menu).

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({
    Key? key,
  }) : super(key: key);

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Flutter Example'),
        actions: [
          PopupMenuButton<int>(
            icon: const Icon(Icons.view_list_rounded),
            onSelected: (_) {},
            itemBuilder: (context) => List.generate(
              100,
              (i) => PopupMenuItem(
                child: Text('Pop Up Menu Item $i'),
                value: i,
              ),
            ),
          ),
        ],
      ),
      body: ListView(
        children: List.generate(
          100,
          (i) => ListTile(
            title: Text('Sample item $i'),
          ),
        ),
      ),
    );
  }
}
Flutter Doctor
[√] Flutter (Channel stable, 2.5.0, on Microsoft Windows [Version 10.0.19043.1237],
    locale en-CA)
    • Flutter version 2.5.0 at C:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4cc385b4b8 (9 days ago), 2021-09-07 23:01:49 -0700        
    • Engine revision f0826da7ef
    • Dart version 2.14.0

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.0-rc2)
    • Android SDK at D:\Android
    • Platform android-30, build-tools 30.0.0-rc2
    • ANDROID_HOME = D:\Android
    • Java binary at: D:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)    
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Professional 2019 16.6.2)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual
      Studio\2019\Professional
    • Visual Studio Professional 2019 version 16.6.30204.135
    • Windows 10 SDK version 10.0.18362.0

[√] Android Studio (version 4.0)
    • Android Studio at D:\Program Files\Android\Android Studio
    • Flutter plugin version 49.0.2
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)    

[√] VS Code (version 1.60.1)
    • VS Code at C:\Users\nosmi\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.26.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version      
      10.0.19043.1237]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 93.0.4577.82      
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 93.0.961.47      

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: fidelityMatching the OEM platforms bettercustomer: sameheref: material designflutter/packages/flutter/material repository.f: scrollingViewports, list views, slivers, etc.found in release: 2.5Found to occur in 2.5found in release: 2.6Found to occur in 2.6frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions